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

union type support #119

Closed
staabm opened this issue Jul 15, 2024 · 1 comment · Fixed by #120
Closed

union type support #119

staabm opened this issue Jul 15, 2024 · 1 comment · Fixed by #120

Comments

@staabm
Copy link
Contributor

staabm commented Jul 15, 2024

properties are reported unused even though they are used via union type:

<?php

class A {
    public float $amount;
}

class B {
    public float $amount;
}


/** @param A|B $aOrB */
function doFoo($aOrB): void {
    echo $aOrB->amount;
}

function doFooBar(A|B $aOrB): void {
    echo $aOrB->amount;
}

reports

 ------ -------------------------------------------------------------------------------------------------------- 
  Line   test.php
 ------ --------------------------------------------------------------------------------------------------------
  3      Public property "A::$amount" is never used
         💡 Either reduce visibility or annotate it or its class with @api
  7      Public property "B::$amount" is never used
         💡 Either reduce visibility or annotate it or its class with @api

@staabm
Copy link
Contributor Author

staabm commented Jul 15, 2024

(working on a fix right now)

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 a pull request may close this issue.

1 participant