Skip to content
This repository has been archived by the owner on Jul 20, 2018. It is now read-only.

Check return values before calling additional functions on variables #283

Open
ChrisHardie opened this issue Jun 4, 2015 · 1 comment
Open

Comments

@ChrisHardie
Copy link

@nickdaugherty once said, "return values should always be checked before calling methods on them"

@nickdaugherty
Copy link
Contributor

👍

This one will be tricky to do right with static analysis. We may be able to do something like:

Parse everything that looks like $variable = some_opaque_operation(); $variable->do_stuff() when not wrapped in a valid check like is_callable( $variable, 'do_stuff' ).

The same would go for accessing properties without checking that the $variable was indeed an object or instanceof a class.

There may also be a dynamic analysis piece to this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants