1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00
Commit Graph

31 Commits

Author SHA1 Message Date
Sam Mousa
1b5a01dd77
wip: lots of fixes to the callmap 2022-06-14 15:16:13 +02:00
Bruce Weirdan
6540e28e5b
Drop Appveyor reporter as we no longer use Appveyor 2021-08-03 19:38:11 +03:00
Bruce Weirdan
8d78372d43
Use appveyor reporter instead of a file upload (#5438)
* Use appveyor reporter instead of file upload

* Use tagged version of appveyor reporter
2021-03-19 23:25:34 -04:00
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
gdejong
a183aafadc
Migrate PHPUnit configuration (#4710)
Co-authored-by: Gijs de Jong <gijs.de.jong@munisense.com>
2020-11-26 15:23:10 -05:00
Bruce Weirdan
1cf5153700
Test parallelization (#4045)
* Run tests in random order

Being able to run tests in any order is a pre-requisite for being able
to run them in parallel.

* Reset type coverage between tests, fix affected tests

* Reset parser and lexer between test runs and on php version change

Previously lexer was reset, but parser kept the reference to the old
one, and reference to the parser was kept by StatementsProvider. This
resulted in order-dependent tests - if the parser was first initialized
with phpVersion set to 7.4 then arrow functions worked fine, but were
failing when the parser was initially constructed with settings for 7.3

This can be demonstrated on current master by upgrading to
nikic/php-parser:4.9 and running:

```
vendor/bin/phpunit --no-coverage --filter="inferredArgArrowFunction" tests/ClosureTest.php
```

Now all tests using PHP 7.4 features must set the PHP version
accordingly.

* Marked more tests using 7.4 syntax

* Reset newline-between-annotation flag between tests

* Resolve real paths before passing them to checkPaths

When checkPaths is called from psalm.php the paths are resolved, so we
just mimicking SUT behaviour here.

* Restore newline-between-annotations in DocCommentTest

* Tweak Appveyor caches

* Tweak TravisCI caches

* Tweak CircleCI caches

* Run tests in parallel

Use `vendor/bin/paratest` instead of `vendor/bin/phpunit`

* Use default paratest runner on Windows

WrapperRunner is not supported on Windows.

* TRAVIS_TAG could be empty

* Restore appveyor conditional caching
2020-08-23 10:32:07 -04: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
2600e70fb2 Revert PHPUnit column width to default 2020-01-12 10:47:28 -05:00
Andreas Möller
ccfcddfb99 Enhancement: Use color and all the columns (#2602) 2020-01-12 10:44:13 -05:00
Barney Laurance
f5ff9c2fa1 Use local xsd file for PHPunit xml 2019-06-16 09:04:56 -04:00
Barney Laurance
4e3a208ec3 Add circleci config file 2019-06-16 09:04:56 -04:00
Brown
6fa8b986cc Whitelist psalm-refactor.php 2019-06-11 15:30:05 -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
Brown
0bd4dbcbc4 Bump to PHP 7.1
Fixes #1650
2019-05-16 18:36:36 -04:00
Jonathan H. Wage
ecb7a6c069 Add support for absolute plugin paths. 2019-05-05 16:44:36 -04:00
Matthew Brown
fea61d9897 Shepherd plugin is basically not testable 2019-03-31 19:51:47 -04:00
Matthew Brown
63a0e768b3 Improve type coverage in both good and bad ways 2019-03-25 22:30:40 -04:00
Matthew Brown
6ed8bb871d Fix codecoverage refs 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
5f332fc951 Ignore new binary 2018-10-18 15:33:35 -04:00
Brown
54fdda651b Add server mode support with error reporting only 2018-10-17 15:54:31 -04:00
Brown
fb801825a1 Test issue position adjustment 2018-09-30 11:34:51 -04:00
Matthew Brown
5b23911e9e Allow tests to not test anything
Because they’re testing that no exception is thrown
2018-01-22 00:27:22 -05:00
Matthew Brown
157c575a96 Add two more files to be excluded in code coverage 2018-01-16 22:20:53 -05:00
Sebastian Bergmann
bc2f4f0184 Update PHPUnit configuration to follow best practices 2018-01-09 01:14:38 -05:00
Matt Brown
1d91f6efad Fix #429 - allow test suite to run with xdebug enabled 2018-01-08 10:43:46 -05:00
Matthew Brown
d964f96439 Add test that analyses a class with a mapped property 2017-12-30 10:42:06 -05:00
Matthew Brown
8efc939a5f Move Psalm execution code into PHP file that Psalm can analyse 2017-12-29 17:02:56 -05:00
Matthew Brown
ec88c858c3 Exclude Issues directory from code coverage 2017-12-14 01:20:35 -05:00
Matthew Brown
6c735b7699 Make coverage work proper good 2017-12-14 01:10:20 -05:00
SignpostMarv
3c0053d431 move phpunit config to phpunit.xml.dist to allow tinkering 2017-04-11 21:01:21 +01:00