[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.
This commit is contained in:
Stefan Bürk
2025-11-26 22:06:27 +01:00
parent 90a04bcbf0
commit 67d330993f
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -282,8 +282,8 @@ final class StandardTagFactory implements TagFactory
}
$parameterName = $parameter->getName();
if (isset($locator[$typeHint])) {
$arguments[$parameterName] = $locator[$typeHint];
if (isset($locator[$typeHint ?? ''])) {
$arguments[$parameterName] = $locator[$typeHint ?? ''];
continue;
}
@@ -525,6 +525,11 @@ class StandardTagFactoryTest extends TestCase
'tag',
'@tag (is valid)',
],
'full-qualified-class-name following a tag name is valid' => [
'@tag \InvalidArgumentException',
'tag',
'@tag \InvalidArgumentException',
],
];
}