[PropertyInfo] Respect property name case when guessing from public method name
This commit is contained in:
parent
31fcf93253
commit
843bb76f8a
@ -103,8 +103,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||||||
if (!$propertyName || isset($properties[$propertyName])) {
|
if (!$propertyName || isset($properties[$propertyName])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) {
|
if ($reflectionClass->hasProperty($lowerCasedPropertyName = lcfirst($propertyName)) || (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName))) {
|
||||||
$propertyName = lcfirst($propertyName);
|
$propertyName = $lowerCasedPropertyName;
|
||||||
}
|
}
|
||||||
$properties[$propertyName] = $propertyName;
|
$properties[$propertyName] = $propertyName;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ class ReflectionExtractorTest extends TestCase
|
|||||||
'123',
|
'123',
|
||||||
'self',
|
'self',
|
||||||
'realParent',
|
'realParent',
|
||||||
|
'xTotals',
|
||||||
|
'YT',
|
||||||
'c',
|
'c',
|
||||||
'd',
|
'd',
|
||||||
'e',
|
'e',
|
||||||
|
@ -93,6 +93,16 @@ class Dummy extends ParentDummy
|
|||||||
*/
|
*/
|
||||||
public $j;
|
public $j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $xTotals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $YT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should not be removed.
|
* This should not be removed.
|
||||||
*
|
*
|
||||||
@ -166,4 +176,18 @@ class Dummy extends ParentDummy
|
|||||||
public function setRealParent(parent $realParent)
|
public function setRealParent(parent $realParent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getXTotals()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getYT()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user