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

This commit is contained in:
Kévin Dunglas 2018-02-19 17:05:09 +01:00
parent 80e63e4146
commit 270147b04f
No known key found for this signature in database
GPG Key ID: 4D04EBEF06AAF3A6
3 changed files with 24 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
$properties[$propertyName] = $propertyName;
}
return array_values($properties);
return $properties ? array_values($properties) : null;
}
/**

View File

@ -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'));
}
/**

View File

@ -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
{
}