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

87 Commits

Author SHA1 Message Date
Matthew Brown
bd48ba858e Add @SignpostMarv’s fixes for Windows tests 2019-03-31 19:08:55 -04:00
Brown
1f4191fcfa Pin PHPCS version 2019-03-19 11:46:51 -04:00
Brown
5beb26659e Add special type for SQL select strings for plugins to consume 2019-03-07 14:56:18 -05:00
Bruce Weirdan
191f8da41f Update psalm/plugin-phpunit 2019-03-02 08:43:19 -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
Matthew Brown
263a4c8cf1 Use Amp for handling language server event loop 2019-02-06 16:08:41 -05:00
Tyson Andre
da32bcbe48 Use lowercase nikic/php-parser for composer 2.0 compatibility
Seen in composer 1.8.3:

> Deprecation warning: require.nikic/PHP-Parser is invalid, it should not
> contain uppercase characters. Please use nikic/php-parser instead. Make
> sure you fix this as Composer 2.0 will error.
2019-02-04 09:14:30 -05:00
Matthew Brown
37aef674a1 Remove unused library 2019-01-15 22:17:45 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -05:00
Brown
ca602f8e17 Fix language server crash after editing trait method names 2018-11-20 15:51:47 -05:00
Matthew Brown
ccef804282 Add 3.x to Psalm 2018-11-18 17:42:26 -05:00
Brown
46cbd0de8d Add phpunit psalm plugin 2018-11-14 13:19:38 -05:00
Bruce Weirdan
3fb0a2f336 reinstate extra.psalm "namespace"
Existing plugins have been updated as well (skeleton, doctrine-collections)

Also fixed path to echo-checker plugin so that it's once again directly
installable from the psalm distribution.
2018-11-14 08:31:02 -05:00
Bruce Weirdan
563eb3183b Mark psalm-plugin as a cli binary
So that it's available in `vendor/bin`
2018-11-12 17:43:58 -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
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
fe25530cad Fix #1073 - relax constraints around missing reflected methods and PHP Parser version 2018-11-10 20:56:31 -05:00
Brown
4da1fd0e40 Change psalm --server to psalm-language-server 2018-10-18 14:34:46 -04:00
Brown
adb26ceea0 Fix #1028 - downgrade php-parser requirement 2018-10-18 12:32:26 -04:00
Brown
54fdda651b Add server mode support with error reporting only 2018-10-17 15:54:31 -04:00
Matt Brown
ebe9452511 Bump XDebugHandler version 2018-07-17 15:24:20 -04:00
Bruce Weirdan
c1e21fcf5d Update PHPUnit (#888)
* upgrade phpunit, test with low and high deps

* work around possibly-anonymous test cases introduced by newer PHPUnit

* Alternative TestCase::getName() nullability workaround

Previous workaround was failing due to PHP warnings on 7.1 or 7.2
(depending on specific signature). There's just no signature that would
be working for all 4 variants of (ver / dep) matrix.

* don't disable xdebug if it's not enabled

* allowed 7.0/high to fail until PHPUnit 6.5.10 is released

see sebastianbergmann/phpunit#3209
2018-07-13 17:44:50 -04:00
Matt Brown
a5f3e20980 Remove friendsofphp/php-cs-fixer as it’s not necessary for dev build 2018-07-12 17:56:21 -04:00
Matt Brown
ecf4ed65e3 Fix self.version ref 2018-07-10 11:39:38 -04:00
Matt Brown
0ae68733af Provide a psalm/psalm package 2018-07-10 11:01:05 -04:00
Alexey Kopytko
60d8977739 Simplify installation of a development version (#877) 2018-07-09 23:14:28 -04:00
Théo FIDRY
59d32566d2 Simplify the PHAR build script 2018-05-15 14:30:14 -04:00
Matt Brown
6afaf5aae9 Make Psalm compatible with PHP Parser 4 2018-04-17 13:06:02 -04:00
Matthew Brown
f604ed99d5 Bump composer version of package-versions 2018-03-26 23:43:54 -04:00
Matthew Brown
0ac526fecd Use v1 composer/xdebug-handler 2018-03-08 16:42:53 -05:00
Bruce Weirdan
9a27583253 replace composer/composer with composer/xdebug-handler
Fixes vimeo/psalm#349

Note: there's no stable release at the moment, so it's using dev-master
for now.
2018-03-08 16:42:53 -05:00
Matthew Brown
1982d08573 Undo prepend-autoloader change 2018-03-03 13:47:09 -05:00
Matthew Brown
33827d4eeb Don’t prepend autoloader 2018-03-03 13:40:02 -05:00
Tyson Andre
7c4683784f Add a script to run the same tests as jenkins locally
Make `composer tests` use only phpcs

Also add `composer all-tests`, which also runs the self-check.

php-cs-fixer was removed from .travis.yml earlier.
I'm guessing that composer was overlooked?

The goal is to make it easy to create PRs passing travis checks.
2018-02-19 15:34:26 -05:00
Matthew Brown
58be09d36b Bump suggested igbinary version 2018-02-19 11:16:13 -05:00
Matthew Brown
634375ae94 Make igbinary the default serializer
Fix #484 and fix #527
2018-02-19 11:14:07 -05:00
Nicky Robinson
8e77ff1ce9 Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
* Fix path to psalm

* If a magic getter or setter is used to access a property on a class
that is not defined but a `@property` annotation for the property
exists, throw an error. If no `@property` annotation exists, it's not
an error because you're allowed to make magic getters and setters do
crazy things.

Fixes #480

* Move logic to a better place to avoid duplicate checks

* Move logic into function

* Remove some nesting

* Check psalm-seal-properties and property type correctly
2018-02-09 19:37:09 -05:00
Matthew Brown
456a2ebaaa Add --dry-run option 2018-01-07 17:25:23 -05:00
Matthew Brown
5bae869dc6 Break file manipulation out into Psalter 2018-01-07 17:25:23 -05:00
Matthew Brown
30754bcd52 Allow more versions for php-cs-fixer 2018-01-02 20:47:11 -05:00
Matthew Brown
236fa893a8 Update PackageVersions version to one that doesn’t replace other similar packages 2018-01-01 09:53:21 -05:00
Matthew Brown
a26aecd45b Use non-clashing name for package versions 2018-01-01 09:25:32 -05:00
Matthew Brown
8efc939a5f Move Psalm execution code into PHP file that Psalm can analyse 2017-12-29 17:02:56 -05:00
Matt Brown
6fedeb647c Bump composer/composer version 2017-12-18 16:11:49 -05:00
Matthew Brown
e4f0dcaae3 Update php-parser 2017-12-14 09:14:23 -05:00
Matthew Brown
6c735b7699 Make coverage work proper good 2017-12-14 01:10:20 -05:00
Matthew Brown
a151fe5d3e
Add code coverage checks by @SignpostMarv (#388)
* Add code coverage checks

* Add coveralls badge
2017-12-14 00:40:22 -05:00
Matt Brown
d6960f526c Remove testing support for 7.2 2017-11-30 19:11:06 -05:00
Matt Brown
062d46c132 Update to latest php-cs-fixer 2017-11-30 19:00:09 -05:00
Matthew Brown
d21cb08e31 Bump package-versions version 2017-11-13 22:09:12 -05:00