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

31 Commits

Author SHA1 Message Date
Matthew Brown
b052e211a0 Improve internal typing for sabre/event promises 2018-12-10 23:18:53 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -05:00
Matthew Brown
830ee873dc Throw exception before notice is emitted 2018-12-05 09:33:13 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Matthew Brown
37dedee7b6 Fix memory leak issues and disable garbage collection 2018-11-18 11:39:14 -05:00
Brown
46cbd0de8d Add phpunit psalm plugin 2018-11-14 13:19:38 -05:00
Brown
0254322bed Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals 2018-11-12 11:20:59 -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
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
Matthew Brown
12e3ab11ad Improve handling of breaks in switch statements 2018-11-10 20:34:53 -05:00
Brown
b7099aaf3f Make sure array changes are noticed 2018-11-09 11:19:44 -05:00
Erik Booij
635410ea41 Introduce issue baseline with --set-baseline and --with-baseline 2018-11-01 11:16:08 -04:00
Brown
e286089eaa Add onchange events and symbol lookup with disabled completion 2018-10-26 16:17:15 -04:00
Matthew Brown
addaea2c1c Improve performance when parsing large files with few changes 2018-10-26 00:59:14 -04:00
Brown
6ac6aece89 Add coverage of differ, having fixed Psalm bug 2018-10-23 13:38:12 -04:00
Brown
54fdda651b Add server mode support with error reporting only 2018-10-17 15:54:31 -04:00
Brown
1d5759a35c Improve test coverage of ProjectChecker 2018-10-17 11:03:32 -04:00
Brown
71b7c70eb1 Add way of getting changes in a given file 2018-09-30 11:34:51 -04:00
Matthew Brown
b6372f8342 Analyse SimpleNameResolver too 2018-07-22 18:00:08 -04:00
Matt Brown
35fb1ab164 Ignore issue only found in legacy PHPUnit 2018-07-17 15:32:14 -04:00
Matthew Brown
5ea8b86b7c Resolve as many names as possible in the parsing stage 2018-07-12 21:25:06 -04:00
Matthew Brown
685ae67435 Fix #839 - check args for __call methods 2018-06-26 23:11:16 -04:00
Matthew Brown
e1d922e9df Add support for ignoredExceptions 2018-06-22 01:26:10 -04:00
Matthew Brown
d47980df13 Fix #416 - make sure trait methods are treated better by dead code detection 2018-06-09 23:10:42 -04:00
Matt Brown
5c0f4a999c Move a bunch of classes to better places 2018-05-11 18:35:02 -04:00
Matthew Brown
5c39fb5ab1 Fix #716 - uss string inference to inform property names 2018-05-08 21:21:22 -04:00
Matt Brown
c0729a02cd Fix remaining issues with logic checks 2018-05-07 14:52:45 -04:00
Matt Brown
ae49558de6 Ignore MissingConstructor a little less 2018-05-03 11:38:27 -04:00
Matthew Brown
da69e60cf3 Don’t error on existing Psalm configs cc @ostrolucky 2018-04-21 19:05:26 -04:00
Radosław Kowalewski
88bf8e284c Configuration fallback to psalm.xml.dist file
Closes vimeo/psalm#644
2018-04-14 10:45:05 -04:00