Static callable #9302
-
Is there a syntax for a non-capturing closure? eg. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
No, and I'm not sure what you'd like to achieve with it. |
Beta Was this translation helpful? Give feedback.
-
Had this question myself. Currently working with Pest testing framework and it would be useful to tell static tools like Rector to avoid converting \Closures to static for the tests e.g. test('it works, static function () {
}); Breaks the testing command because under the hood the test function causes the \Closure to be bound to an object which isn't possible as it's a static method. Something like: /**
* @param \Closure<TestCase> $closure
*/ To signify what the closure will be bound to would be useful. Equally in Laravel world we have things like this come up with PHPStan and macros as well. |
Beta Was this translation helpful? Give feedback.
No, and I'm not sure what you'd like to achieve with it.