Skip to content

PathViolationException ​

Rasuvaeff\PropertyTesting\PathViolationException

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

Extends: RuntimeException

Implements: Throwable, Stringable, PropertyTestingException

Reported when a run pinned to a shrink path cannot follow it: the candidate a step names is gone, no longer differs from the value it would replace, or no longer falsifies the property.

A path indexes into each node's shrink candidates, so any edit to a generator — even reordering the candidates of one — orphans it. That is the expected end of a path's life, and it is reported rather than absorbed: had the runner fallen back to a fresh search, the answer would look exactly like a successful replay while reproducing a different descent.

The property still failed when this is raised; what failed is the reproduction, not the property. For a regression that has to survive a refactor, record it in the corpus instead.

Constructor ​

php
__construct(
    string $path,
    int $step,
    string $segment,
    string $reason,
)
ParameterTypeDefaultDescription
$pathstringrequiredThe path the run was pinned to.
$stepintrequiredOne-based position of the segment that could not be followed.
$segmentstringrequiredThe segment itself, in its name:index form.
$reasonstringrequiredWhy it could not be followed, as a noun phrase.

Methods ​

getPath() ​

php
getPath(): string

The path the run was pinned to, as it was configured.

getStep() ​

php
getStep(): int

One-based position of the segment that could not be followed.

getSegment() ​

php
getSegment(): string

The segment that could not be followed, in its name:index form.