From 641eb3f07f2990520d7033b4574a19029125c760 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Mon, 8 Oct 2018 22:37:37 +0200 Subject: [PATCH 1/8] [PropertyInfo] add option to reflection property list extractor to exclude public static properties --- .../Extractor/ReflectionExtractor.php | 4 +- .../Extractor/ReflectionExtractorTest.php | 47 +++++++++++++++++++ .../PropertyInfo/Tests/Fixtures/Dummy.php | 5 ++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index b74a6115aae3..c4ef26711ef5 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -27,6 +27,8 @@ */ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface { + public const EXCLUDE_STATIC_PROPERTIES = 'exclude_static_properties'; + /** * @internal */ @@ -75,7 +77,7 @@ public function getProperties($class, array $context = array()) $properties = array(); foreach ($reflectionProperties as $reflectionProperty) { - if ($reflectionProperty->isPublic()) { + if ($reflectionProperty->isPublic() && (!($context[self::EXCLUDE_STATIC_PROPERTIES] ?? false) || !$reflectionProperty->isStatic())) { $properties[$reflectionProperty->name] = $reflectionProperty->name; } } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 762b0fed481c..aa221e621922 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -49,6 +49,7 @@ public function testGetProperties() 'h', 'i', 'j', + 'k', 'emptyVar', 'iteratorCollection', 'iteratorCollectionWithKey', @@ -93,6 +94,7 @@ public function testGetPropertiesWithCustomPrefixes() 'h', 'i', 'j', + 'k', 'emptyVar', 'iteratorCollection', 'iteratorCollectionWithKey', @@ -129,6 +131,7 @@ public function testGetPropertiesWithNoPrefixes() 'h', 'i', 'j', + 'k', 'emptyVar', 'iteratorCollection', 'iteratorCollectionWithKey', @@ -144,6 +147,50 @@ public function testGetPropertiesWithNoPrefixes() ); } + public function testGetPropertiesWithoutStaticProperties() + { + $this->assertSame( + array( + 'bal', + 'parent', + 'collection', + 'nestedCollection', + 'mixedCollection', + 'B', + 'Guid', + 'g', + 'h', + 'i', + 'j', + 'emptyVar', + 'iteratorCollection', + 'iteratorCollectionWithKey', + 'nestedIterators', + 'foo', + 'foo2', + 'foo3', + 'foo4', + 'foo5', + 'files', + 'a', + 'DOB', + 'Id', + '123', + 'self', + 'realParent', + 'c', + 'd', + 'e', + 'f', + ), + $this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( + ReflectionExtractor::EXCLUDE_STATIC_PROPERTIES => true, + )) + ); + + $this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties')); + } + /** * @dataProvider typesProvider */ diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 9bd856bd47df..f6ebdc8c3fbe 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -93,6 +93,11 @@ class Dummy extends ParentDummy */ public $j; + /** + * @var ?string + */ + public static $k; + /** * This should not be removed. * From 16322679787a5038ba5ef3d87a75d92f3d043bcb Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Mon, 8 Oct 2018 22:39:52 +0200 Subject: [PATCH 2/8] [Serializer] use property info component to extract class properties --- .../Normalizer/ObjectNormalizer.php | 57 +++---------------- .../Tests/Normalizer/ObjectNormalizerTest.php | 4 +- .../Component/Serializer/composer.json | 4 +- 3 files changed, 13 insertions(+), 52 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 6d8a9ff51e84..72a99bac0582 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -14,6 +14,8 @@ use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; +use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Mapping\AttributeMetadata; @@ -32,6 +34,8 @@ class ObjectNormalizer extends AbstractObjectNormalizer private $discriminatorCache = array(); + private $propertyListExtractor; + public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, callable $objectClassResolver = null, array $defaultContext = array()) { if (!\class_exists(PropertyAccess::class)) { @@ -41,6 +45,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory parent::__construct($classMetadataFactory, $nameConverter, $propertyTypeExtractor, $classDiscriminatorResolver, $objectClassResolver, $defaultContext); $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + $this->propertyListExtractor = $propertyListExtractor ?? new ReflectionExtractor(); } /** @@ -56,55 +61,11 @@ public function hasCacheableSupportsMethod(): bool */ protected function extractAttributes($object, $format = null, array $context = array()) { - // If not using groups, detect manually - $attributes = array(); - - // methods - $reflClass = new \ReflectionClass($object); - foreach ($reflClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflMethod) { - if ( - 0 !== $reflMethod->getNumberOfRequiredParameters() || - $reflMethod->isStatic() || - $reflMethod->isConstructor() || - $reflMethod->isDestructor() - ) { - continue; - } - - $name = $reflMethod->name; - $attributeName = null; - - if (0 === strpos($name, 'get') || 0 === strpos($name, 'has')) { - // getters and hassers - $attributeName = substr($name, 3); - - if (!$reflClass->hasProperty($attributeName)) { - $attributeName = lcfirst($attributeName); - } - } elseif (0 === strpos($name, 'is')) { - // issers - $attributeName = substr($name, 2); - - if (!$reflClass->hasProperty($attributeName)) { - $attributeName = lcfirst($attributeName); - } - } - - if (null !== $attributeName && $this->isAllowedAttribute($object, $attributeName, $format, $context)) { - $attributes[$attributeName] = true; - } - } - - // properties - foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) { - if ($reflProperty->isStatic() || !$this->isAllowedAttribute($object, $reflProperty->name, $format, $context)) { - continue; - } - - $attributes[$reflProperty->name] = true; - } + $properties = $this->propertyListExtractor->getProperties(get_class($object), ['exclude_static_properties' => true]); - return array_keys($attributes); + return array_filter($properties, function (string $attribute) use ($object, $format, $context) { + return $this->isAllowedAttribute($object, $attribute, $format, $context); + }); } /** diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 9eff7914d1c8..98f8d8b450ed 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -867,7 +867,7 @@ public function testExtractAttributesRespectsFormat() $data->setFoo('bar'); $data->bar = 'foo'; - $this->assertSame(array('foo' => 'bar', 'bar' => 'foo'), $normalizer->normalize($data, 'foo_and_bar_included')); + $this->assertSame(array('bar' => 'foo', 'foo' => 'bar'), $normalizer->normalize($data, 'foo_and_bar_included')); } public function testExtractAttributesRespectsContext() @@ -878,7 +878,7 @@ public function testExtractAttributesRespectsContext() $data->setFoo('bar'); $data->bar = 'foo'; - $this->assertSame(array('foo' => 'bar', 'bar' => 'foo'), $normalizer->normalize($data, null, array('include_foo_and_bar' => true))); + $this->assertSame(array('bar' => 'foo', 'foo' => 'bar'), $normalizer->normalize($data, null, array('include_foo_and_bar' => true))); } public function testAttributesContextNormalize() diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index 52961bb7c052..41de6d150e51 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -17,7 +17,8 @@ ], "require": { "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/property-info": "~4.2" }, "require-dev": { "symfony/yaml": "~3.4|~4.0", @@ -25,7 +26,6 @@ "symfony/property-access": "~3.4|~4.0", "symfony/http-foundation": "~3.4|~4.0", "symfony/cache": "~3.4|~4.0", - "symfony/property-info": "~3.4|~4.0", "symfony/validator": "~3.4|~4.0", "doctrine/annotations": "~1.0", "symfony/dependency-injection": "~3.4|~4.0", From da41bcb7cd06b885fa078664fd5b01ee238839e2 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 9 Oct 2018 09:11:36 +0200 Subject: [PATCH 3/8] [PropertyInfo] use dataProvider for ReflectionExtractor::getProperties tests --- .../Extractor/ReflectionExtractorTest.php | 316 +++++++++--------- 1 file changed, 166 insertions(+), 150 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index aa221e621922..a695b0d180d3 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -34,161 +34,177 @@ protected function setUp() $this->extractor = new ReflectionExtractor(); } - public function testGetProperties() - { - $this->assertSame( - array( - 'bal', - 'parent', - 'collection', - 'nestedCollection', - 'mixedCollection', - 'B', - 'Guid', - 'g', - 'h', - 'i', - 'j', - 'k', - 'emptyVar', - 'iteratorCollection', - 'iteratorCollectionWithKey', - 'nestedIterators', - 'foo', - 'foo2', - 'foo3', - 'foo4', - 'foo5', - 'files', - 'a', - 'DOB', - 'Id', - '123', - 'self', - 'realParent', - 'c', - 'd', - 'e', - 'f', - ), - $this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy') - ); - - $this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties')); - } - - public function testGetPropertiesWithCustomPrefixes() - { - $customExtractor = new ReflectionExtractor(array('add', 'remove'), array('is', 'can')); - - $this->assertSame( - array( - 'bal', - 'parent', - 'collection', - 'nestedCollection', - 'mixedCollection', - 'B', - 'Guid', - 'g', - 'h', - 'i', - 'j', - 'k', - 'emptyVar', - 'iteratorCollection', - 'iteratorCollectionWithKey', - 'nestedIterators', - 'foo', - 'foo2', - 'foo3', - 'foo4', - 'foo5', - 'files', - 'c', - 'd', - 'e', - 'f', - ), - $customExtractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy') - ); - } - - public function testGetPropertiesWithNoPrefixes() + /** + * @dataProvider getPropertiesProvider + */ + public function testGetProperties($class, $expected, $mutatorPrefixes, $accessorPrefixes, $arrayMutatorPrefixes, $context) { - $noPrefixExtractor = new ReflectionExtractor(array(), array(), array()); + $extractor = new ReflectionExtractor($mutatorPrefixes, $accessorPrefixes, $arrayMutatorPrefixes); - $this->assertSame( - array( - 'bal', - 'parent', - 'collection', - 'nestedCollection', - 'mixedCollection', - 'B', - 'Guid', - 'g', - 'h', - 'i', - 'j', - 'k', - 'emptyVar', - 'iteratorCollection', - 'iteratorCollectionWithKey', - 'nestedIterators', - 'foo', - 'foo2', - 'foo3', - 'foo4', - 'foo5', - 'files', - ), - $noPrefixExtractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy') - ); + $this->assertSame($expected, $extractor->getProperties($class, $context)); } - public function testGetPropertiesWithoutStaticProperties() + public function getPropertiesProvider() { - $this->assertSame( - array( - 'bal', - 'parent', - 'collection', - 'nestedCollection', - 'mixedCollection', - 'B', - 'Guid', - 'g', - 'h', - 'i', - 'j', - 'emptyVar', - 'iteratorCollection', - 'iteratorCollectionWithKey', - 'nestedIterators', - 'foo', - 'foo2', - 'foo3', - 'foo4', - 'foo5', - 'files', - 'a', - 'DOB', - 'Id', - '123', - 'self', - 'realParent', - 'c', - 'd', - 'e', - 'f', - ), - $this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( - ReflectionExtractor::EXCLUDE_STATIC_PROPERTIES => true, - )) - ); - - $this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties')); + return [ + [ + 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', + array( + 'bal', + 'parent', + 'collection', + 'nestedCollection', + 'mixedCollection', + 'B', + 'Guid', + 'g', + 'h', + 'i', + 'j', + 'k', + 'emptyVar', + 'iteratorCollection', + 'iteratorCollectionWithKey', + 'nestedIterators', + 'foo', + 'foo2', + 'foo3', + 'foo4', + 'foo5', + 'files', + 'a', + 'DOB', + 'Id', + '123', + 'self', + 'realParent', + 'c', + 'd', + 'e', + 'f', + ), + null, + null, + null, + array(), + ], + [ + 'Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties', + null, + null, + null, + null, + array(), + ], + [ + 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', + array( + 'bal', + 'parent', + 'collection', + 'nestedCollection', + 'mixedCollection', + 'B', + 'Guid', + 'g', + 'h', + 'i', + 'j', + 'k', + 'emptyVar', + 'iteratorCollection', + 'iteratorCollectionWithKey', + 'nestedIterators', + 'foo', + 'foo2', + 'foo3', + 'foo4', + 'foo5', + 'files', + 'c', + 'd', + 'e', + 'f', + ), + array('add', 'remove'), + array('is', 'can'), + null, + array(), + ], + [ + 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', + array( + 'bal', + 'parent', + 'collection', + 'nestedCollection', + 'mixedCollection', + 'B', + 'Guid', + 'g', + 'h', + 'i', + 'j', + 'k', + 'emptyVar', + 'iteratorCollection', + 'iteratorCollectionWithKey', + 'nestedIterators', + 'foo', + 'foo2', + 'foo3', + 'foo4', + 'foo5', + 'files', + ), + array(), + array(), + array(), + array(), + ], + [ + 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', + array( + 'bal', + 'parent', + 'collection', + 'nestedCollection', + 'mixedCollection', + 'B', + 'Guid', + 'g', + 'h', + 'i', + 'j', + 'emptyVar', + 'iteratorCollection', + 'iteratorCollectionWithKey', + 'nestedIterators', + 'foo', + 'foo2', + 'foo3', + 'foo4', + 'foo5', + 'files', + 'a', + 'DOB', + 'Id', + '123', + 'self', + 'realParent', + 'c', + 'd', + 'e', + 'f', + ), + null, + null, + null, + array( + ReflectionExtractor::EXCLUDE_STATIC_PROPERTIES => true, + ) + ] + ]; } /** From c29d9715d31760fc1ef7582669a7e57103529340 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 9 Oct 2018 09:12:13 +0200 Subject: [PATCH 4/8] [Serializer] improve ObjectNormalizer perfs --- .../Serializer/Normalizer/ObjectNormalizer.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 72a99bac0582..98316eba5cef 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -61,11 +61,16 @@ public function hasCacheableSupportsMethod(): bool */ protected function extractAttributes($object, $format = null, array $context = array()) { - $properties = $this->propertyListExtractor->getProperties(get_class($object), ['exclude_static_properties' => true]); + $properties = $this->propertyListExtractor->getProperties(\get_class($object), array(ReflectionExtractor::EXCLUDE_STATIC_PROPERTIES => true)); - return array_filter($properties, function (string $attribute) use ($object, $format, $context) { - return $this->isAllowedAttribute($object, $attribute, $format, $context); - }); + $allowedProperties = array(); + foreach ($properties as $property) { + if ($this->isAllowedAttribute($object, $property, $format, $context)) { + $allowedProperties[] = $property; + } + } + + return $allowedProperties; } /** From ede5bdb53ba6cd77aa2df12b7eb083acb0e5921c Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 9 Oct 2018 09:14:31 +0200 Subject: [PATCH 5/8] [PropertyInfo] fix CS --- .../Extractor/ReflectionExtractorTest.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index a695b0d180d3..2ee90067c171 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -46,8 +46,8 @@ public function testGetProperties($class, $expected, $mutatorPrefixes, $accessor public function getPropertiesProvider() { - return [ - [ + return array( + array( 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( 'bal', @@ -87,16 +87,16 @@ public function getPropertiesProvider() null, null, array(), - ], - [ + ), + array( 'Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties', null, null, null, null, array(), - ], - [ + ), + array( 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( 'bal', @@ -130,8 +130,8 @@ public function getPropertiesProvider() array('is', 'can'), null, array(), - ], - [ + ), + array( 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( 'bal', @@ -161,8 +161,8 @@ public function getPropertiesProvider() array(), array(), array(), - ], - [ + ), + array( 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', array( 'bal', @@ -202,9 +202,9 @@ public function getPropertiesProvider() null, array( ReflectionExtractor::EXCLUDE_STATIC_PROPERTIES => true, - ) - ] - ]; + ), + ), + ); } /** From 2aa0779e0de3780963d33908307d1f56ae17624b Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 16 Oct 2018 08:08:20 +0200 Subject: [PATCH 6/8] [PropertyInfo] add changelog entry --- src/Symfony/Component/PropertyInfo/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/PropertyInfo/CHANGELOG.md b/src/Symfony/Component/PropertyInfo/CHANGELOG.md index a81f3124a67c..b307e6718620 100644 --- a/src/Symfony/Component/PropertyInfo/CHANGELOG.md +++ b/src/Symfony/Component/PropertyInfo/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * added `PropertyInitializableExtractorInterface` to test if a property can be initialized through the constructor (implemented by `ReflectionExtractor`) +* added `exclude_static_properties` option to `ReflectionExtractor` to exclude public static properties when listing properties 3.3.0 ----- From 3498ab5f5a9c70d663f0a557520118365fb43730 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Mon, 5 Nov 2018 23:10:10 +0100 Subject: [PATCH 7/8] fix rebase --- .../Component/Serializer/Normalizer/ObjectNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index 98316eba5cef..545b9065c6ac 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -36,7 +36,7 @@ class ObjectNormalizer extends AbstractObjectNormalizer private $propertyListExtractor; - public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, callable $objectClassResolver = null, array $defaultContext = array()) + public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null, ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, callable $objectClassResolver = null, array $defaultContext = array(), PropertyListExtractorInterface $propertyListExtractor = null) { if (!\class_exists(PropertyAccess::class)) { throw new LogicException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.'); From ea96a4de1f5b13d5bf8dd84a27282bcefaed2053 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Fri, 16 Nov 2018 00:15:25 +0100 Subject: [PATCH 8/8] [PropertyInfo] update changelog entry --- src/Symfony/Component/PropertyInfo/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/CHANGELOG.md b/src/Symfony/Component/PropertyInfo/CHANGELOG.md index b307e6718620..432be688a73c 100644 --- a/src/Symfony/Component/PropertyInfo/CHANGELOG.md +++ b/src/Symfony/Component/PropertyInfo/CHANGELOG.md @@ -1,11 +1,15 @@ CHANGELOG ========= +4.3.0 +----- + +* added `exclude_static_properties` option to `ReflectionExtractor` to exclude public static properties when listing properties + 4.2.0 ----- * added `PropertyInitializableExtractorInterface` to test if a property can be initialized through the constructor (implemented by `ReflectionExtractor`) -* added `exclude_static_properties` option to `ReflectionExtractor` to exclude public static properties when listing properties 3.3.0 -----