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

This commit is contained in:
Kévin Dunglas 2016-01-18 11:44:30 +01:00
parent 3223c2517e
commit 73db0ec7b4
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),
);
}