Skip to content

Commit

Permalink
Add test case to illustrate how to properly match against "any object"
Browse files Browse the repository at this point in the history
  • Loading branch information
ralflang committed Nov 6, 2023
1 parent 9629f80 commit 9a7cd07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/InvokableAnyObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);

namespace Fig\EventDispatcher;

class InvokableAnyObject
{
public function __invoke(object $event)
{
// do nothing
}
}
8 changes: 8 additions & 0 deletions tests/ParameterDeriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,12 @@ public function test_derive_invokable() : void

$this->assertEquals(Foo::class, $type);
}

public function test_derive_any_invokable() : void
{
$type = $this->deriver->getParameterType(new InvokableAnyObject());

$this->assertEquals('object', $type);

}
}

0 comments on commit 9a7cd07

Please sign in to comment.