Skip to content

Commit

Permalink
Remove redundant is_array check
Browse files Browse the repository at this point in the history
It's always array because of `if (empty($view['name']))` check

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
  • Loading branch information
kamil-tekiela committed Dec 14, 2022
1 parent 47d9ad9 commit 99f37f4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
5 changes: 1 addition & 4 deletions libraries/classes/Controllers/View/CreateController.php
Expand Up @@ -24,7 +24,6 @@
use function explode;
use function htmlspecialchars;
use function in_array;
use function is_array;
use function is_string;
use function sprintf;
use function str_contains;
Expand Down Expand Up @@ -281,9 +280,7 @@ public function __invoke(ServerRequest $request): void
}
}

if (is_array($view)) {
$GLOBALS['view'] = array_merge($GLOBALS['view'], $view);
}
$GLOBALS['view'] = array_merge($GLOBALS['view'], $view);

$GLOBALS['urlParams']['db'] = $GLOBALS['db'];
$GLOBALS['urlParams']['reload'] = 1;
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Expand Up @@ -2130,11 +2130,6 @@ parameters:
count: 1
path: libraries/classes/Controllers/UserPasswordController.php

-
message: "#^Call to function is_array\\(\\) with array will always evaluate to true\\.$#"
count: 1
path: libraries/classes/Controllers/View/CreateController.php

-
message: "#^PHPDoc tag @var for variable \\$view has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
3 changes: 1 addition & 2 deletions psalm-baseline.xml
Expand Up @@ -4196,9 +4196,8 @@
<code>$_GET['table']</code>
<code>$_GET['table']</code>
</PossiblyInvalidCast>
<RedundantCondition occurrences="3">
<RedundantCondition occurrences="2">
<code>empty($GLOBALS['view']['as']) &amp;&amp; is_string($createView)</code>
<code>is_array($view)</code>
<code>is_string($createView)</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="1">
Expand Down

0 comments on commit 99f37f4

Please sign in to comment.