Skip to content

[FuncCall] Don't add $result to parse_str if second parameter is already set#1709

Merged
TomasVotruba merged 1 commit intorectorphp:masterfrom
ravanscafi:valid-parse-str
Jul 9, 2019
Merged

[FuncCall] Don't add $result to parse_str if second parameter is already set#1709
TomasVotruba merged 1 commit intorectorphp:masterfrom
ravanscafi:valid-parse-str

Conversation

@ravanscafi
Copy link
Copy Markdown
Contributor

@ravanscafi ravanscafi commented Jul 8, 2019

Before this fix, parse_str($query, $data); would turn into parse_str($query, $result); by no reason, breaking valid code.

@ravanscafi ravanscafi changed the title Don't add $result to parse_str if second parameter is already set [FuncCall] Don't add $result to parse_str if second parameter is already set Jul 8, 2019
}
}

?>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the code should have no change, you can keep only the first part (above ----):

<?php

namespace Rector\Php\Tests\Rector\FuncCall\ParseStrWithResultArgumentRector\Fixture;

class AlreadySet
{
    public function run()
    {
        $query = 'bla';
        parse_str($query, $data);
    }
}
?>
------
-<?php
-
-namespace Rector\Php\Tests\Rector\FuncCall\ParseStrWithResultArgumentRector\Fixture;
-
-class AlreadySet
-{
-    public function run()
-    {
-        $query = 'bla';
-        parse_str($query, $data);
-    }
-}
-?>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, the standard here is to prefix these test cases with skip_.
That way we can group them visually by fix and skip groups

Here skip_already_set.php.inc.

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Jul 9, 2019

On second though, these details are not related to the feature and can be cleared later in chunk, so thanks for the PR! Merging ✔️

@TomasVotruba TomasVotruba merged commit 2fabe47 into rectorphp:master Jul 9, 2019
@ravanscafi ravanscafi deleted the valid-parse-str branch July 9, 2019 14:11
TomasVotruba added a commit that referenced this pull request Jan 21, 2022
rectorphp/rector-src@f0928ab [cleanup] remove historical and unsupported safe 0.7 (#1709)
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