Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 270147b

Browse files
committed
[PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties
1 parent 80e63e4 commit 270147b

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getProperties($class, array $context = array())
7676
$properties[$propertyName] = $propertyName;
7777
}
7878

79-
return array_values($properties);
79+
return $properties ? array_values($properties) : null;
8080
}
8181

8282
/**

src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public function testGetProperties()
5757
),
5858
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
5959
);
60+
61+
$this->assertNull($this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\NoProperties'));
6062
}
6163

6264
/**
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
4+
5+
/*
6+
* This file is part of the Symfony package.
7+
*
8+
* (c) Fabien Potencier <[email protected]>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
15+
16+
/**
17+
* @author Kévin Dunglas <[email protected]>
18+
*/
19+
class NoProperties
20+
{
21+
}

0 commit comments

Comments
 (0)