-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
221867a
commit 9e24911
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace League\Event; | ||
|
||
use LogicException; | ||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
use Psr\EventDispatcher\ListenerProviderInterface; | ||
|
||
class UnableToUnsubscribeListener extends LogicException | ||
{ | ||
public static function becauseTheListenerProviderIsNotARegistry( | ||
ListenerProviderInterface $configuredListenerProvider | ||
): UnableToUnsubscribeListener { | ||
$providerClass = get_class($configuredListenerProvider); | ||
|
||
return new UnableToUnsubscribeListener( | ||
"Unable to remove listener because the configured listener provider {$providerClass} is not an instance of " | ||
. ListenerRegistry::class | ||
); | ||
} | ||
public static function becauseTheEventDispatcherIsNotARegistry( | ||
EventDispatcherInterface $configuredListenerProvider | ||
): UnableToUnsubscribeListener { | ||
$providerClass = get_class($configuredListenerProvider); | ||
|
||
return new UnableToUnsubscribeListener( | ||
"Unable to remove listener because the internal dispatcher {$providerClass} is not an instance of " | ||
. ListenerRegistry::class | ||
); | ||
} | ||
} |