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

112 Commits

Author SHA1 Message Date
Brown
560daf9733 Ignore deprecated methods in tests 2019-10-04 11:23:35 -04:00
Brown
b0aaede9e1 Add support for checking integer array offsets 2019-10-04 11:08:08 -04:00
Brown
f8f8b633b1 Suppress a bunch of PossiblyUndefinedArrayOffset issues 2019-10-01 15:44:43 -04:00
Matthew Brown
9ad6c36d9b
Conditionally verify that array offsets exist (#2147)
* Check array offsets idea

* Clean up some issues

* Add a few light fixes

* Add docs
2019-09-18 14:21:06 -04:00
Brown
9835943294 Fix #2041 - make sure property is always set 2019-08-21 11:25:08 -04:00
Barney Laurance
94f934627c Work in progress - resolve directories from config file location (#1904)
* Add resolveFromConfigFile config option

Treats all paths as relative to the location of the config file, not
the current working directory of the process.

This commit just changes psalm, further commits will be needed to
apply the change to psalter and the LSP server.

* Copy asset xml files into project root for testing, delete during teardown

Needed since paths are now resolved relative to the position of the
file.

Not sure why I only saw a test failre for 1.xml - would have expected it
for all eight files.

* Fix following rebase

* Move psalm --init handly code above working directory setting code

If there's no psalm.xml yet we can't use the location of psalm.xml to
set our working directory

* Move Psalm version output code above working directory resolution

Working directory doesn't need to be known to output version constant

* Rely on new config file based working directory in end to end test

* Dont use rely on config dir for --alter - not currently working

* Fix code style error

* Add failing test for supporting config without `resolveFromConfigFile="true"`

* Don't treat config directory as a path to check

* Document resolveFromConfigFile setting
2019-07-06 12:21:39 -04:00
Brown
8fd59674a2 Disable progress bar when forking processes 2019-05-30 15:15:12 -04:00
Brown
d75ac7f55d Move test fixtures to a single directory 2019-05-09 18:23:14 -04:00
Matthew Brown
e4fbe61444 Ignore all PHPUnit issues 2019-04-27 17:57:15 -04:00
Matthew Brown
e08944cae0 Allow diff mode with --find-dead-code 2019-04-27 17:38:24 -04:00
Brown
26e2de93c7 Prepare to enable paralellised use of --find-dead-code
References #1548
2019-04-12 18:28:07 -04:00
Matthew Brown
326249e13b spirit => shepherd 2019-03-31 14:02:30 -04:00
Brown
c022d49b1a Allow coercion from templated param to false 2019-03-28 10:19:02 -04:00
Brown
c1434ee212 Add --language-server support 2019-03-27 11:55:10 -04:00
Matthew Brown
9d4ebe6b6b Add plugin hook for post-analysis stuff 2019-03-23 12:47:46 -04:00
Brown
a8ea907d6c Fix #1432 - allow callable to be coerced to callable-array 2019-03-06 18:24:59 -05:00
Brown
bd372e93af Add config flags for findUnusedVariables and findUnusedCode 2019-03-05 15:45:09 -05:00
Bruce Weirdan
8ec188a53f Drop unneeded suppressions 2019-03-02 08:43:19 -05:00
Bruce Weirdan
ec85096c96 Fixed identified issues 2019-03-02 08:43:19 -05:00
Matthew Brown
5c76ab35c8 Allow properties to be set regardless of visibility 2019-03-01 17:30:55 -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
Aaron Piotrowski
b0d97843ce Update Amp usage
Fixed a few errors and used byte-stream for reading and writing.
2019-02-06 16:08:41 -05:00
Bruce Weirdan
36343b07ce Dropped usage of now deprecated assertArraySubset 2019-02-01 17:09:37 -05:00
Matthew Brown
b8b1106d79 Fix #1265 - allow referencedClass/Property/Method to be warnings 2019-02-01 07:58:40 -05:00
Brown
3f289731bb Add ability to check descendants in ignored exceptions 2019-01-31 18:40:40 -05:00
Matthew Brown
b43a6a31f1 Enable casing plugin and fix issues it found 2019-01-12 10:52:23 -05:00
Brown
1fddc19172 Add initial support for property types 2019-01-11 17:21:50 -05:00
Brown
f108badd03 Fix #1067 - add support for @template-extends 2019-01-10 16:59:44 -05:00
Matthew Brown
07b29e4a2f Fix #1141 - add symlinked symlinked repos to directory list 2019-01-06 09:14:35 -05:00
Brown
72c50be4b0 Fix build 2018-12-19 20:01:27 -05:00
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