From 73db0ec7b4ae33e735917084a9783167a838beee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 18 Jan 2016 11:44:30 +0100 Subject: [PATCH] [PropertyInfo] PhpDocExtractor: Fix a notice when the property doesn't exist --- .../Component/PropertyInfo/Extractor/PhpDocExtractor.php | 2 +- .../PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php | 1 + .../PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index 0e10fcbc13..b1f323c0bd 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -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; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php index 2a1abd7509..038a30bdac 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php @@ -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), ); } } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index 8642c9731c..ab478dd12b 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -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), ); }