1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 17:27:28 +01:00
Commit Graph

219 Commits

Author SHA1 Message Date
Brown
1413ccd111 Prevent phar path rejiggering 2019-04-29 11:33:13 -04:00
Matthew Brown
e08944cae0 Allow diff mode with --find-dead-code 2019-04-27 17:38:24 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
Brown
d1f4622a80 Fix #1542 - disable SQL parsing by default 2019-04-22 10:01:25 -04:00
Matthew Brown
79ae72d553 Fix #935 - allow Phar to run without composer files 2019-04-20 16:37:27 -04:00
bugreportuser
2e147585a1 Allow ignoring exceptions only in global scope 2019-04-16 22:42:45 -04:00
Matthew Brown
c297b91d6f Fix possibly null property 2019-04-14 13:04:25 -04:00
Brown
7f8b47c5cf Fix buggy behaviour around callable tests 2019-04-09 18:09:57 -04:00
Matthew Brown
bd48ba858e Add @SignpostMarv’s fixes for Windows tests 2019-03-31 19:08:55 -04:00
SignpostMarv
83d8e7f03c swapping order of mkdir & is_dir, as per #1467 2019-03-31 14:21:15 -04:00
Matthew Brown
326249e13b spirit => shepherd 2019-03-31 14:02:30 -04:00
bugreportuser
976c2c5ef3 Add an error for throws in global scope 2019-03-24 23:03:37 -04:00
Matthew Brown
ba603acd7b Send build information to remote server 2019-03-23 12:49:37 -04:00
Matthew Brown
9d4ebe6b6b Add plugin hook for post-analysis stuff 2019-03-23 12:47:46 -04:00
Matthew Brown
ee56419fd6 Improve accuracy and durability of mixed counts 2019-03-23 09:50:47 -04:00
Matthew Brown
472ab29d74 Add PossiblyInvalidCast for more refined checks 2019-03-17 17:10:51 -04:00
bugreportuser
e31cfa503d Allow reconciling superglobal types 2019-03-16 12:49:38 -04:00
bugreportuser
056e5a5b1e Allow setting globals in config 2019-03-06 15:59:41 -05:00
Brown
bd372e93af Add config flags for findUnusedVariables and findUnusedCode 2019-03-05 15:45:09 -05:00
Matthew Brown
317f790bde
New plugin hooks (#1405)
* Add a bunch of new hooks

* Add more integrations

* Add some broken tests

* Add more things

* Fix remaining interfaces

* Suppress proper issue

* UndefinedMethod should not stop analysis

* Add handlers for two custom method return types
2019-03-01 08:57:10 -05:00
Bruce Weirdan
24a71be425 Added Hook\AfterCodebasePopulatedInterface 2019-02-26 01:16:22 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
Matthew Brown
356a45a155 Improve ergonomics of PHPStorm meta parsing 2019-02-16 18:50:25 -05:00
Matthew Brown
0739d017ac Use information from .phpstorm.meta.php files in stubs 2019-02-16 11:16:52 -05:00
Matthew Brown
c58100e3af Fix #1313 - don’t allow mixed function calls 2019-02-10 16:15:52 -05:00
Brown
3f289731bb Add ability to check descendants in ignored exceptions 2019-01-31 18:40:40 -05:00
Andrii Dembitskyi
9b6b79728e Fixes #1222 - incorrect config value used for allowStringToStandInForClass
Please make attention, that `allowCoercionFromStringToClassConst` are mentioned in docs, but not used now in config
2019-01-21 09:00:57 -05:00
Roland Franssen
9a827c48ae Tweak error message 2019-01-16 09:02:45 -05:00
Matthew Brown
b43a6a31f1 Enable casing plugin and fix issues it found 2019-01-12 10:52:23 -05:00
Matthew Brown
6e585008f2 Fix #1183 - add hook for class analysis 2019-01-09 08:28:12 -05:00
Matthew Brown
195cb289ed Add float-checking plugin, and support for custom plugin issues 2019-01-07 08:38:56 -05:00
Matthew Brown
36a1fe07da Allow plugins to have more than one class
Ref #536
2019-01-06 17:32:19 -05:00
Brown
1d300ec342 Fix #1150 2019-01-02 11:18:22 -05:00
Matthew Brown
c4d024a72d Check variable static calls
Fixes #1142 and #1160
2019-01-02 09:00:45 -05:00
Matthew Brown
901596281c Fix #1143 - check some variable new calls 2019-01-02 06:58:49 -05:00
Brown
f02fdeddf3 Fix spelling 2018-12-19 18:03:02 -05:00
Brown
87993bad3b Fix attribute names 2018-12-19 17:56:29 -05:00
Brown
fb848d62e9 Add checks for if (count($a)) and if (count($a) [operator] [number]) 2018-12-19 16:15:19 -05:00
Matthew Brown
ea89a6ba29 Revert "First pass"
This reverts commit 9ed047234f.
2018-12-19 08:45:14 -05:00
Matthew Brown
9ed047234f First pass 2018-12-19 01:59:14 -05:00
Matthew Brown
ca6149ed17 Improve treatment of templated params within function analysis 2018-12-17 23:29:27 -05:00
Brown
9e4765663d Fix #999 - respect @method annotations to redefine parent methods 2018-11-30 15:13:25 -05:00
Matthew Brown
8eca864e98 Use composer class loader for source project to avoid plugin overwriting
cc @weirdan
2018-11-25 10:41:22 -05:00
Bruce Weirdan
512d07c93a Re-enable plugin autoloading
Plugins are supposed to be autoloaded when they are referenced by class
names.
2018-11-12 17:42:36 -05:00
Brown
dc834fdb01 Default allowStringToStandInForClass to true and fix errors found 2018-11-12 12:03:55 -05:00
Bruce Weirdan
a338e76ef6 Plugin interface segregation (#1076)
* Split Plugin into PluginApi\Hook\* interfaces

* dropped Psalm\Plugin

* updated docs

* s/PluginApi/Plugin/g
2018-11-12 11:20:59 -05:00
Matthew Brown
4d79b61e93 Change _checker to _analyzer 2018-11-12 11:20:59 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Bruce Weirdan
052d4f6217 Plugin loading (#855)
* add ability to load plugins by class names

- Plugins need to implement `__invoke(PluginFacade $psalm):void` method
- Plugins are enabled by adding `<pluginClass
class="Qualified\Class\Name"/>`
- `PluginFacade` provides a single point of contact with Psalm, so that
plugins cannot become coupled to Psalm internals

* added `psalm-plugin` cli tool to manage plugins

Available commands:
 `psalm-plugin list` - lists available and enabled plugins
 `psalm-plugin enable 'Plugin\Class\Name'` - enables plugin (modifies `psalm.xml`)
 `psalm-plugin disable 'Plugin\Class\Name'` - disables plugin (modifies `psalm.xml`)

Plugin installation:
 `composer install plugin-vendor/plugin-package-name`

Plugin authoring:
 Plugins are identified by package `type` field, which should contain
 `psalm-plugin` string.
 `extra.pluginClass` should refer to the name of the class implementing
 `__invoke(PluginFacade $psalm):void` function

Todo:
 - better config file search
 - better output for `psalm-plugin`
 - better formatting for modified xml file
 - composer skeleton project for plugins
 - ability to refer to plugins by package name (cli only)
 - composer plugin to (optionally) enable plugin upon installation
 - documentation on plugin installation and authoring
 - interfaces for plugin dependencies
 - interface for plugin entry point
 - migration path for legacy plugins

* documented previously undocumented plugin methods

* split legacy plugin registration into a wrapper class

also added `PluginApi` namespace and `RegistrationInterface`

* reuse psalm's config search algorithm

* enable/disable plugins by composer package name

* allow specifying alternative config file name

* whitelist PluginApi namespace

three times, but well, it works now

* interface for plugin entry points

* psalm-plugin as a symfony console app

* fixed errors found by psalm

* suppressed false positive UnusedMethods

* cs fix

* better psalm-plugin output

* don't leave empty `plugins` node to avoid old schema violation

* removed junk file that shouldn't be there

* cs fix

* fixed phpunit failure (constant redefinition)

* work around missing docblock in on symfony console

* php 7.0 compatibility

* allow `pluginClass` child elements as plugin configuration

* decouple console commands from undelying implementation

- introduce PluginListFactory
- add `PluginList::enable(string $class)` and `PluginList::disable(string $class)`

* PluginList tests

* ComposerLock test

* droppped debugging statement

* added part of console command tests

* added tests for EnableCommand

* added DisableCommand tests

* ignore unused args

* ConfigFile test

* disable travis cache in attempt to fix builds

* nah, that didn't work

* update for upstream changes

* rebase fixes

* namespaced `extra` entry for entry point

* s/PluginFacade/PluginRegistrationSocket/g

* Added $config parameter to PluginEntryPointInterface::__invoke()

* cs fixes

* entry point interface php7.0 compatibility

* cleaned up old cruft

- dropped todos I'm not going to pursues
- locked entry point to be a class implementing entry point interface

* fixed legacy plugins docs

* Added RegistrationInterface::registerHooksFromClass()

It mimics the way old plugins were registered in Psalm\Config, so
handler classes extending Psalm\Plugin should be fully compatible with
it.

Since Psalm\Plugin-style plugin registration was moved to
RegistrationSocket, LegacyPlugin now only load file-based plugins, so it
was renamed to FileBasedPluginAdapter.

* Converted EchoChecker plugin to composer-based format

- Its subfolder is registered as a local composer package in the root
composer.json, so it's directly installable with
	```
	composer require psalm/echo-checker-plugin
	```
- Migration is trivial: drop the plugin into a separate folder, then add
simple composer.json and the entry point class.

* Updated docs

* Don't reject hook handlers that inherit handling methods

* strip void return type in stub file
2018-11-10 23:23:36 -05:00
Brown
df8b0a1fc5 Bust cache when config changes, don’t rely on > modified time 2018-11-01 17:42:48 -04:00