Skip to content

Commit

Permalink
[PropertyInfo] ReflectionExtractor: give a chance to other extractors…
Browse files Browse the repository at this point in the history
… if no properties
  • Loading branch information
dunglas committed Feb 19, 2018
1 parent 80e63e4 commit 270147b
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 270147b

Please sign in to comment.