1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
Commit Graph

113 Commits

Author SHA1 Message Date
Brown
0bcb7863f3 Use better system for storing inferred types and assertions 2019-11-25 11:44:54 -05:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Matthew Brown
ec104be6e2 Add offset to atomic type
Ref #1832
2019-06-23 00:19:41 -04:00
Matthew Brown
31c8a2e4d7 Add offsets to type tokenisation
Ref #1832
2019-06-22 23:30:40 -04:00
Ilija Tovilo
5a14e4b1cf Progress bar (#1709)
* Revert "Revert "Implement better progress""

This reverts commit 4302596654.

* Revert "Revert "Implement dots progress bar""

This reverts commit e41733d789.

* Revert "Revert "Switch to VoidProgress by default""

This reverts commit 304ffeb0a3.

* Revert "Revert "Pass success flag to progress""

This reverts commit 62a690ee4e.

* Improve socket communication

* Use an underscore

* Add means to disable progress

* Add extra newline before progress bar
2019-05-30 10:30:41 -04:00
Matthew Brown
4302596654 Revert "Implement better progress"
This reverts commit 042070d0fd.
2019-05-27 13:07:02 -04:00
Ilija Tovilo
042070d0fd Implement better progress 2019-05-26 23:18:48 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
Matthew Brown
01d6caf6a2 Catch negated instanceof bugs 2019-03-16 12:34:48 -04:00
Matthew Brown
efbcf7dc5b Fix #1417 - store root file path when scanning for manipulations 2019-03-02 15:07:26 -05:00
Matthew Brown
cdae79b9fe Fix unnecessary params in Psalm codebase 2019-02-23 11:31:33 -05:00
Matthew Brown
8ab5fae484 Add function casing example plugin 2019-01-07 09:34:16 -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
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -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
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
000ec8ec12 Add plugin 2018-10-29 12:15:36 -04:00
Brown
53719447f5 Add tests for new functionality 2018-10-17 15:54:31 -04:00
Matt Brown
549e90eca4 Treat required files the same as the files that require them, reporting-wise 2018-05-30 16:19:18 -04:00
Matt Brown
a409b3c32a Remove unnecessary echo 2018-04-25 11:53:10 -04:00
Matthew Brown
724e72af58 Don’t get statements from cache if file hasn’t changed 2018-02-19 11:53:30 -05:00
Matthew Brown
81fd016120 Fix #193 - allow caching of storages 2018-02-19 00:27:39 -05:00
Matthew Brown
e862e4ddb1 Make all plugin methods static
cc @TysonAndre
2018-02-11 20:56:34 -05:00
Matthew Brown
8e0998e081 Break apart the Codebase class 2018-02-03 18:56:54 -05:00
Matthew Brown
59cdc5494f Remove unused list vars 2018-01-28 12:29:14 -05:00
Matthew Brown
f628187de9 Remove dead code found by improved Psalm checks 2018-01-28 12:01:51 -05:00
Matthew Brown
bc9761f6c9 Create Codebase out from ProjectChecker 2018-01-21 13:45:33 -05:00
Matthew Brown
e05a7c00cc Break FileScanner out from FileChecker 2018-01-21 12:44:46 -05:00
Matt Brown
6ce4aa19e4 Fix formatting in examples 2018-01-18 17:41:14 -05:00
Matthew Brown
cc81d78dfd Add code replacement api to allow Psalm to update arbitrary parts of the codebase
Fixes #264
2018-01-02 09:46:50 -05:00
Matthew Brown
81cfe09fae Improve reporting of classlike locations in docblocks 2018-01-01 20:04:03 -05:00
Matthew Brown
921d0ad75c
Look for dead code in every Psalm build (#417) 2017-12-30 09:51:01 -05:00
Matthew Brown
e08b11b144 Improve TemplateChecker 2017-12-06 01:05:51 -05:00
Matthew Brown
4175295113 Isolate where we load static storage objects (#195)
* Move FileChecker::$storage calls to provider

* Add ClassLikeStorageProvider

* Use ClassLikeStorageProvider everywhere

* Move storage arrays into providers
2017-07-29 15:05:06 -04:00
Matthew Brown
1b9f3c33a1 Add better instructions for --init 2017-02-13 00:12:56 -05:00
Nicky Robinson
cbcd0722d2 Fix Psalm errors in StringChecker example, add it to psalm.xml 2017-02-09 16:08:53 -05:00
Matthew Brown
9220b958eb Fix phpcs errors 2017-01-16 19:06:39 -05:00
Matthew Brown
c702ebe13c Update docs with better introductory config 2017-01-16 01:27:06 -05:00
Matthew Brown
645b245927 Update default config to not break on FailedTypeResolution
ref #50
2017-01-13 17:34:41 -05:00
Matthew Brown
685eaeb4fe Reimagine XML schema, fixes #21 2016-12-29 20:10:06 -05:00
Matthew Brown
9a32b5fd40 Hide Mixed* issues under a totallyTyped config flag 2016-12-18 19:17:39 -05:00
Nicky Robinson
4531681a24 Fix references, add helpful comments 2016-12-12 16:07:45 -05:00
Matthew Brown
48ba91a05b Add MissingPropertyType to default exceptions 2016-12-04 00:08:53 -05:00
Matthew Brown
a1acbfec07 Show code snippets when reporting errors
This also introduces a new method of identifying specific code locations when creating issues
2016-12-03 19:11:30 -05:00
Matthew Brown
032f54ecdb Add MissingReturnType 2016-11-21 23:39:47 -05:00
Matthew Brown
632ce0eafe Add more nice-to-have suppression in default Psalm config 2016-11-21 19:10:25 -05:00
Matthew Brown
e9ea66f21b Fix issues in examples 2016-11-21 15:51:38 -05:00
Matthew Brown
4514006d42 Add explanation for plugin 2016-11-21 15:39:04 -05:00
Matthew Brown
9befca8c31 Add example checker 2016-11-21 15:32:51 -05:00
Matthew Brown
264e77addd Change a few more words 2016-11-07 19:16:51 -05:00
Matthew Brown
36fc49965b Correct speling 2016-11-07 17:31:02 -05:00
Matthew Brown
622a0794c3 Swap in Fully-Qualified for Absolute terms 2016-11-07 17:29:51 -05:00
Matthew Brown
c5591adf10 Add support for global in functions and mixed inferred return errors 2016-11-05 17:54:34 -04:00
Jon Ursenbach
653f509e80 Merge branch 'master' into psr2-fixes 2016-11-04 20:07:21 -04:00
Jon Ursenbach
8a6e8e9940 Fixing remaining PSR-2 violations. 2016-11-03 20:51:56 -04:00
Matthew Brown
23d5974a88 Swap codeinspector with psalm 2016-11-03 20:39:04 -04:00
Jon Ursenbach
27c2db1d1d PSR-2 2016-11-02 17:50:54 -04:00
Matthew Brown
450fc3c5ea Ignore two common errors 2016-10-31 18:31:40 -04:00
Matthew Brown
3c811381aa Add an example template checker 2016-10-29 23:07:13 -04:00
Matthew Brown
b930ce2721 Add example Psalm config 2016-10-29 20:57:23 -04:00