From 190c736d3c5eb5a039cb5fb35729ef07fc26fa5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 18 Jan 2017 13:05:57 +0100 Subject: [PATCH] [PropertyInfo] Exclude static methods form properties guessing --- .../Component/PropertyInfo/Extractor/ReflectionExtractor.php | 4 ++++ src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 7fefbde2536a1..86be3b3e1503b 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -68,6 +68,10 @@ public function getProperties($class, array $context = array()) } foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { + if ($reflectionMethod->isStatic()) { + continue; + } + $propertyName = $this->getPropertyName($reflectionMethod->name); if (!$propertyName || isset($properties[$propertyName])) { continue; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 41a513ac362e1..660cc3002a238 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -51,6 +51,10 @@ class Dummy extends ParentDummy */ public $B; + public static function getStatic() + { + } + /** * A. *