scones /
nexus
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | require __DIR__ . '/../vendor/autoload.php'; |
||||
| 6 | |||||
| 7 | use Nexus\StandardListenerProvider; |
||||
| 8 | use Nexus\SynchronousNotifier; |
||||
| 9 | use Psr\EventDispatcher\MessageInterface; |
||||
| 10 | |||||
| 11 | class SomeMessage implements MessageInterface |
||||
| 12 | { |
||||
| 13 | } |
||||
| 14 | |||||
| 15 | class SomeOtherMessage implements MessageInterface |
||||
| 16 | { |
||||
| 17 | } |
||||
| 18 | |||||
| 19 | $provider = new StandardListenerProvider(); |
||||
| 20 | $notifier = new SynchronousNotifier($provider); |
||||
| 21 | |||||
| 22 | $provider->addListener(function (SomeMessage $someMessage) { |
||||
|
0 ignored issues
–
show
|
|||||
| 23 | echo "some cool message reaction code goes here\n"; |
||||
| 24 | }); |
||||
| 25 | $provider->addListener(function (SomeMessage $someMessage) { |
||||
|
0 ignored issues
–
show
The parameter
$someMessage is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 26 | echo "this message seems worth logging!\n"; |
||||
| 27 | }); |
||||
| 28 | $provider->addListener(function (SomeOtherMessage $someOtherMessage) { |
||||
|
0 ignored issues
–
show
The parameter
$someOtherMessage is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 29 | echo "oh, the other message was dispatched!\n"; |
||||
| 30 | }); |
||||
| 31 | |||||
| 32 | $testMessage = new SomeMessage(); |
||||
| 33 | $notifier->notify($testMessage); |
||||
| 34 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.