Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support PHPUnit v9.1 naming for some asserts #7997

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

krzysztof-ciszewski
Copy link

@krzysztof-ciszewski krzysztof-ciszewski commented May 8, 2024

Fixes #7968

I assumed $fixMap is static for performance so I tried my best to keep it like that.
Could not keep fixmap static, I don't know if it has impact on performace, not sure how to use benchmark

@krzysztof-ciszewski krzysztof-ciszewski changed the title php-cs-fixer#7968 use new naming for some asserts fixx: use new naming for some asserts May 8, 2024
@krzysztof-ciszewski krzysztof-ciszewski changed the title fixx: use new naming for some asserts fix: use new naming for some asserts May 8, 2024
@krzysztof-ciszewski
Copy link
Author

I don't know how to mark it as draft so I closed it, will reopen when done

@Wirone Wirone reopened this May 8, 2024
@Wirone Wirone marked this pull request as draft May 8, 2024 19:30
@Wirone
Copy link
Member

Wirone commented May 8, 2024

@krzysztof-ciszewski I've converted it to a draft, so feel free to push changes and verify with the full CI 🙂.

@coveralls
Copy link

coveralls commented May 9, 2024

Coverage Status

coverage: 96.119% (+0.001%) from 96.118%
when pulling c5a6d59 on krzysztof-ciszewski:fix-assert-for-phpunit-9-1
into 3117b95 on PHP-CS-Fixer:master.

Copy link
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That union with simple array (without shape) causes PHPStan errors.

src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php Outdated Show resolved Hide resolved
src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php Outdated Show resolved Hide resolved
@krzysztof-ciszewski
Copy link
Author

@Wirone can you remove the draft now? The pipeline is green 🍾

@Wirone Wirone marked this pull request as ready for review May 9, 2024 15:33
@Wirone
Copy link
Member

Wirone commented May 9, 2024

@krzysztof-ciszewski no problem 🙂. FYI, for future contributions:

image

image

There is also possibility to create PR as draft (dedicated button on PR form).

@Wirone Wirone changed the title fix: use new naming for some asserts feat: support PHPUnit v9.1 naming for some asserts May 9, 2024
Comment on lines +727 to +735
if ('assertnotisreadable' === $assertCall['loweredName']) {
$replacement = 'assertIsNotReadable';
} elseif ('assertnotiswritable' === $assertCall['loweredName']) {
$replacement = 'assertIsNotWritable';
} elseif ('assertdirectorynotexists' === $assertCall['loweredName']) {
$replacement = 'assertDirectoryDoesNotExist';
} elseif ('assertfilenotexists' === $assertCall['loweredName']) {
$replacement = 'assertFileDoesNotExist';
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange that mess-detector prefers this over switch statement, not everything can be refactored to polymorphism, especially string comparison.

@krzysztof-ciszewski
Copy link
Author

bump

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.

PhpUnitDedicateAssertFixer is replacing functions with deprecated/removed method names of PHPUnit v9.1+
4 participants