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

testWithRouteAttribute test case #1479

Closed
wants to merge 5 commits into from
Closed

testWithRouteAttribute test case #1479

wants to merge 5 commits into from

Conversation

PhilETaylor
Copy link
Contributor

My first attempt here at Rector - go easy on me :)

rectorphp/rector#6861 (comment)

Bug Report

Subject Details
Rector version 77f2def
PHP version 8.1.0

Trying to do a simple rename of a deprecated class with

    $services->set(RenameClassRector::class)
        ->configure([
            // /~https://github.com/doctrine/dbal/blob/master/UPGRADE.md#deprecated-dbalexception
            'Doctrine\DBAL\DBALException' => 'Doctrine\DBAL\Exception'
        ]);

Minimal PHP Code Causing Issue

The result is that you end up with a duplicated docblock

https://getrector.org/demo/1ec5b954-5e90-66f0-8d07-efa05ffbaaf2

Expected Behaviour

Rector is working correct and renaming the @throws tag in the docblock when there is no Attribute (in my case a Symfony Route Attribute, the second method in the demo class) - but DOESNT work correctly if there is an attribute following the docblock (the first method in the test case)

The result is that you end up with a duplicated docblock

@samsonasik
Copy link
Member

@PhilETaylor I cherry-picked your commit at PR #1481

TomasVotruba pushed a commit that referenced this pull request Dec 14, 2021
…1481)

* testWithRouteAttribute test case

* revert

* Add unit test

* fix namespace/imports

* Add namespace

* move fixture and config

* debug

* Closes #1479 Fixes rectorphp/rector#6861

Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
@PhilETaylor
Copy link
Contributor Author

Many thanks for the quick turnaround! Pleased I could contribute back in the smallest way.

@PhilETaylor PhilETaylor deleted the rename_before_attribute branch December 14, 2021 09:34
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