bug #26236 [PropertyInfo] ReflectionExtractor: give a chance to other 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
-------
270147b04f
[PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties
This commit is contained in:
commit
ddc32e37b8
@ -76,7 +76,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
$properties[$propertyName] = $propertyName;
|
||||
}
|
||||
|
||||
return array_values($properties);
|
||||
return $properties ? array_values($properties) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,6 +57,8 @@ class ReflectionExtractorTest extends TestCase
|
||||
),
|
||||
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
|
||||
);
|
||||
|
||||
$this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user