1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
Commit Graph

98 Commits

Author SHA1 Message Date
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
Tyson Andre
6ba76e1589 Fix wording nits in documentation 2018-10-27 13:05:49 -04:00
Matthew Brown
f8b213bb48
Add line break 2018-10-25 13:31:04 -04:00
Matthew Brown
4be2e77dfa
Update ALE info 2018-10-25 13:30:37 -04:00
Brown
4ae218fdea Format list properly 2018-10-23 18:31:49 -04:00
Brown
c6f00c07e1 Improve formatting 2018-10-23 17:46:05 -04:00
Brown
93ce245767 Capitalise editors 2018-10-23 17:37:48 -04:00
Brown
09ebb2857f Turn urls into links 2018-10-23 17:35:42 -04:00
Brown
68786b1698 Add link to language server doc 2018-10-23 17:30:36 -04:00
Brown
fc72ac05e4 Add VS Code requirement 2018-10-23 17:27:11 -04:00
Brown
eac28d4291 Add note about new PR 2018-10-23 16:55:07 -04:00
Brown
9ee7b9a1a1 Update VS Code support 2018-10-23 16:52:53 -04:00
Brown
3ca53d4435 Improve formatting of PHPStorm settings 2018-10-23 11:21:32 -04:00
Brown
6e529da5c1 Fix link 2018-10-23 11:20:30 -04:00
Brown
0a3f8d152d Fix PHPStorm instructions 2018-10-23 11:19:27 -04:00
Brown
bb81bbde6d Improve emacs LSP code 2018-10-23 10:20:31 -04:00
Matthew Brown
a1b277869b
Fix name 2018-10-22 11:58:53 -04:00
Brown
6af3a226c4 Add docs for language server support 2018-10-19 17:51:07 -04:00
Tyson Andre
e0dda676ed nit: Fix return type in docs/supported_annotations.md 2018-10-18 17:21:32 -04:00
Dave Liddament
af149bd4dc ADD extra documentation about psalm-assert
Maybe this will be obvious to others, but it probably took me about 3 hours to realise this was possible. Hopefully this doc update will save others time too.
2018-10-11 15:54:37 -04:00
Matthew Brown
afebefba19 Switch from --cache-results to --diff-methods flag 2018-10-07 00:42:25 -04:00
Matthew Brown
265157d814
Add a note about using threads 2018-09-30 16:05:42 -04:00
Matthew Brown
04f78771b5 Add section about running faster builds 2018-09-30 11:34:51 -04:00
Matthew Brown
890412b557 Add support back for parser errors 2018-09-30 11:34:51 -04:00
Matt Brown
4d4e84e6e9 Add specific ForbiddenEcho issue if a config flag is set 2018-09-18 17:08:32 -04:00
Matt Brown
cb63f4f70f Add support for checking DeprecatedTrait and DeprecatedConstant 2018-08-10 13:25:25 -04:00
Tyson Andre
06abf52d94 Fix typos detected by misspell (#924)
Both of initiali[sz]e were used, z was more common.
2018-08-02 00:40:51 -04:00
Tyson Andre
9b7ca80fa4 nit: fix typo in docs (#917)
https://www.vocabulary.com/dictionary/parenthesis
2018-07-24 16:56:51 -04:00
Matthew Brown
e3ae1bf26f Fix #15 - check for uncaught throws if config flag is set 2018-06-22 01:13:49 -04:00
Matthew Brown
896790d30c Add documentation for recently-added features 2018-06-20 00:33:32 -04:00
Matthew Brown
bec227fbc2
Added description of ignoreFiles directive 2018-06-07 13:37:54 -04:00
Matthew Brown
c4f3bd1558 Add docs for @psalm-assert annotations 2018-06-03 23:38:06 -04:00
Matthew Brown
b5cb2b34a2 Fix #380 - don’t complain about legitimate (if archaic) self calls 2018-06-03 19:11:07 -04:00
Alexey Kopytko
185877276c Update dealing_with_code_issues.md (#780) 2018-05-30 07:08:15 -04:00
Matt Brown
2d6eab85fa Fix doc example syntax 2018-05-24 14:33:41 -04:00
Matt Brown
e2153db3dc Add more info to typing guidelines 2018-05-24 14:31:55 -04:00
Matt Brown
bc17d23788 Fix mixed empty checks 2018-05-08 16:34:08 -04:00
Matt Brown
c0729a02cd Fix remaining issues with logic checks 2018-05-07 14:52:45 -04:00
Matt Brown
383f706d6b Add docs for usePhpDocMethodsWithoutMagicCall 2018-04-26 19:19:35 -04:00
rightfold
5c908da55a Check that __clone, __construct, __destruct signatures omit return types
PHP complains when you have a return type declared for these three methods.
2018-04-21 16:04:03 -04:00
Matthew Brown
2b34c1d315 Add extra level 8 containing PHP autoload landmines 2018-04-19 01:03:28 -04:00
Matt Brown
aa3ea9c14c Add a 7th level with even more permissive checks 2018-04-18 15:31:00 -04:00
Matt Brown
5a2f6ff0e0 Fix #624 - change some innaccurate issue names 2018-04-17 14:07:02 -04:00
Matt Brown
6ac2d22f76 Add TOC back to index 2018-04-17 11:29:26 -04:00
Matthew Brown
a03dd6502c Specify what config levels do 2018-04-15 12:17:07 -04:00
Matthew Brown
ad051dcf6d
Improve installation instructions 2018-04-15 10:56:43 -04:00
Matthew Brown
3dad2ecb97
Fix formatting for mkdocs 2018-04-15 10:51:21 -04:00
Matthew Brown
d07644191e Remove artificial table of contents 2018-04-15 10:26:03 -04:00
Matt Brown
21b74ae725 Turn useAssertForType on by default (was off) 2018-04-13 17:35:56 -04:00
Matthew Brown
6519748837
Make class-string annotation more clear 2018-04-11 23:55:39 -04:00