March 9, 2020 Javier Eguiluz

Symfony 5.1 will be released in May 2020. This is the first article of the series that shows the most important new features introduced by this Symfony version.

PHP 7.4, which was released on November 28, 2019, added support for typed properties which allow to define the type of variables when declaring them:

1 2 3 4 5 6 7 8 9 10 11 use Symfony\Component\HttpFoundation\Request ; class SomeClass { public int $id ; protected string $name ; private ? bool $logResult ; public Request $request ; // ... }

The PropertyInfo component extracts information about the properties of PHP classes using several sources (Doctrine metadata, PHP reflection, PHPdoc config, etc.) In Symfony 5.1, we improved this component to also extract information from PHP typed properties.

Considering the previous example, this will be the result when using Symfony 5.1.: