We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
DisallowedEmptyRuleFixerRector is making dangerous non-equivalent changes. See snippet below.
class Bug { public function get(): ?string { return null; } public function example(): void { if (!empty($this->get())) { } } } // gets converted to class Bug { public function get(): ?string { return null; } public function example(): void { if ($this->get() !== null) { } } }
// should be converted to class Bug { public function get(): ?string { return null; } public function example(): void { if ($this->get() !== null && $this->get() !== '') { } } }
The text was updated successfully, but these errors were encountered:
Other strict rules have similar issue. E.g.
public function example(?string $foo): void { if ($foo) {} // gets converted to $foo !== null }
Sorry, something went wrong.
Issue is better, thanks 👍
Ref https://twitter.com/janedbal/status/1445342334036725762 Makes sense!
Fixed with opt-in empty scalars in rectorphp/rector-src#956
Updated Rector to commit 3569d162bf6cb3730c091db0898798e59c93b4f4
d79d968
rectorphp/rector-src@3569d16 Bump to PHPStan 2.1.3 (#6724)
Successfully merging a pull request may close this issue.
Bug Report
DisallowedEmptyRuleFixerRector is making dangerous non-equivalent changes. See snippet below.
Minimal PHP Code Causing Issue
Expected Behaviour
The text was updated successfully, but these errors were encountered: