Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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: [ '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
9 changes: 7 additions & 2 deletions src/ParameterDeriverTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ protected function getParameterType($callable): string
}

$rType = $params[0]->getType();
if ($rType === null) {
throw new \InvalidArgumentException('Listeners must declare an object type they can accept.');
if (
$rType === null // no type declared
|| !($rType instanceof \ReflectionNamedType) // type is union or intersection
|| $rType->isBuiltIn() // type is built-in, aka scalar/primitive
) {
throw new \InvalidArgumentException('Listeners must declare a single class/interface type they can accept.');
}

$type = $rType->getName();
}
catch (\ReflectionException $e) {
Expand Down
Loading