Skip to content

Conversation

rvanvelzen
Copy link
Contributor

Rule extracted from #1905 because it's useful without explicit stringable-object support as well

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

I feel like we don't need a new rule here.

We need ObjectWithoutClassType::toString() to return ErrorType.

ObjectType already does this correctly.

Also, MixedType::toString() should be looked into for subtracted types.

@rvanvelzen rvanvelzen force-pushed the object-maybe-tostring-cast branch from 728a2e1 to c7ae23c Compare November 2, 2022 08:58
@rvanvelzen rvanvelzen force-pushed the object-maybe-tostring-cast branch from c7ae23c to 789a6c5 Compare November 2, 2022 09:07
@ondrejmirtes
Copy link
Member

Nice! I also love this error:


 ------ ---------------------------------------------------------------- 
  Line   lib/Doctrine/ORM/Query/Expr/Base.php                            
 ------ ---------------------------------------------------------------- 
  104    Parameter #2 $array of function implode expects array<string>,  
         array<int, object|string> given.                                
 ------ ---------------------------------------------------------------- 

@ondrejmirtes ondrejmirtes merged commit 81f99da into phpstan:1.9.x Nov 3, 2022
@ondrejmirtes
Copy link
Member

Thank you!

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.

2 participants