Repository navigation
Conversation
Only class and trait declarations were recognized, so an enum was never selected for mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Description:
mutates()and--classnever select an enum, so its methods are never mutated. For example, withmutates(Urgency::class)andpest --mutatecreates no mutation forisHigh().MutationGenerator::doesNotContainClassToMutate()recognizes a declaration by the regular expression(?:class|trait)\s+$class, so a file declaring an enum is always treated as not containing it.The fix. Both regular expressions also accept
enum. Nothing else changes in the way the classes are matched.This changes the same line as #22, which adds a word boundary after the class name. The two changes do not contradict each other, so whichever is merged first, I will rebase this one on top of it. With #22, the namespace prefix case of the new test gives no mutation, exactly as #22 changes it for the class and trait tests.
This is part of the series described in pestphp/pest#1978 (point 2), but it is useful on its own and does not depend on #48 or #49.
Tests.
it generates mutations for the given file if it contains the given enumintests/Unit/MutationGeneratorTest.phpuses the new fixturetests/Fixtures/Enums/Urgency.php, with the same cases as the existing class and trait tests: the enum by its full name, by its short name and by a namespace prefix gives one mutation; another class or another namespace gives none. Without the fix, the three positive cases fail.CI. The workflows ran on a fork with the full matrix and
fail-fast: false.COMPOSER_ROOT_VERSION=5.x-devwas set there only because Composer cannot guess the root version of a feature branch. The results were compared, job by job, with the same workflows on unmodified5.x(d0c8711):5.x: Tests, Static AnalysisThis branch passes the 5 new tests in every job (
prefer-lowest: 324 passed, against 319 on5.x). Apart from them, the set of failures is identical in every job:Tests\Visual\*snapshots fail in theprefer-stablejobs, because current PHPUnit prints a deprecation warning for thecacheResultattribute ofphpunit.xml;🤖 Generated with Claude Code