mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 09:47:29 +01:00
boolean cast
This commit is contained in:
parent
ddf74919f6
commit
53e4719c19
@ -170,7 +170,7 @@ class ReturnTypeAnalyzer
|
|||||||
|
|
||||||
$function_always_exits = $control_actions === [ScopeAnalyzer::ACTION_END];
|
$function_always_exits = $control_actions === [ScopeAnalyzer::ACTION_END];
|
||||||
|
|
||||||
$function_returns_implicitly = !!array_diff(
|
$function_returns_implicitly = (bool)array_diff(
|
||||||
$control_actions,
|
$control_actions,
|
||||||
[ScopeAnalyzer::ACTION_END, ScopeAnalyzer::ACTION_RETURN]
|
[ScopeAnalyzer::ACTION_END, ScopeAnalyzer::ACTION_RETURN]
|
||||||
);
|
);
|
||||||
|
@ -660,7 +660,7 @@ class ProjectAnalyzer
|
|||||||
$this->codebase->classlikes->consolidateAnalyzedData(
|
$this->codebase->classlikes->consolidateAnalyzedData(
|
||||||
$this->codebase->methods,
|
$this->codebase->methods,
|
||||||
$this->progress,
|
$this->progress,
|
||||||
!!$this->codebase->find_unused_code
|
(bool)$this->codebase->find_unused_code
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class ElseIfAnalyzer
|
|||||||
if (array_filter(
|
if (array_filter(
|
||||||
$entry_clauses,
|
$entry_clauses,
|
||||||
function ($clause): bool {
|
function ($clause): bool {
|
||||||
return !!$clause->possibilities;
|
return (bool)$clause->possibilities;
|
||||||
}
|
}
|
||||||
)) {
|
)) {
|
||||||
$omit_keys = array_reduce(
|
$omit_keys = array_reduce(
|
||||||
|
@ -234,7 +234,7 @@ class IfElseAnalyzer
|
|||||||
if (array_filter(
|
if (array_filter(
|
||||||
$context->clauses,
|
$context->clauses,
|
||||||
function ($clause): bool {
|
function ($clause): bool {
|
||||||
return !!$clause->possibilities;
|
return (bool)$clause->possibilities;
|
||||||
}
|
}
|
||||||
)) {
|
)) {
|
||||||
$omit_keys = array_reduce(
|
$omit_keys = array_reduce(
|
||||||
|
@ -1027,7 +1027,7 @@ class CallAnalyzer
|
|||||||
$bounds_with_equality = array_filter(
|
$bounds_with_equality = array_filter(
|
||||||
$lower_bounds,
|
$lower_bounds,
|
||||||
function ($lower_bound) {
|
function ($lower_bound) {
|
||||||
return !!$lower_bound->equality_bound_classlike;
|
return (bool)$lower_bound->equality_bound_classlike;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ class FunctionLikeNodeScanner
|
|||||||
}
|
}
|
||||||
|
|
||||||
$existing_params['$' . $param_storage->name] = $i;
|
$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) {
|
if (!$param_storage->is_optional && !$param_storage->is_variadic) {
|
||||||
$required_param_count = $i + 1;
|
$required_param_count = $i + 1;
|
||||||
|
@ -381,7 +381,7 @@ class UnionTypeComparator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!$matching_input_keys;
|
return (bool)$matching_input_keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -637,7 +637,7 @@ class Union implements TypeNode
|
|||||||
|
|
||||||
public function hasArrayAccessInterface(Codebase $codebase) : bool
|
public function hasArrayAccessInterface(Codebase $codebase) : bool
|
||||||
{
|
{
|
||||||
return !!array_filter(
|
return (bool)array_filter(
|
||||||
$this->types,
|
$this->types,
|
||||||
function ($type) use ($codebase) {
|
function ($type) use ($codebase) {
|
||||||
return $type->hasArrayAccessInterface($codebase);
|
return $type->hasArrayAccessInterface($codebase);
|
||||||
|
Loading…
Reference in New Issue
Block a user