Skip to content

Commit

Permalink
fix: from count to check if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
alchatti committed Mar 25, 2024
1 parent 27f81f3 commit 5efe1a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Command/Auth/AuthLoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$keys = $this->datastoreCloud->get('keys');
$activeKey = $this->datastoreCloud->get('acli_key');
// @todo this validation should really be enforced as a schema on the datastore.
if (count($keys) != 0 && !array_key_exists($activeKey, $keys)) {
if ( is_array($keys) && !empty($keys) != 0 && !array_key_exists($activeKey, $keys)) {

Check warning on line 30 in src/Command/Auth/AuthLoginCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $keys = $this->datastoreCloud->get('keys'); $activeKey = $this->datastoreCloud->get('acli_key'); // @todo this validation should really be enforced as a schema on the datastore. - if (is_array($keys) && !empty($keys) != 0 && !array_key_exists($activeKey, $keys)) { + if ((is_array($keys) || !empty($keys) != 0) && !array_key_exists($activeKey, $keys)) { throw new AcquiaCliException('Invalid key in Cloud datastore; run acli auth:logout && acli auth:login to fix'); } if ($activeKey) {
throw new AcquiaCliException('Invalid key in Cloud datastore; run acli auth:logout && acli auth:login to fix');
}
if ($activeKey) {
Expand Down

0 comments on commit 5efe1a8

Please sign in to comment.