1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 01:09:38 +01:00

boolean cast

This commit is contained in:
orklah 2021-09-26 22:39:01 +02:00
parent ddf74919f6
commit 53e4719c19
8 changed files with 8 additions and 8 deletions

View File

@ -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]
);

View File

@ -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
);
}

View File

@ -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(

View File

@ -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(

View File

@ -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;
}
);

View File

@ -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;

View File

@ -381,7 +381,7 @@ class UnionTypeComparator
}
}
return !!$matching_input_keys;
return (bool)$matching_input_keys;
}
/**

View File

@ -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);