[PropertyInfo] Update List Information from ReflectionExtractor
This commit is contained in:
parent
afc6ee42ca
commit
b2da76ce5b
@ -62,9 +62,13 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||||||
|
|
||||||
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
|
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
|
||||||
$propertyName = $this->getPropertyName($reflectionMethod->name);
|
$propertyName = $this->getPropertyName($reflectionMethod->name);
|
||||||
if ($propertyName) {
|
if (!$propertyName || isset($properties[$propertyName])) {
|
||||||
$properties[$propertyName] = true;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!preg_match('/^[A-Z]{2,}/', $propertyName)) {
|
||||||
|
$propertyName = lcfirst($propertyName);
|
||||||
|
}
|
||||||
|
$properties[$propertyName] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_keys($properties);
|
return array_keys($properties);
|
||||||
|
@ -36,18 +36,19 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
|
|||||||
'bal',
|
'bal',
|
||||||
'parent',
|
'parent',
|
||||||
'collection',
|
'collection',
|
||||||
|
'B',
|
||||||
'foo',
|
'foo',
|
||||||
'foo2',
|
'foo2',
|
||||||
'foo3',
|
'foo3',
|
||||||
'foo4',
|
'foo4',
|
||||||
'foo5',
|
'foo5',
|
||||||
'files',
|
'files',
|
||||||
'A',
|
'a',
|
||||||
'B',
|
'DOB',
|
||||||
'C',
|
'c',
|
||||||
'D',
|
'd',
|
||||||
'E',
|
'e',
|
||||||
'F',
|
'f',
|
||||||
),
|
),
|
||||||
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
|
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
|
||||||
);
|
);
|
||||||
|
@ -46,6 +46,11 @@ class Dummy extends ParentDummy
|
|||||||
*/
|
*/
|
||||||
public $collection;
|
public $collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ParentDummy
|
||||||
|
*/
|
||||||
|
public $B;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A.
|
* A.
|
||||||
*
|
*
|
||||||
@ -63,4 +68,13 @@ class Dummy extends ParentDummy
|
|||||||
public function setB(ParentDummy $parent = null)
|
public function setB(ParentDummy $parent = null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date of Birth.
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getDOB()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user