pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.06k stars 313 forks source link

[Bug]: Could not bind closure. #1159

Open Hackbard opened 1 month ago

Hackbard commented 1 month ago

What Happened

FAILED Tests\Unit\Factories\MenuFactoryTest > it creates a MenuData object from array ShouldNotHappen This should not happen - please create an new issue here: https://github.com/pestphp/pest.

Issue: Could not bind closure. PHP version: 8.2.16 Operating system: Darwin str_replace(): Argument #3 ($subject) must be of type array|string, null given

at vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php:43 39▕ @return FrameCollection 40▕ / 41▕ public function filter($callable) 42▕ { ➜ 43▕ $this->frames = array_values(array_filter($this->frames, $callable)); 44▕ return $this; 45▕ } 46▕ 47▕ /**

How to Reproduce

Write a static test:

it('creates a MenuData object from array', static function () : void {

Sample Repository

No response

Pest Version

2.34.7.

PHP Version

8.2.16

Operation System

macOS

Notes

No response

owenvoke commented 1 month ago

As far as I know, Pest doesn't support static closures for tests. Should be able to just remove the static keyword.