Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

Closes #2350
Closes phpstan/phpstan#4890

} elseif ($objectClassNames !== []) {
return new GenericClassStringType($type);
} elseif ($type instanceof ObjectWithoutClassType) {
if ($type instanceof ObjectShapeType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic

if (!$objectType instanceof TemplateType && $objectType instanceof ObjectWithoutClassType) {
					$classStringType = new ClassStringType();
				} else {
					$classStringType = new GenericClassStringType($objectType);
				}

Doesn't work for ObjectShapeType and gaves

class-string<object{foo: bar}>

which is weird.


return new ConstantBooleanType(false);
$isObject = $type->isObject();
if ($isObject->no()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering #2350 (comment)

It can be maybe for at least template type or mixed type

return new ConstantBooleanType(false);
}

if ($type instanceof StaticType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use a if/else as suggested (I think) in #2350 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

false positive due to method_exists call beforehand

1 participant