[PropertyInfo] Don't try to access a property thru a static method
This commit is contained in:
parent
e18281eef6
commit
3b4858fe88
|
@ -253,6 +253,9 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
|||
|
||||
try {
|
||||
$reflectionMethod = new \ReflectionMethod($class, $methodName);
|
||||
if ($reflectionMethod->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
(self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) ||
|
||||
|
|
|
@ -258,6 +258,9 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
foreach (self::$accessorPrefixes as $prefix) {
|
||||
try {
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
|
||||
if ($reflectionMethod->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (0 === $reflectionMethod->getNumberOfRequiredParameters()) {
|
||||
return array($reflectionMethod, $prefix);
|
||||
|
@ -286,6 +289,9 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
foreach (self::$mutatorPrefixes as $prefix) {
|
||||
try {
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
|
||||
if ($reflectionMethod->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parameter can be optional to allow things like: method(array $foo = null)
|
||||
if ($reflectionMethod->getNumberOfParameters() >= 1) {
|
||||
|
|
|
@ -68,6 +68,8 @@ class PhpDocExtractorTest extends \PHPUnit_Framework_TestCase
|
|||
array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null),
|
||||
array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null),
|
||||
array('donotexist', null, null, null),
|
||||
array('staticGetter', null, null, null),
|
||||
array('staticSetter', null, null, null),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
|
|||
array('e', null),
|
||||
array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime')))),
|
||||
array('donotexist', null),
|
||||
array('staticGetter', null),
|
||||
array('staticSetter', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,17 @@ class Dummy extends ParentDummy
|
|||
*/
|
||||
public $B;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function staticGetter()
|
||||
{
|
||||
}
|
||||
|
||||
public static function staticSetter(\DateTime $d)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* A.
|
||||
*
|
||||
|
|
Reference in New Issue