mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Suppress more notices
This commit is contained in:
parent
e972f4106c
commit
a524ca8184
@ -494,7 +494,7 @@ class FunctionChecker extends FunctionLikeChecker
|
||||
}
|
||||
} elseif ($first_arg->inferredType->hasScalarType() &&
|
||||
($second_arg = $call_args[1]->value) &&
|
||||
$second_arg->inferredType &&
|
||||
isset($second_arg->inferredType) &&
|
||||
$second_arg->inferredType->hasScalarType()
|
||||
) {
|
||||
return Type::combineUnionTypes($first_arg->inferredType, $second_arg->inferredType);
|
||||
|
@ -504,7 +504,9 @@ class MethodChecker extends FunctionLikeChecker
|
||||
|
||||
$old_method_id = null;
|
||||
|
||||
ClassLikeChecker::registerClass($method_parts[0]);
|
||||
if (ClassLikeChecker::registerClass($method_parts[0]) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$class_storage = ClassLikeChecker::$storage[$method_parts[0]];
|
||||
|
||||
|
@ -422,7 +422,7 @@ class AssignmentChecker
|
||||
continue;
|
||||
}
|
||||
|
||||
if (MethodChecker::methodExists($lhs_type_part . '::__set')) {
|
||||
if (!$lhs_type_part->isObject() && MethodChecker::methodExists($lhs_type_part . '::__set')) {
|
||||
$context->vars_in_scope[$var_id] = Type::getMixed();
|
||||
continue;
|
||||
}
|
||||
|
@ -123,7 +123,10 @@ class TraitChecker extends ClassLikeChecker
|
||||
return self::$existing_traits[strtolower($trait_name)];
|
||||
}
|
||||
|
||||
$old_level = error_reporting();
|
||||
error_reporting(0);
|
||||
$trait_exists = trait_exists($trait_name);
|
||||
error_reporting($old_level);
|
||||
|
||||
self::$existing_traits[strtolower($trait_name)] = $trait_exists;
|
||||
|
||||
|
@ -757,7 +757,7 @@ class TypeChecker
|
||||
$type_match_found = true;
|
||||
}
|
||||
|
||||
if ($container_type_part->isString() && $input_type_part->isObjectType()) {
|
||||
if ($container_type_part->isString() && $input_type_part->isObjectType() && !$input_type_part->isObject()) {
|
||||
// check whether the object has a __toString method
|
||||
if (MethodChecker::methodExists($input_type_part->value . '::__toString')) {
|
||||
$type_match_found = true;
|
||||
|
@ -58,7 +58,7 @@ class Atomic extends Type
|
||||
if (isset($aliased_classes[strtolower($this->value)])) {
|
||||
return $aliased_classes[strtolower($this->value)];
|
||||
}
|
||||
|
||||
|
||||
return '\\' . $this->value;
|
||||
}
|
||||
|
||||
@ -182,6 +182,7 @@ class Atomic extends Type
|
||||
&& !$this->isEmpty()
|
||||
&& !$this->isResource()
|
||||
&& !$this->isIterable()
|
||||
&& !$this->isScalar()
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user