1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 17:27:28 +01:00
Commit Graph

189 Commits

Author SHA1 Message Date
Bruce Weirdan
448534fd7c
Cli command classes (#5858)
* Move psalm entry-point to a Cli command class

* Moved psalter to the CLI command class

* Moved psalm-language-server to the CLI command class

* Moved psalm-refactor to the CLI command class

* Moved psalm_plugin to the CLI command class

* Use CLI commands directly and deprecate trampolines

* Require CLI commands directly and don't use trampolines

* Announce isAbsolutePath() removal

* Deprecate \Psalm\requireAutoloaders() function

* Deprecate \Psalm\getVendorDir() function

* Deprecate Psalm\getArguments() function

* Deprecate \Psalm\getPathsToCheck() function

* Deprecate \Psalm\getPsalmHelpText() function

* Deprecate \Psalm\initialiseConfig() function

* Deprecate Psalm\update_config_file() function

* Deprecate \Psalm\get_path_to_config() function

* Deprecate Psalm\getMemoryLimitInBytes() function

* CS fix

* Untangle Psalm entrypoint

* Untangle Psalter entrypoint

* Drop command_functions.php references

* Adjust phar build
2021-05-31 22:23:54 -04:00
orklah
276d355ebb
fix issue reporting when baseline already exists (#5838) 2021-05-28 09:43:15 -04:00
Bruce Weirdan
97fe86c4e1
Fix BC break introduced in 4.6.3 (#5410)
Fixes vimeo/psalm#5405

Requires new patch release.

This PR reverts changes to the signature of `IssueBuffer::finish()` and
introduces separate method to be used to capture `$_SERVER`
2021-03-16 19:28:18 -04:00
Bruce Weirdan
205fdd197e
Wrap entrypoints into IIFE to protect their variables (#5366)
* Wrap entrypoints into IIFE to protect their variables

Fixes vimeo/psalm#5359

* Add tests for Psalm variable isolation

* Capture environment before registering autoloader
2021-03-11 00:14:22 -05:00
Bruce Weirdan
26978fcea1
Convert PHP errors / warnings / notices to exceptions (#5260)
* Sort uses

* Add ErrorHandler

* Use new error handler

* Drop old exception handler

* Suppress error-triggered exceptions during external autoload calls
2021-02-22 09:19:34 -05:00
Adrien LUCAS
6f1f680b2d
Add option to dump taint graph (#5080)
* Add option to dump taint graph

* Fix types

* Simplify types

Co-authored-by: Matthew Brown <github@muglug.com>
2021-01-22 16:04:15 -05:00
Bruce Weirdan
c2a324e610
Use composer autoloader during init (#5054)
Fixes vimeo/psalm#5048

The issue was caused by missing dependency of a class that Psalm tried
to inspect through reflection. Fixed by using composer autoloader which
avoids the need to use reflection.
2021-01-19 17:21:33 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Matt Brown
23ab0f1ddb Allow Psalm to run in taint analysis mode without a config 2020-11-20 19:02:44 -05:00
Matt Brown
1708bae984 Taint analysis should always run fully 2020-11-17 17:59:05 -05:00
Matt Brown
a3856c3734 Change working dir after getting paths 2020-10-25 09:46:49 -04:00
Matthew Brown
9135f8e865
4.x (#4363)
* Enable --diff mode by default

* Bump required version
2020-10-18 23:28:05 -04:00
orklah
10f2966dcb
return types (#4311)
* return types

* remove willReturn for void methods
2020-10-12 15:02:52 -04:00
Saif Eddin G
0475f379aa
add support for 'COMPOSER' env variable for alternate name of 'composer.json' (#4275) 2020-10-03 02:26:37 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -04:00
orklah
b19f0a7034
Remove empty() and use strict comparison when safe (#4211)
* replace empty usage with stricter checks

* use strict comparison when safe

* replace is_null with === null for consistency
2020-09-19 18:26:51 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
orklah
8c7423505a
add native param types (#4137)
* add native param types

* redundant phpdoc

* add more param types and adds "?" to nullable types

* remove redundant phpdoc

* add more param types and remove redundant phpdoc

* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00
orklah
f66d57f19d
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
Michel Hunziker
3538fe1955
Add configuration attribute to find unused @psalm-suppress (#4041) 2020-08-22 10:01:26 -04:00
feek
ec7876b8d6
feature: allow specifying memory limit (#3947) 2020-08-06 08:51:57 -04:00
Brown
6919e88423 Add performance logging under a --debug-performance flag 2020-07-30 15:30:19 -04:00
Brown
1e01e90fba Namespace base files 2020-07-22 15:57:24 -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
Jon Ursenbach
6aca4c169e
feat: adding a runTaintAnalysis option into the config (#3800) 2020-07-10 13:22:03 -04:00
Tyson Andre
80e46cdb13
Support generating multiple report files (#3776)
E.g. `psalm --report=report.txt --report=report.pylint`.
It may be useful to have both a machine-readable and human readable
report, e.g. during taint analysis.

Previously, psalm would generate neither report if the report option was
repeated.
2020-07-08 15:08:17 -04:00
Brown
8404fa0750 Allow use of a different baseline
Ref #3672
2020-06-25 17:31:03 -04:00
Tyson Andre
bee10a2eb4
Add a --debug-emitted-issues flag (#3637)
And support --debug-by-line in psalter and psalm-refactor.
Those were previously not supported in getopt()

Fixes #3634
2020-06-22 18:16:47 -04:00
Brown
81e2745cf1 Add more options 2020-06-22 11:24:38 -04:00
Mark Sch
9aa46221f6
Use pretty print for JSON reporting. (#3364)
* Use pretty print for JSON reporting.

* Use pretty print for JSON reporting.

* Use pretty-print option on CLI for BC.

* Change static:: const to self::

Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-18 08:40:20 -04:00
Markus Staab
3f3a2267ea
send php native warnings/errors/notices on stderr instead of stdout (#3355) 2020-05-12 20:44:09 -04:00
Brown
370ffa28e4 Fix #3117 - invalidate all caches when composer lockfile changes 2020-04-12 11:41:37 -04:00
Brown
ee50542b8f Allow users to disable caching full files 2020-04-12 08:34:57 -04:00
Brown
4ef7cb50a5 Make Psalm faster when there aren’t any changes whatsoever 2020-03-31 22:22:34 -04:00
Brown
53612d0df6 Make --diff imply --diff-methods 2020-03-26 18:14:54 -04:00
Matthew Brown
7f9e6b893e Increase processor consumption 2020-03-06 13:13:18 -05:00
Matthew Brown
d3f8e80c4a Move reference map generation into separate file 2020-02-23 14:53:31 -05:00
Matthew Brown
320f3ec863 Update level config name 2020-02-17 22:43:13 -05:00
Matthew Brown
e48d2aef9c Improve handling when threads cannot be used 2020-02-17 22:06:36 -05:00
Matthew Brown
ced092874a Make config generation smarter 2020-02-17 22:05:58 -05:00
Matthew Brown
4e36f6caf5 Add explicit paths for included files
Fixes #2757
2020-02-07 09:06:15 -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
Brown
6b43c41ea3 Add file-defined functions 2020-01-08 17:40:50 -05:00
Brown
7482b9e56f Emit all stubs discovered by Psalm during analysis
Fixes #827
2020-01-08 17:23:40 -05:00
Tyson Andre
b713066d32 Add an exception handler that prints full exception trace (#2418)
By default, php will only print the first few thousand bytes of the
exception, for an uncaught exception
(I think that's the default, and not just my configuration)

Instead, print all of the parts of the exception.

For #1083 (this PR does not cover set_error_handler)
2019-12-04 23:17:08 -05:00
Matthew Brown
f667dee4f5 More logging 2019-12-03 00:06:00 -05:00
Matthew Brown
260b73ce78 More logging 2019-12-02 23:59:01 -05:00
Brown
821f3528d2 Fix #701 - indicate issues fixable with Psalter 2019-12-02 15:24:01 -05:00
Matthew Brown
952484c64d Add workaround for pcre.jit bug 2019-11-30 08:26:26 -05:00
Tyson Andre
6bc152e2da Use the long progress bar for CI logs (#2364) 2019-11-22 08:56:18 -05:00