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

210 Commits

Author SHA1 Message Date
Bruce Weirdan
c27cd3d472
Fix windows builds (#4775)
* Choco now offers PHP 8 only

* Bump build deps to allow PHP 8 builds

* Bump slevomat

* Disable coverage to allow paratest

* Bump dummy project version to allow testing on PHP 8
2020-12-04 15:11:14 -05:00
Matthew Brown
42c9f017f9
Experiment with PHP 7.1 compatibility (#4421)
* Experiment with PHP 7.1 compatibility

* Let’s hop
2020-10-26 15:14:48 -04:00
Matt Brown
949891a1dd Don’t require webmozart/glob
Fixes #4408
2020-10-25 11:49:53 -04:00
Matt Brown
7c5feb2968 Bump minimum phpunit plugin version 2020-10-19 09:16:18 -04:00
Matthew Brown
b4a2391484
Update composer.json 2020-10-19 01:55:18 -04:00
Matthew Brown
e918b5dff1
Add 4.0 compatibility (hopefully) 2020-10-19 01:26:23 -04:00
Brown
960579df5f Require latest php-parser 2020-09-25 10:07:43 -04:00
Brown
c4450b930c Fix various things 2020-09-13 22:39:03 -04:00
Bruce Weirdan
aa09a1c780
Use per-user cache folder (#4098)
Fixes vimeo/psalm#3869
2020-09-01 09:20:24 -04:00
Brown
c565819a0c Bump PHPUnit plugin version 2020-08-30 12:40:47 -04:00
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
Bruce Weirdan
ffd899ed3c
Fix prophecy warnings (#4051)
* Use weirdan/prophecy-shim to avoid PHPUnit warnings on prophesize() calls

* Drop vcs repo as the package is already available on packagist

* Bump psalm/plugin-phpunit

Fixes Prophecy-related issues
2020-08-24 18:02:39 -04:00
Matthew Brown
73321339a3 Bump nikic/php-parser 2020-08-09 16:23:43 -04:00
kazusuke sasezaki
12cd512fb6
specify requirement phpdocumentor/reflection-docblock:^4.3.4 (#3967) 2020-08-09 08:25:30 -04:00
Matthew Brown
3f06d4f706 Restrict compatible versions of nikic/php-parser 2020-07-25 17:33:19 -04:00
Bruce Weirdan
56047dd094
Use composer/package-versions-deprecated instead of ocramius/package-versions (#3846)
It allows wider range of PHP versions in addition to supporting both
Composer v1 and v2

Fixes vimeo/psalm#3844
2020-07-20 04:53:16 -04:00
LeSuisse
cd77be6fc4
Allow netresearch/jsonmapper ^3.0 to be installed (#3830)
The major version seems to be the addition of the support of the
PHP 7.4 class type properties.

https://github.com/cweiske/jsonmapper/blob/v3.0.0/ChangeLog
2020-07-17 10:08:40 -04:00
Bruce Weirdan
931d35a703
Collect and scan files included by the autoloaders (#3183)
Refs vimeo/psalm#2861
2020-07-11 17:17:22 -04:00
Claas Augner
8638fdc733
Allow composer/semver ^2 || ^3 (#3525) 2020-06-04 17:45:12 -04:00
Mark Sch
d49f0a9075
Usability for cs check and fix. (#3363) 2020-05-14 19:16:16 -04:00
Mark Sch
0cd0f76424
Simplify PSR4 namespace config. (#3362) 2020-05-14 18:37:29 -04:00
Bruce Weirdan
95bc9603be
Added coverage upload to coveralls.io (#3078)
* Added coverage upload to coveralls.io

* Commented out the step that generated wrong link
2020-04-05 22:38:30 -04:00
Bruce Weirdan
a1aaf568af
Bump psalm/plugin-phpunit (#3074)
This fixes a couple of composer warnings
2020-04-05 22:35:22 -04:00
Bruce Weirdan
c50faeafee
Allow PHPUnit 9 (#3072)
* Allow PHPUnit 9

Had to add a couple of compatibility shims to keep tests the same.

* import method_exists()
2020-04-05 17:25:00 -04:00
Matthew Brown
4191f7a259 Remove unnecessary annotation 2020-04-05 00:54:31 -04:00
Kuba Werłos
dc15afe781
Allow netresearch/jsonmapper ^2.0 (#3031) 2020-03-28 17:20:46 -04:00
Tyson Andre
21b89629fc Bump minimum phpunit 8 version for development
This is in require-dev, so it hopefully should have limited impact.
The travis tests might pick up newer dependencies, though
2020-02-20 22:42:16 -05:00
Tyson Andre
088db2d36d Support using paratest for local development
https://phpunit.de/manual/6.5/en/appendixes.configuration.html#appendixes.configuration.testsuites
documents that `<testsuites>` should typically wrap `<testsuite>` in
phpunit.xml.

> The <testsuites> element and its one or more <testsuite> children can
> be used to compose a test suite out of test suites and test cases.

This project may get a small performance boost
running tests in CI with paratest(2 processes) instead of phpunit.
Paratest works locally, and supports php 7.1+.

See https://github.com/paratestphp/paratest/
2020-02-20 22:42:16 -05:00
Matthew Brown
64217cdf47 Lock parser range 2020-02-17 22:03:11 -05:00
Matthew Brown
a6704a1349 Use plugin without strict error 2020-02-14 21:46:55 -05:00
Sergei Morozov
c2972dd759 Allow sebastian/diff 4.0 to be installed
This is required to allow installation of Psalm alongside PHPUnit 9 using Composer.
2020-02-07 10:56:31 -05:00
Matthew Brown
15e15037a0
Drop down semver req 2020-02-03 15:55:24 -05:00
Philip Hofstetter
f6983fd883 allow setting php version from config or composer.json
if a composer.json is present and a PHP version requirement is
configured, we set the php version to the minimal PHP version that
satisfies the composer requirement.

Additionally, this adds a `phpVersion` attribute to the <psalm> tag. If
that's set, it takes precedence over what has been detected in
composer.json.

And finally, the --php-version command line flag continues to work and
takes precedence over the setting in the <psalm> tag

this fixes #2628
2020-01-30 08:48:53 -05:00
Matthew Brown
05f8cfac65 Bump PHPUnit min dep 2020-01-29 08:54:58 -05:00
Scott Arciszewski
dbb630ec91 Allow Psalm to be installed on PHP 8 (#2660)
PHP 8 won't be released until later this year, but it'd be nice to be able to install Psalm without Composer complaining loudly.
2020-01-17 18:11:44 -05:00
Matthew Brown
cfbf0dfcef Bump Symfony console requirements 2020-01-12 11:28:50 -05:00
Andreas Möller
3eebed6c33 Fix: Remove unused friendsofphp/php-cs-fixer (#2603)
Co-authored-by: Matthew Brown <github@muglug.com>
2020-01-12 10:52:33 -05:00
Matthew Brown
fd25829488 Sorting packages in composer.json 2020-01-12 10:43:11 -05:00
Andreas Möller
3cfc2f87f9 Enhancement: Normalize composer.json (#2599) 2020-01-12 10:39:53 -05:00
Matthew Brown
8d9ad338fb Add whitelist of pre-checked extensions 2020-01-01 16:43:36 -05:00
Bruce Weirdan
4110ec351b Make travis green again (#2518)
* Bumped phpspec/prophecy version to prevent 7.4 deprecations

* Fix DOMDocument::$config type

This property was documented as containing DOMConfiguration object, but
in fact always returned `null` (see [php source](ee80567a83/ext/dom/document.c (L542))).

DOMConfiguration class is removed in PHP 8.

* Dropped unused use

* Allow to set PHP 8.0 as current version

* Fix CallMap issues for PHP 8.0

- Use both major and minor version to load deltas
- Don't load non-existent deltas
- Stop at lowest possible delta
2019-12-27 19:06:09 -05:00
Aurélien Delogu
7d5c44ab60 Update composer.json (#2496) 2019-12-21 08:52:46 +00:00
Matthew Brown
02fbf12337 Only warn about clauses in the currently-scanned conditional 2019-12-08 16:35:56 -05:00
Matthew Brown
a82ed91a00 Fix build 2019-12-01 17:18:07 -05:00
Matthew Brown
2c08321603 Ignore union types for now 2019-11-27 00:00:46 -05:00
Matthew Brown
d1fbd1fa26 Add working arrow-functions implementation 2019-11-26 23:52:26 -05:00
Brown
90cb3f4472 Speed up accessing node data
Ref #1837
2019-11-26 17:48:47 -05:00
Brown
ae10e6c130 Add polyfill for spl_object_id 2019-11-25 12:50:48 -05:00
LeSuisse
edeb37207f Allow usage of symfony/console v5 (#2366) 2019-11-22 08:56:40 -05:00
Brown
1b6b8fdba3 Pin PHP Parser to 4.2 for now 2019-11-08 12:18:28 -05:00
SignpostMarv
e9cd7917a4 symfony/process:^4.3 requires php:^7.1.3, adjust dependency constraint to prevent install on < 7.1.3 (#2141)
* symfony/process:^4.3 requires php:^7.1.3, adjust dependency constraint to prevent install on < 7.1.3

* remove 7.1 option
2019-09-18 15:03:12 -04:00
SignpostMarv
849d1e1574 shepherd plugin requires ext-curl (#2131) 2019-09-12 16:41:21 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Ilija Tovilo
67c3726254 Implement signature help - closes #1841 (#1862)
* Implement signature help - closes #1841

* Add explicit signature count

* [LSP] Do analysis for every signatureHelp request

See here: https://github.com/vimeo/psalm/pull/1862#issuecomment-507007346

* Don’t language server information when checking property for init

* Fix signature help for functions

* Add try-catch around signature help Functions::getStorage()
2019-07-01 15:54:32 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Ilija Tovilo
16768e363c Jump between parens when autocompleting method with parameters (#1839) 2019-06-24 07:51:12 -04:00
Barney Laurance
4c57c67e2f Add end to end tests that invoke psalm as a separate process (#1798)
* Add end to end tests that invoke psalm as a separate process

* Assert that psalm --init creates config file
2019-06-16 15:56:00 -04:00
Brown
d1630863ad Fix #1787 - prevent initialisation when nullable isn’t set 2019-06-14 16:53:40 -04:00
Brown
7af21b80a9 Add binary link 2019-06-10 14:01:47 -04:00
Jaik Dean
61203857a0 Require stable version of openlss/lib-array2xml 2019-06-06 07:06:07 -04:00
Matthew Brown
a581b4c443 Build Phar on 7.1 so it doesn’t get php73 polyfill
Fixes #1739
2019-06-04 19:14:12 -04:00
Matthew Brown
99a2d86661 Prevent installation of PHP7.3 polyfill 2019-06-04 01:58:50 -04:00
Gert de Pagter
6d25b1f9a2 Fix whitespace 2019-06-03 08:55:56 -04:00
Matthew Brown
07e74633d6
Add back phpmyadmin dev req 2019-06-01 20:06:36 -04:00
Matthew Brown
8b90f7e93e
Disable paratest 2019-06-01 19:25:59 -04:00
Matthew Brown
385a9b009e Add paratests 2019-06-01 19:08:37 -04:00
Bruce Weirdan
1b0158ad72 Fixed vimeo/psalm#1714 (#1715)
* Fixed vimeo/psalm#1714

Moved `isAbsolutePath()` into a functions file (`src/functions.php`)
that is now automatically loaded by composer autoload.

/cc: @jwage

* Dropped redundant bootstrap
2019-06-01 08:26:22 -04:00
Matthew Brown
a1eb191f57 Remove TSqlSelectString and related dependency 2019-05-20 23:14:41 -04:00
Brown
7708e1c489 Bump PHPUnit version 2019-05-20 13:58:14 -04:00
Brown
0f3385ce95 Use sebastian/diff 2019-05-17 11:26:44 -04:00
Matthew Brown
0d2fc4e774
Bump minimum PHPUnit version 2019-05-16 19:05:27 -04:00
Brown
0bd4dbcbc4 Bump to PHP 7.1
Fixes #1650
2019-05-16 18:36:36 -04:00
Matthew Brown
e08944cae0 Allow diff mode with --find-dead-code 2019-04-27 17:38:24 -04:00
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