From 52db5fc1f87d216dcc54bad77d4bf0ffef76a3f2 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Fri, 12 Apr 2024 08:57:38 +0200 Subject: [PATCH] [TASK] Align to phpdocumentor/reflection-docblock:5.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New version phpdocumentor/reflection-docblock:5.4.0 changed the signature of DocBlockFactory::createInstance(), which now points out a misuse in extbase. The patch changes the instantiation and avoids calling registerTagHandler() since this can and should be hand over to createInstance() directly. Resolves: #103614 Releases: main, 12.4 Change-Id: I344ef7df23dedd950c2775fe2fab93f7bb808786 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83751 Tested-by: Benni Mack <benni@typo3.org> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Benni Mack <benni@typo3.org> --- .../Classes/Reflection/ClassSchema.php | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php b/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php index 4edd2571af31..f0c8cdab0f31 100644 --- a/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php +++ b/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php @@ -20,6 +20,7 @@ namespace TYPO3\CMS\Extbase\Reflection; use Doctrine\Common\Annotations\AnnotationReader; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; @@ -99,15 +100,8 @@ class ClassSchema */ private $injectMethods = []; - /** - * @var PropertyInfoExtractor - */ - private static $propertyInfoExtractor; - - /** - * @var DocBlockFactory - */ - private static $docBlockFactory; + private static ?PropertyInfoExtractor $propertyInfoExtractor = null; + private static ?DocBlockFactoryInterface $docBlockFactory = null; /** * Constructs this class schema @@ -159,24 +153,25 @@ class ClassSchema } if (self::$docBlockFactory === null) { - self::$docBlockFactory = DocBlockFactory::createInstance(); - self::$docBlockFactory->registerTagHandler('author', Null_::class); - self::$docBlockFactory->registerTagHandler('covers', Null_::class); - self::$docBlockFactory->registerTagHandler('deprecated', Null_::class); - self::$docBlockFactory->registerTagHandler('link', Null_::class); - self::$docBlockFactory->registerTagHandler('method', Null_::class); - self::$docBlockFactory->registerTagHandler('property-read', Null_::class); - self::$docBlockFactory->registerTagHandler('property', Null_::class); - self::$docBlockFactory->registerTagHandler('property-write', Null_::class); - self::$docBlockFactory->registerTagHandler('return', Null_::class); - self::$docBlockFactory->registerTagHandler('see', Null_::class); - self::$docBlockFactory->registerTagHandler('since', Null_::class); - self::$docBlockFactory->registerTagHandler('source', Null_::class); - self::$docBlockFactory->registerTagHandler('throw', Null_::class); - self::$docBlockFactory->registerTagHandler('throws', Null_::class); - self::$docBlockFactory->registerTagHandler('uses', Null_::class); - self::$docBlockFactory->registerTagHandler('var', Null_::class); - self::$docBlockFactory->registerTagHandler('version', Null_::class); + self::$docBlockFactory = DocBlockFactory::createInstance([ + 'author' => Null_::class, + 'covers' => Null_::class, + 'deprecated' => Null_::class, + 'link' => Null_::class, + 'method' => Null_::class, + 'property-read' => Null_::class, + 'property' => Null_::class, + 'property-write' => Null_::class, + 'return' => Null_::class, + 'see' => Null_::class, + 'since' => Null_::class, + 'source' => Null_::class, + 'throw' => Null_::class, + 'throws' => Null_::class, + 'uses' => Null_::class, + 'var' => Null_::class, + 'version' => Null_::class, + ]); } $this->reflectProperties($reflectionClass); -- GitLab