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

linter: added support for chains of instanceof #1058

Merged
merged 8 commits into from
Aug 24, 2021
Merged

Conversation

i582
Copy link
Contributor

@i582 i582 commented Jul 13, 2021

Added support for:

/**
  * @param mixed $a
  */
function f1($a) {
  if ($a instanceof Foo || $a instanceof Boo) {
     exprtype($a, "\Boo|\Foo");
  }
}

/**
  * @param Boo|Foo|Zoo $a
  */
function f1($a) {
   if ($a instanceof Foo && $a instanceof Boo) {
     exprtype($a, "\Boo|\Foo");
   } else {
     exprtype($a, "\Zoo");
   }
}

And for:

/**
  * @param mixed $a
  */
function f($a) {
   if (!$a instanceof Foo) {
      return;
   }

   exprtype($a, "\Foo");
}

Fixes #339
Fixes #363
#346
#1037

@i582 i582 added the enhancement New feature or request label Jul 13, 2021
@i582 i582 added this to the v0.4.0 milestone Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant