1
0
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:
Matthew Brown 2016-12-30 20:39:12 -05:00
parent e972f4106c
commit a524ca8184
6 changed files with 11 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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