Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Jan 12, 2024
1 parent a692bf0 commit dc69d84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<files psalm-version="5.19.0@06b71be009a6bd6d81b9811855d6629b9fe90e1b">
<file src="src/Aggregate/AggregateRootBehaviour.php">
<UnsafeInstantiation>
<code>new static()</code>
Expand All @@ -15,6 +15,11 @@
<code>class DoctrineHelper</code>
</ClassNotFinal>
</file>
<file src="src/EventBus/AttributeListenerProvider.php">
<MixedMethodCall>
<code><![CDATA[$method->getName()]]></code>
</MixedMethodCall>
</file>
<file src="src/EventBus/Message.php">
<InvalidReturnStatement>
<code>$headers</code>
Expand Down
18 changes: 14 additions & 4 deletions src/EventBus/ListenerDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Closure;
use ReflectionFunction;

use function method_exists;

final class ListenerDescriptor
{
private readonly Closure $callable;
Expand All @@ -20,15 +22,23 @@ public function __construct(callable $callable)

$r = new ReflectionFunction($callable);

if ($r->isAnonymous()) {
if (method_exists($r, 'isAnonymous') && $r->isAnonymous()) {
$this->name = 'Closure';
} elseif (!$callable = $r->getClosureThis()) {

return;
}

$callable = $r->getClosureThis();

if (!$callable) {
$class = $r->getClosureCalledClass();

$this->name = ($class ? $class->name . '::' : '') . $r->name;
} else {
$this->name = $callable::class . '::' . $r->name;

return;
}

$this->name = $callable::class . '::' . $r->name;
}

public function name(): string
Expand Down

0 comments on commit dc69d84

Please sign in to comment.