8000 bug #21331 [PropertyInfo] Exclude static methods form properties gues… · symfony/symfony@0ca3e96 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ca3e96

Browse files
committed
bug #21331 [PropertyInfo] Exclude static methods form properties guessing (dunglas)
This PR was merged into the 2.8 branch. Discussion ---------- [PropertyInfo] Exclude static methods form properties guessing | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 190c736 [PropertyInfo] Exclude static methods form properties guessing
2 parents e18281e + 190c736 commit 0ca3e96

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)
0