Skip to content

[PropertyInfo] Mentioned that property types can be extracted from constructor too #11896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions components/property_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ ReflectionExtractor

Using PHP reflection, the :class:`Symfony\\Component\\PropertyInfo\\Extractor\\ReflectionExtractor`
provides list, type and access information from setter and accessor methods.
It can also give the type of a property, and if it is initializable through the
constructor. It supports return and scalar types for PHP 7::
It can also give the type of a property (even extracting it from the constructor
arguments), and if it is initializable through the constructor. It supports
return and scalar types for PHP 7::

use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;

Expand All @@ -371,6 +372,11 @@ constructor. It supports return and scalar types for PHP 7::
// Initializable information
$reflectionExtractor->isInitializable($class, $property);

.. versionadded:: 4.1

The feature to extract the property types from constructor arguments was
introduced in Symfony 4.1.

.. note::

When using the Symfony framework, this service is automatically registered
Expand Down