mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Nicky Robinson
8e77ff1ce9
Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
* Fix path to psalm * If a magic getter or setter is used to access a property on a class that is not defined but a `@property` annotation for the property exists, throw an error. If no `@property` annotation exists, it's not an error because you're allowed to make magic getters and setters do crazy things. Fixes #480 * Move logic to a better place to avoid duplicate checks * Move logic into function * Remove some nesting * Check psalm-seal-properties and property type correctly
Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
Psalm is a static analysis tool for finding errors in PHP applications.
- v0.3.x supports checking PHP 5.4 - 7.1 code, and requires PHP 5.6+ to run.
- v0.2.x supports checking PHP 5.4 - 7.0 code and requires PHP 5.4+ to run.
Check out the wiki or try a live demo!
Quickstart Guide
Install via Composer:
composer require --dev vimeo/psalm
Add a config:
./vendor/bin/psalm --init
Then run Psalm:
./vendor/bin/psalm
The config created above will show you all issues in your code, but will emit INFO
issues (as opposed to ERROR
) for certain common trivial code problems. If you want a more lenient config you can specify the level with
./vendor/bin/psalm --init [source_dir] [level]
You can also learn how to suppress certain issues.
How Psalm Works
A basic rundown of Psalm’s internals can be found in docs/how_psalm_works.md.
Acknowledgements
The engineering team @vimeo for encouragement and patience, especially @nbeliard, @erunion and @nickyr.
Thanks also to @nikic for creating the excellent php-parser, on top of which Psalm is built.
Languages
PHP
100%