Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/quality-assurance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
composer-flags: [ '' ]
phpunit-flags: [ '--coverage-text' ]
steps:
Expand Down
4 changes: 2 additions & 2 deletions src/DelegatingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class DelegatingProvider implements ListenerProviderInterface
*/
protected $providers =[];

/** @var ListenerProviderInterface */
/** @var ListenerProviderInterface|null */
protected $defaultProvider;

public function __construct(ListenerProviderInterface $defaultProvider = null)
public function __construct(?ListenerProviderInterface $defaultProvider = null)
{
if ($defaultProvider) {
$this->defaultProvider = $defaultProvider;
Expand Down
15 changes: 14 additions & 1 deletion src/ParameterDeriverTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,20 @@ protected function getParameterType($callable): string
if ($rType === null) {
throw new \InvalidArgumentException('Listeners must declare an object type they can accept.');
}
$type = $rType->getName();

// Support only a single named object type. Union or intersection
// types are not accepted for listener parameter typing. Use method
// existence checks instead of class checks for compatibility
// across PHP 7.2+ versions.
Comment thread
garrettw marked this conversation as resolved.
Resolved
if (method_exists($rType, 'getName')) {
if (method_exists($rType, 'isBuiltin') && $rType->isBuiltin()) {
throw new \InvalidArgumentException('Listeners must declare a class/interface type, not a builtin type.');
Comment thread
Crell marked this conversation as resolved.
Resolved
}

$type = $rType->getName();
} else {
throw new \InvalidArgumentException('Listeners must declare a single object type they can accept.');
}
}
catch (\ReflectionException $e) {
throw new \RuntimeException('Type error registering listener.', 0, $e);
Expand Down
Loading