Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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()
{
}
}