mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
[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:
@@ -282,8 +282,8 @@ final class StandardTagFactory implements TagFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
$parameterName = $parameter->getName();
|
$parameterName = $parameter->getName();
|
||||||
if (isset($locator[$typeHint])) {
|
if (isset($locator[$typeHint ?? ''])) {
|
||||||
$arguments[$parameterName] = $locator[$typeHint];
|
$arguments[$parameterName] = $locator[$typeHint ?? ''];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -525,6 +525,11 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
'tag',
|
'tag',
|
||||||
'@tag (is valid)',
|
'@tag (is valid)',
|
||||||
],
|
],
|
||||||
|
'full-qualified-class-name following a tag name is valid' => [
|
||||||
|
'@tag \InvalidArgumentException',
|
||||||
|
'tag',
|
||||||
|
'@tag \InvalidArgumentException',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user