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

Add JsonCallToExplicitJsonCallRector #158

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

Stoffo
Copy link
Contributor

@Stoffo Stoffo commented Dec 27, 2023

Adds the following rule:

JsonCallToExplicitJsonCallRector

Changes Method Calls of $this->json() in PHPUnit Feature Tests to the more explicit version $this->postJson(), $this->putJson(), etc..

-$this->json("POST", "/api/v1/users", $data);
+$this->postJson("/api/v1/users", $data);

-$this->json("PUT", "/api/v1/users", $data);
+$this->putJson("/api/v1/users", $data);

@Stoffo Stoffo force-pushed the add-json-call-rector branch 2 times, most recently from 5034ac2 to 0e02f83 Compare December 28, 2023 12:01
@Stoffo
Copy link
Contributor Author

Stoffo commented Jan 3, 2024

@driftingly had to fix some Code Style Issues, now the tests should be green

@driftingly
Copy link
Owner

Hi @Stoffo!
Thanks for your work on this! I recently switched the code style to be more in line with Laravel style. Can you pull down the latest changes to this branch and run composer fix and composer rector to fix the last issues here? You may also need to fix a PHPStan error that I saw pop up.

@driftingly
Copy link
Owner

This will fix the PHPStan issues:

    public function refactor(Node $node): ?Node
    {
        if ($node instanceof MethodCall) {
            return $this->updateCall($node);
        }

        return null;
    }

@Stoffo
Copy link
Contributor Author

Stoffo commented Jan 3, 2024

@driftingly Thanks for tips! I rebased the branch and ran the tools again 👍🏻

@driftingly
Copy link
Owner

Thanks! I'll merge in as-is and clean up in main

@driftingly driftingly merged commit 6c9a160 into driftingly:main Jan 3, 2024
3 of 5 checks passed
@Stoffo Stoffo deleted the add-json-call-rector branch January 3, 2024 23:38
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.

2 participants