mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 01:09:38 +01:00
remove unused nullable on param types
This commit is contained in:
parent
9c6595373e
commit
3e6bf6f35f
@ -741,7 +741,7 @@ class Context
|
||||
return isset($this->phantom_classes[strtolower($class_name)]);
|
||||
}
|
||||
|
||||
public function hasVariable(?string $var_name): bool
|
||||
public function hasVariable(string $var_name): bool
|
||||
{
|
||||
if (!$var_name) {
|
||||
return false;
|
||||
|
@ -34,7 +34,7 @@ class IfConditionalAnalyzer
|
||||
Context $outer_context,
|
||||
Codebase $codebase,
|
||||
IfScope $if_scope,
|
||||
?int $branch_point
|
||||
int $branch_point
|
||||
): IfConditionalScope {
|
||||
$entry_clauses = [];
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ElseIfAnalyzer
|
||||
Context $else_context,
|
||||
Context $outer_context,
|
||||
Codebase $codebase,
|
||||
?int $branch_point
|
||||
int $branch_point
|
||||
): ?bool {
|
||||
$pre_conditional_context = clone $else_context;
|
||||
|
||||
|
@ -908,7 +908,7 @@ class ArgumentsAnalyzer
|
||||
private static function handlePossiblyMatchingByRefParam(
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
Codebase $codebase,
|
||||
?string $method_id,
|
||||
string $method_id,
|
||||
?string $cased_method_id,
|
||||
?FunctionLikeParameter $last_param,
|
||||
array $function_params,
|
||||
|
@ -443,7 +443,6 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
||||
$result,
|
||||
$return_type_candidate,
|
||||
$all_intersection_return_type,
|
||||
$method_name_lc,
|
||||
$codebase
|
||||
);
|
||||
}
|
||||
@ -518,28 +517,19 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
||||
|
||||
private static function updateResultReturnType(
|
||||
AtomicMethodCallAnalysisResult $result,
|
||||
?Type\Union $return_type_candidate,
|
||||
Type\Union $return_type_candidate,
|
||||
?Type\Union $all_intersection_return_type,
|
||||
string $method_name,
|
||||
Codebase $codebase
|
||||
) : void {
|
||||
if ($return_type_candidate) {
|
||||
if ($all_intersection_return_type) {
|
||||
$return_type_candidate = Type::intersectUnionTypes(
|
||||
$all_intersection_return_type,
|
||||
$return_type_candidate,
|
||||
$codebase
|
||||
) ?: Type::getMixed();
|
||||
}
|
||||
|
||||
$result->return_type = Type::combineUnionTypes($return_type_candidate, $result->return_type);
|
||||
} elseif ($all_intersection_return_type) {
|
||||
$result->return_type = Type::combineUnionTypes($all_intersection_return_type, $result->return_type);
|
||||
} elseif ($method_name === '__tostring') {
|
||||
$result->return_type = Type::getString();
|
||||
} else {
|
||||
$result->return_type = Type::getMixed();
|
||||
if ($all_intersection_return_type) {
|
||||
$return_type_candidate = Type::intersectUnionTypes(
|
||||
$all_intersection_return_type,
|
||||
$return_type_candidate,
|
||||
$codebase
|
||||
) ?: Type::getMixed();
|
||||
}
|
||||
|
||||
$result->return_type = Type::combineUnionTypes($return_type_candidate, $result->return_type);
|
||||
}
|
||||
|
||||
private static function handleInvalidClass(
|
||||
|
@ -20,7 +20,7 @@ class MethodCallPurityAnalyzer
|
||||
Codebase $codebase,
|
||||
PhpParser\Node\Expr\MethodCall $stmt,
|
||||
?string $lhs_var_id,
|
||||
?string $cased_method_id,
|
||||
string $cased_method_id,
|
||||
MethodIdentifier $method_id,
|
||||
\Psalm\Storage\MethodStorage $method_storage,
|
||||
\Psalm\Storage\ClassLikeStorage $class_storage,
|
||||
|
@ -439,7 +439,7 @@ class NamedFunctionCallHandler
|
||||
StatementsAnalyzer $statements_analyzer,
|
||||
PhpParser\Node\Expr\FuncCall $stmt,
|
||||
PhpParser\Node\Expr\FuncCall $real_stmt,
|
||||
?string $function_id,
|
||||
string $function_id,
|
||||
Context $context
|
||||
) : void {
|
||||
$first_arg = isset($stmt->args[0]) ? $stmt->args[0] : null;
|
||||
|
@ -100,7 +100,7 @@ class ConstFetchAnalyzer
|
||||
|
||||
public static function getGlobalConstType(
|
||||
Codebase $codebase,
|
||||
?string $fq_const_name,
|
||||
string $fq_const_name,
|
||||
string $const_name
|
||||
): ?Type\Union {
|
||||
if ($const_name === 'STDERR'
|
||||
|
@ -68,7 +68,7 @@ class ClassLikeStorageCacheProvider
|
||||
$this->modified_timestamps .= $this->config->computeHash();
|
||||
}
|
||||
|
||||
public function writeToCache(ClassLikeStorage $storage, ?string $file_path, ?string $file_contents): void
|
||||
public function writeToCache(ClassLikeStorage $storage, string $file_path, string $file_contents): void
|
||||
{
|
||||
$fq_classlike_name_lc = strtolower($storage->name);
|
||||
|
||||
|
@ -53,7 +53,7 @@ class ClassLikeStorageProvider
|
||||
return isset(self::$storage[$fq_classlike_name_lc]);
|
||||
}
|
||||
|
||||
public function exhume(string $fq_classlike_name, ?string $file_path, ?string $file_contents): ClassLikeStorage
|
||||
public function exhume(string $fq_classlike_name, string $file_path, string $file_contents): ClassLikeStorage
|
||||
{
|
||||
$fq_classlike_name_lc = strtolower($fq_classlike_name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user