TypeResolver icon indicating copy to clipboard operation
TypeResolver copied to clipboard

fix for multiple class-string classes

Open voku opened this issue 3 years ago • 2 comments

e.g.: class-string<\Foo\Bar|\Foo\Lall>

⇒ currently this will throw an exception like \Foo\Bar|\Foo\Lall is not a class string

voku avatar Feb 05 '22 00:02 voku

Note that Psalm doesn't like that either: https://psalm.dev/r/06ca7972ec

PHPStan is fine with it though

orklah avatar Feb 05 '22 06:02 orklah

Thanks a lot for this PR.

I do get what you are trying to achieve here. But I do not like the extra complexity it takes to get this all done. The maintainability of this parser is becoming an issue more and more. And I'm wondering how to change that because I understand that the type systems supported by psalm and phpstan are getting more complex as well.

maybe we should consider todo a rewrite of the parser to get it where I want it to be. I think the last thing any of us is waiting for are bugs in this lib, with high consequences for all consumers of this library.

This doesn't mean I will never merge this pr, but I want to check first if this can be solved in a more convenient way.

jaapio avatar Mar 15 '22 21:03 jaapio

Since you created this PR our project has been changed, we have done some major rebuilding of the internals of this library. I think we should put this on a roadmap to support this notation. But that requires some breaking changes I think... as it means that the class-string and interface-string should possibly contain a type.

I don't like the solution with an aggregate type of *-string objects. as it does not reflect the original type close enough to cover all situations. And I'm not sure how this will impact the behavior of the consuming projects.

I feel sorry to say this, but at this moment I think we cannot support this in the correct way.

jaapio avatar Mar 17 '23 20:03 jaapio

https://github.com/phpDocumentor/TypeResolver/issues/186

jaapio avatar Mar 17 '23 21:03 jaapio