Skip to content

Commit

Permalink
[PropertyInfo] Update List Information from ReflectionExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Zander Baldwin authored and dunglas committed Dec 14, 2015
1 parent afc6ee4 commit b2da76c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
Expand Up @@ -62,9 +62,13 @@ public function getProperties($class, array $context = array())

foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
$propertyName = $this->getPropertyName($reflectionMethod->name);
if ($propertyName) {
$properties[$propertyName] = true;
if (!$propertyName || isset($properties[$propertyName])) {
continue;
}
if (!preg_match('/^[A-Z]{2,}/', $propertyName)) {
$propertyName = lcfirst($propertyName);
}
$properties[$propertyName] = true;
}

return array_keys($properties);
Expand Down
Expand Up @@ -36,18 +36,19 @@ public function testGetProperties()
'bal',
'parent',
'collection',
'B',
'foo',
'foo2',
'foo3',
'foo4',
'foo5',
'files',
'A',
'B',
'C',
'D',
'E',
'F',
'a',
'DOB',
'c',
'd',
'e',
'f',
),
$this->extractor->getProperties('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')
);
Expand Down
14 changes: 14 additions & 0 deletions src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php
Expand Up @@ -46,6 +46,11 @@ class Dummy extends ParentDummy
*/
public $collection;

/**
* @var ParentDummy
*/
public $B;

/**
* A.
*
Expand All @@ -63,4 +68,13 @@ public function getA()
public function setB(ParentDummy $parent = null)
{
}

/**
* Date of Birth.
*
* @return \DateTime
*/
public function getDOB()
{
}
}

0 comments on commit b2da76c

Please sign in to comment.