Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extended reasons tips to param out errors #3258

Open
wants to merge 2 commits into
base: 1.11.x
Choose a base branch
from

Conversation

thg2k
Copy link
Contributor

@thg2k thg2k commented Jul 22, 2024

This adds the very useful tips on complex types also to param-out.

Please carefully review the correctness, I assume that isSuperTypeOf and acceptsWithReason are equivalent.

Also not sure how to set the strictness parameter, as it is a param-out it should not be affected by the strict types declare.

Before:

 ------ ----------------------------------------------------------------------------------------------------------------------------
  Line   case2.php
 ------ ----------------------------------------------------------------------------------------------------------------------------
  8      Parameter &$foo by-ref type of function foo() expects array{a: int, b: int, c: string}, array{a: int, b: int, c: 5} given.
           parameterByRef.type
          You can change the parameter out type with @param-out PHPDoc tag.
 ------ ----------------------------------------------------------------------------------------------------------------------------

After:

 ------ ----------------------------------------------------------------------------------------------------------------------------
  Line   case2.php
 ------ ----------------------------------------------------------------------------------------------------------------------------
  8      Parameter &$foo by-ref type of function foo() expects array{a: int, b: int, c: string}, array{a: int, b: int, c: 5} given.
           parameterByRef.type
          Offset 'c' (string) does not accept type int.
          You can change the parameter out type with @param-out PHPDoc tag.
 ------ ----------------------------------------------------------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant