Skip to content

Commit

Permalink
bugfix #16329 [PHPStan] Negated Boolean Expression Is Always True I…
Browse files Browse the repository at this point in the history
…ssue Fix (Rafikooo)

This PR was merged into the 1.12 branch.

Discussion
----------

| Q               | A
|-----------------|-----
| Branch?         | 1.12 <!-- see the comment below -->
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no <!-- don't forget to update the UPGRADE-*.md file -->
| License         | MIT

There was a PHPStan update that apparently introduced a new check:
<img width="717" alt="image" src="https://github.com/Sylius/Sylius/assets/40125720/8c63b34e-a931-4f13-a949-b78514d65462">


Commits
-------
  [PHPStan] Fix negated boolean expression is always true issue
  • Loading branch information
Wojdylak committed May 31, 2024
2 parents 33982d6 + cf6f7e2 commit c7fe722
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Sylius/Bundle/UserBundle/Command/AbstractRoleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
}
}

if (!$input->getArgument('email')) {
$email = $input->getArgument('email');

if ($email === null) {
$question = new Question('Please enter an email:');
$question->setValidator(function (?string $email) {
if (!filter_var($email, \FILTER_VALIDATE_EMAIL)) {
Expand All @@ -61,7 +63,9 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
$input->setArgument('email', $email);
}

if (!$input->getArgument('roles')) {
$roles = $input->getArgument('roles');

if ($roles === null) {
$question = new Question('Please enter user\'s roles (separated by space):');
$question->setValidator(function (?string $roles) {
if ('' === $roles) {
Expand Down

0 comments on commit c7fe722

Please sign in to comment.