Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Mar 27, 2022

@ondrejmirtes ondrejmirtes merged commit 0f4b760 into phpstan:1.5.x Mar 27, 2022
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the precise-trace branch March 27, 2022 19:08
@ondrejmirtes
Copy link
Member

FYI this has been wrong for two years and I have no idea why anyone didn't notice this: 492cd89

@staabm
Copy link
Contributor Author

staabm commented Jun 13, 2024

Thanks for noting.

It seems the types were wrong even before this PR as the fixes you did is not something which changed here.

Puzzling, indeed that noone noticed it.

@staabm
Copy link
Contributor Author

staabm commented Jun 13, 2024

the actual error was introduced in #914

@thg2k
Copy link
Contributor

thg2k commented Jun 13, 2024

I'm super confused by this. Please help me understand:

  1. How did you notice? If I dump the type before and after this fix nothing changes, I get: array<int, array{function: string, line?: int, file?: string, class?: class-string, type?: '->'|'::', args?: array, object?: object}> in both cases
  2. Why do we need the signature for all those classes as they all implement Throwable? Shouldn't they inherit it anyway?

Maybe no one noticed cause this change is a no-op 😄

@ondrejmirtes
Copy link
Member

Yeah, my fix might actually be a no-op because it's already been done correctly in https://github.com/phpstan/phpstan-src/blob/1.11.x/stubs/Exception.stub.

To answer your question generally: https://phpstan.org/user-guide/troubleshooting-types

The way these are combined together to offer the full picture is a very complex logic and subject to frequent change as bugs are getting fixed and improvements made.

@thg2k
Copy link
Contributor

thg2k commented Jun 13, 2024

To answer your question generally: https://phpstan.org/user-guide/troubleshooting-types

By now I have a decent grasp on how the type is determined, but I still don't understand why we need the signatures for all those classes that implement Throwable.

Can we get rid of those from the functionMap.php file?

@ondrejmirtes
Copy link
Member

Some stuff could probably be cleaned from functionMap, but most of it can't.

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.

4 participants