Skip to content

fix: pass null to ReflectionProperty::setValue() for static Assert::$count - #244

Open
Kimtran-art wants to merge 1 commit into
pestphp:4.xfrom
Kimtran-art:fix/reflectionproperty-setvalue-static-null
Open

fix: pass null to ReflectionProperty::setValue() for static Assert::$count#244
Kimtran-art wants to merge 1 commit into
pestphp:4.xfrom
Kimtran-art:fix/reflectionproperty-setvalue-static-null

Conversation

@Kimtran-art

Copy link
Copy Markdown

Running browser tests on PHP 8.3+ emits, on essentially every assertion retry:

Calling ReflectionProperty::setValue() with a 1st argument which is not null or an object is deprecated

It comes from Execution::resetAssertions(). Assert::$count is a static property, so under PHP 8.3 the first argument to setValue() must be null (or an object); passing the class-string Assert::class triggers the deprecation. On Firefox nearly every test retries once, so runs get flooded with the notice (tests still pass, but every test is labelled deprecated).

Fix: pass null, the canonical form for a static property - no behaviour change. The @phpstan-ignore-next-line is dropped since the call is now valid.

The same line exists on 5.x and is affected identically, if you'd like it forward-ported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant