Skip to content

Commit

Permalink
bug #26236 [PropertyInfo] ReflectionExtractor: give a chance to other…
Browse files Browse the repository at this point in the history
… extractors if no properties (dunglas)

This PR was merged into the 2.8 branch.

Discussion
----------

[PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #25803 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

For instance when using `__call()`, see #25803.
<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Replace this comment by a description of what your PR is solving.
-->

Commits
-------

270147b [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties
  • Loading branch information
fabpot committed Feb 19, 2018
2 parents 9cbb256 + 270147b commit ddc32e3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Expand Up @@ -76,7 +76,7 @@ public function getProperties($class, array $context = array())
$properties[$propertyName] = $propertyName;
}

return array_values($properties);
return $properties ? array_values($properties) : null;
}

/**
Expand Down
Expand Up @@ -57,6 +57,8 @@ public function testGetProperties()
),
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
);

$this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties'));
}

/**
Expand Down
21 changes: 21 additions & 0 deletions src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php
@@ -0,0 +1,21 @@
<?php

namespace Symfony\Component\PropertyInfo\Tests\Fixtures;

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\PropertyInfo\Tests\Fixtures;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NoProperties
{
}

0 comments on commit ddc32e3

Please sign in to comment.