Skip to content

Commit 190c736

Browse files
committed
[PropertyInfo] Exclude static methods form properties guessing
1 parent e18281e commit 190c736

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public function getProperties($class, array $context = array())
6868
}
6969

7070
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
71+
if ($reflectionMethod->isStatic()) {
72+
continue;
73+
}
74+
7175
$propertyName = $this->getPropertyName($reflectionMethod->name);
7276
if (!$propertyName || isset($properties[$propertyName])) {
7377
continue;

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class Dummy extends ParentDummy
5151
*/
5252
public $B;
5353

54+
public static function getStatic()
55+
{
56+
}
57+
5458
/**
5559
* A.
5660
*

0 commit comments

Comments
 (0)