Skip to content

Strip expected directory prefix with substr - #6

Merged
spawnia merged 1 commit into
masterfrom
strip-expected-prefix-with-substr
Sep 2, 2026
Merged

spawnia merged 1 commit into
masterfrom
strip-expected-prefix-with-substr

Conversation

@spawnia

@spawnia spawnia commented Sep 2, 2026

Copy link
Copy Markdown
Owner

master is red because a recent PHPStan release tightened the signature of explode: https://github.com/spawnia/phpunit-assert-directory/actions/runs/33604583891

src/AssertDirectory.php:55
Parameter #1 $separator of function explode expects non-empty-string, string given.

Splitting the iterated pathname on $expected was an indirect way to cut the prefix off it. $expected is always that prefix — every pathname comes from iterating it — so substr expresses the intent directly and needs no non-empty-string guarantee.

PHPStan reported:

    src/AssertDirectory.php:55
    Parameter #1 $separator of function explode expects non-empty-string, string given.

Splitting on $expected was an indirect way to cut the prefix off the
iterated pathname. Since $expected is always that prefix, substr says
so directly and drops the non-empty-string requirement.
@spawnia
spawnia marked this pull request as ready for review September 2, 2026 13:34
@spawnia
spawnia merged commit 122c30f into master Sep 2, 2026
62 checks passed
@spawnia
spawnia deleted the strip-expected-prefix-with-substr branch September 2, 2026 13:41
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