Skip to content

PropertyId ​

Rasuvaeff\PropertyTesting\PropertyId

Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2

What a property's id has to be good for, and how to tell when it is not.

The id keys two things that outlive a single run: the events a listener aggregates, and the regression corpus entry that replays yesterday's counterexample. Both need it to name the same property tomorrow. An adapter that derives the id from a backtrace gets that for a test method and loses it for a closure, because PHP has never had a stable name for one:

text
PHP 8.3   Suite::{closure}
PHP 8.4+  Suite::{closure:/app/tests/StackTest.php:19}

Neither is usable. On 8.3 every closure of a class collapses onto one id, so two properties in one file overwrite each other's recorded counterexample; from 8.4 the id carries a file and a line, so inserting a line above the property orphans the entry it recorded yesterday. The corpus keeps working in the sense that nothing throws — it simply stops replaying the failure it was built to replay, which is the failure mode a corpus exists to prevent.

So this is a diagnosis, not a fix: the engine returns the sentence, and the adapter prints it through whatever channel it already warns on. The engine itself never prints — see the README's account of what it does not do.

Methods ​

unstableWarning() ​

php
static unstableWarning(string $id): ?string

The warning an adapter should show for $id, or null when the id is stable and there is nothing to say.

  • $id — The property id as the adapter derived it.