From d3cc8a9f253906375291260a03b1719fb2206d54 Mon Sep 17 00:00:00 2001 From: Luca Suriano Date: Thu, 7 Feb 2019 07:34:50 +0100 Subject: [PATCH 1/2] Improving extracting type from constructor --- components/property_info.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/property_info.rst b/components/property_info.rst index 4eab1ee13c5..a40a9ea4926 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -370,6 +370,9 @@ Using PHP reflection, the :class:`Symfony\\Component\\PropertyInfo\\Extractor\\R 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. +The component is also able to extract the types of the constructor's parameters. +If the class is a sub-class, then the constructor's properties of the parent +superclass are extracted. .. note:: @@ -402,6 +405,9 @@ constructor. It supports return and scalar types for PHP 7. // Initializable information $reflectionExtractor->isInitializable($class, $property); + // Constructor information + $reflectionExtractor->extractFromConstructor($class, $property); + PhpDocExtractor ~~~~~~~~~~~~~~~ From f8c78902f60ad5bc4e93e4f5cb018be494899a32 Mon Sep 17 00:00:00 2001 From: Luca Suriano Date: Thu, 7 Feb 2019 07:56:24 +0100 Subject: [PATCH 2/2] getTypes example added --- components/property_info.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/property_info.rst b/components/property_info.rst index a40a9ea4926..6a06ab46200 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -402,11 +402,14 @@ superclass are extracted. $reflectionExtractor->isReadable($class, $property); $reflectionExtractor->isWritable($class, $property); - // Initializable information + // Initializable information. $reflectionExtractor->isInitializable($class, $property); - // Constructor information + // Constructor type information. $reflectionExtractor->extractFromConstructor($class, $property); + $reflectionExtractor->getTypes($class, $property, [ + 'enable_constructor_extraction' => true + ]); PhpDocExtractor ~~~~~~~~~~~~~~~