bug #17416 [PropertyInfo] PhpDocExtractor: Fix a notice when the property doesn'… (dunglas)

This PR was merged into the 2.8 branch.

Discussion
----------

[PropertyInfo] PhpDocExtractor: Fix a notice when the property doesn'…

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

73db0ec [PropertyInfo] PhpDocExtractor: Fix a notice when the property doesn't exist
This commit is contained in:
Fabien Potencier 2016-01-18 13:39:03 +01:00
commit 617bf78b17
3 changed files with 4 additions and 1 deletions

View File

@ -189,7 +189,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
break;
default:
$data = array(null, null);
$data = array(null, null, null);
}
return $this->docBlocks[$propertyHash] = $data;

View File

@ -67,6 +67,7 @@ class PhpDocExtractorTest extends \PHPUnit_Framework_TestCase
array('d', array(new Type(Type::BUILTIN_TYPE_BOOL)), null, null),
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),
);
}
}

View File

@ -71,6 +71,7 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
array('d', array(new Type(Type::BUILTIN_TYPE_BOOL))),
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),
);
}
@ -89,6 +90,7 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
array('foo', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true))),
array('bar', array(new Type(Type::BUILTIN_TYPE_INT))),
array('baz', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)))),
array('donotexist', null),
);
}