Skip to content

Add FunctionCallToConstantRector#2100

Merged
TomasVotruba merged 4 commits intorectorphp:masterfrom
keulinho:add-function-call-to-constant-rector
Oct 4, 2019
Merged

Add FunctionCallToConstantRector#2100
TomasVotruba merged 4 commits intorectorphp:masterfrom
keulinho:add-function-call-to-constant-rector

Conversation

@keulinho
Copy link
Copy Markdown
Contributor

@keulinho keulinho commented Oct 4, 2019

Fixes: #2008

return null;
}

private function refactorVersionCompare(Node $node): ?Node
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.

Suggested change
private function refactorVersionCompare(Node $node): ?Node
private function refactorVersionCompare(FuncCall $funcCall): ?BinaryOp

Here you can use more precise types

Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba left a comment

Choose a reason for hiding this comment

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

I checked the implementation, very clear to read the code 👍

Just one detail about split to 1 specific + 1 generic rule

Comment on lines +13 to +27
?>
-----
<?php

namespace Rector\CodingStyle\Tests\Rector\FuncCall\FunctionCallToConstantRector\Fixture;

class SkipVersionCompareClass
{
public function run()
{
version_compare($this->version, '5.3.0', '<');
}
}

?>
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.

This section can be removed in "skip" fixture, as when A = B, only A is needed


50300 < PHP_VERSION_ID;
50300 > PHP_VERSION_ID;
50300 === PHP_VERSION_ID;
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.

Great work 👍

@TomasVotruba
Copy link
Copy Markdown
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit d19a83d into rectorphp:master Oct 4, 2019
TomasVotruba added a commit that referenced this pull request Apr 20, 2022
rectorphp/rector-src@de95ab6 [DX] Add sets() to RectorConfig upgrade rule (#2100)
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.

[CodingStyle] version compare to constants

2 participants