You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$callback type is currently QueuedClosure|\Closure|string|array, which includes a lot, but not invokable classes. I changed it to QueuedClosure|class-string|array|callable which does include invokable classes (callable), and is more specific about the string (class-string). I'm not sure though. Let's run some tests.
The changes to the listen method on the Dispatcher class is making PHPStan complain, are you certain about this change @rudiedirkx? The second parameter should/could allow for a string (not limited to class-string), since it's possible to invoke a method on a class using a string. Example from a subscriber class that I have:
public function deleting(ProductDeletingEvent $event): void
{
...code
}
public function subscribe(Dispatcher $dispatcher): void
{
$dispatcher->listen(
ProductDeletingEvent::class,
self::class.'@deleting',
);
}
instead of the @, but you are right, string should still be a valid $callback, because Laravel accepts the @ syntax. I never use that, so my stan didn't complain, and I do use invokable classes, so my stan got better.
@taylorotwell This should be improved or reverted. class-string and string are both valid $callback, not just class-string.
@einar-hansen Or a new PR that improves this one? :)
I ended up updated my code to match the example in the Laravel docs, so I'm fine. I'll send in PR when things calm down around Christmas time. Thanks for a good PR 😄
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
$callbacktype is currentlyQueuedClosure|\Closure|string|array, which includes a lot, but not invokable classes. I changed it toQueuedClosure|class-string|array|callablewhich does include invokable classes (callable), and is more specific about the string (class-string). I'm not sure though. Let's run some tests.