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

Improvements to the AssertStatusToAssertMethodRector #255

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

peterfox
Copy link
Collaborator

@peterfox peterfox commented Sep 25, 2024

Changes

  • Uses PHPStan to a better effect instead of looking at what constants might be used
  • Corrects a previously incorrect test
  • Adds stubs for Laravel and Symfony responses
  • Simplify the docs a little for the rule

Why

I wrote this rule over a year or so ago now and learnt a lot since then. This should now allow for any integer value PHPStan can detect. For example:

-$this->get('/')->assertStatus(400 + 4);
+$this->get('/')->assertNotFound();

Before this the rule would only detect specific constants or the scalar integer using only what the PHP Parser had found.

@peterfox peterfox added the enhancement New feature or request label Sep 25, 2024
@peterfox peterfox self-assigned this Sep 25, 2024
@GeniJaho GeniJaho merged commit 62598cb into main Oct 1, 2024
5 checks passed
@GeniJaho GeniJaho deleted the fix/improve-assert-status-rule branch October 1, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants