Skip to content

Commit

Permalink
bug #21331 [PropertyInfo] Exclude static methods form properties gues…
Browse files Browse the repository at this point in the history
…sing (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
  • Loading branch information
fabpot committed Jan 18, 2017
2 parents e18281e + 190c736 commit 0ca3e96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php
Expand Up @@ -51,6 +51,10 @@ class Dummy extends ParentDummy
*/
public $B;

public static function getStatic()
{
}

/**
* A.
*
Expand Down

0 comments on commit 0ca3e96

Please sign in to comment.