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

chore: [PHPStan] enable booleansInConditions #7943

Merged
merged 2 commits into from
Sep 18, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Sep 15, 2023

Description
Implicit type conversion is prone to bugs.

  • add the rule
  • update the baseline

Ref #7916

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • [] Conforms to style guide

vendor/bin/phpstan analyze --generate-baseline phpstan-baseline.php
@kenjis kenjis force-pushed the phpstan-booleansInConditions branch from d04e069 to 09062ec Compare September 15, 2023 06:27
@kenjis kenjis merged commit 00ba7fb into codeigniter4:develop Sep 18, 2023
15 checks passed
@kenjis kenjis deleted the phpstan-booleansInConditions branch September 18, 2023 07:39
'path' => __DIR__ . '/system/Autoloader/FileLocator.php',
];
$ignoreErrors[] = [
'message' => '#^Only booleans are allowed in an if condition, string given\\.$#',
Copy link
Member

Choose a reason for hiding this comment

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

Rector should can handle it:

https://getrector.com/demo/f64fdd76-8ad2-4af6-b57d-d8aa1ef366e8

with BooleanInIfConditionRuleFixerRector

Copy link
Member

Choose a reason for hiding this comment

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

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.

3 participants