pest icon indicating copy to clipboard operation
pest copied to clipboard

[Bug]: Could not bind closure.

Open Hackbard opened this issue 1 year ago • 1 comments

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

Hackbard avatar May 22 '24 08:05 Hackbard

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

owenvoke avatar May 22 '24 09:05 owenvoke