From 67d330993f07c7cd9c9a5afe13a30aede812e4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Wed, 26 Nov 2025 17:42:05 +0100 Subject: [PATCH 1/2] [BUGFIX] Mitigate "Using null as an array offset is deprecated" Using `DocBlockFactory->create()` with a phpdocblock hanging a `@throws` tag followed by a exception class name emits following PHP 8.5.0 deprecation: ``` Using null as an array offset is deprecated, use an empty string instead ``` in `StandardTagFactory->getArgumentsForParametersFromWiring()`. This change uses the null-coalsce operator to fallback to an empty string for the value which should be used as an array key instead of using `null` to mitigate the deprecation notice with PHP8.5.0 and matches the behaviour in earlier PHP versions without the deprecation message. --- src/DocBlock/StandardTagFactory.php | 4 ++-- tests/unit/DocBlock/StandardTagFactoryTest.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index d029cd1b..e580ef6a 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -282,8 +282,8 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l } $parameterName = $parameter->getName(); - if (isset($locator[$typeHint])) { - $arguments[$parameterName] = $locator[$typeHint]; + if (isset($locator[$typeHint ?? ''])) { + $arguments[$parameterName] = $locator[$typeHint ?? '']; continue; } diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 8dfced71..a75f5e64 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -525,6 +525,11 @@ public function validTagProvider(): array 'tag', '@tag (is valid)', ], + 'full-qualified-class-name following a tag name is valid' => [ + '@tag \InvalidArgumentException', + 'tag', + '@tag \InvalidArgumentException', + ], ]; } From 84265c845d20910c3130f0cf9c3b0124a3fe62cd Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 27 Nov 2025 20:45:57 +0100 Subject: [PATCH 2/2] Remove outdated test We support collections of self now. --- tests/integration/TypedTagsTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/integration/TypedTagsTest.php b/tests/integration/TypedTagsTest.php index b0f6d651..79e02b3c 100644 --- a/tests/integration/TypedTagsTest.php +++ b/tests/integration/TypedTagsTest.php @@ -179,10 +179,6 @@ public static function typeProvider(): array public static function invalidFormatsProvider(): \Generator { - yield from [ - 'invalid collection' => ['self'], - ]; - foreach (['<', '{', '('] as $badChar) { yield "invalid format open $badChar" => ["array$badChar\\fooo"]; }