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

Smartcasts #1037

Open
i582 opened this issue Jul 6, 2021 · 0 comments
Open

Smartcasts #1037

i582 opened this issue Jul 6, 2021 · 0 comments
Labels
epic Tracking the progress of a complex task

Comments

@i582
Copy link
Contributor

i582 commented Jul 6, 2021

This issue tracks the status of smart casts in the linter.

Current

instanceof

Only works for the simple case:

if ($a instanceof Foo) {
   // $a has \Foo type
}

And at the moment the variable continues to have this type after the if block, which is a bug.
#370
#363
#339
#286
#253

isset

Only works for the simple case:

if (isset($a)) {
   // $a exists
}

#287

empty

Only works for the simple case:

if (!empty($a)) {
   // $a exists
}

is_T functions

Not yet implemented.

Planned

Support for negation, support for simple AND and OR.
All is_T functions.

#346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Tracking the progress of a complex task
Projects
None yet
Development

No branches or pull requests

1 participant