From 53e4719c1903a0c612d637567931ef6fab29ea35 Mon Sep 17 00:00:00 2001 From: orklah Date: Sun, 26 Sep 2021 22:39:01 +0200 Subject: [PATCH] boolean cast --- src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/ProjectAnalyzer.php | 2 +- .../Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php | 2 +- .../Internal/Analyzer/Statements/Expression/CallAnalyzer.php | 2 +- .../Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php | 2 +- src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php | 2 +- src/Psalm/Type/Union.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php index c0d39267a..09be8a4e0 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php @@ -170,7 +170,7 @@ class ReturnTypeAnalyzer $function_always_exits = $control_actions === [ScopeAnalyzer::ACTION_END]; - $function_returns_implicitly = !!array_diff( + $function_returns_implicitly = (bool)array_diff( $control_actions, [ScopeAnalyzer::ACTION_END, ScopeAnalyzer::ACTION_RETURN] ); diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index 1b6277927..75210b6fe 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -660,7 +660,7 @@ class ProjectAnalyzer $this->codebase->classlikes->consolidateAnalyzedData( $this->codebase->methods, $this->progress, - !!$this->codebase->find_unused_code + (bool)$this->codebase->find_unused_code ); } diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php index de9a01690..9ff0bda05 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/ElseIfAnalyzer.php @@ -159,7 +159,7 @@ class ElseIfAnalyzer if (array_filter( $entry_clauses, function ($clause): bool { - return !!$clause->possibilities; + return (bool)$clause->possibilities; } )) { $omit_keys = array_reduce( diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index be834a182..26de808b9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -234,7 +234,7 @@ class IfElseAnalyzer if (array_filter( $context->clauses, function ($clause): bool { - return !!$clause->possibilities; + return (bool)$clause->possibilities; } )) { $omit_keys = array_reduce( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index c0412d8b1..b7331d6fb 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -1027,7 +1027,7 @@ class CallAnalyzer $bounds_with_equality = array_filter( $lower_bounds, function ($lower_bound) { - return !!$lower_bound->equality_bound_classlike; + return (bool)$lower_bound->equality_bound_classlike; } ); diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index d0117bfe0..f4c8c441a 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -218,7 +218,7 @@ class FunctionLikeNodeScanner } $existing_params['$' . $param_storage->name] = $i; - $storage->addParam($param_storage, !!$param->type); + $storage->addParam($param_storage, (bool)$param->type); if (!$param_storage->is_optional && !$param_storage->is_variadic) { $required_param_count = $i + 1; diff --git a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php index 622047b47..12eb39ea7 100644 --- a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php @@ -381,7 +381,7 @@ class UnionTypeComparator } } - return !!$matching_input_keys; + return (bool)$matching_input_keys; } /** diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 00c0ca9e4..50564eaec 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -637,7 +637,7 @@ class Union implements TypeNode public function hasArrayAccessInterface(Codebase $codebase) : bool { - return !!array_filter( + return (bool)array_filter( $this->types, function ($type) use ($codebase) { return $type->hasArrayAccessInterface($codebase);