AndrolGenhald
5c01913456
Remove deprecated loadXdebugStub attribute.
2022-01-27 16:55:20 -06:00
AndrolGenhald
c2b44ff073
Fix copy/paste fail and other psalm/cs issues, reduce duplication of literals.
2022-01-27 16:31:09 -06:00
AndrolGenhald
8132b57881
Add XML config options to enable/disable PHP extensions.
2022-01-27 16:31:05 -06:00
AndrolGenhald
2fe4fc397c
Enable extensions based on composer.json instead of those loaded at runtime ( fixes #5482 ).
2022-01-27 16:30:14 -06:00
orklah
9168cef2d4
Merge remote-tracking branch 'upstream/4.x' into upstream-master6
2022-01-26 21:06:25 +01:00
orklah
7c8441baec
Merge pull request #7123 from AndrolGenhald/feature/942-type-annotate-class-constants
...
Support type annotations for class consts (fixes #942 ).
2022-01-25 20:54:40 +01:00
Bruce Weirdan
3a6dc9b458
Merge pull request #7431 from zoonru/disable_suppress_all
2022-01-24 11:25:32 +02:00
orklah
7c4f08067b
Merge remote-tracking branch 'upstream/4.x' into upstream-master5
2022-01-23 23:44:04 +01:00
AndrolGenhald
558208e44e
Add type checking for class const assignments, fix several other const issues.
2022-01-22 17:06:54 -06:00
AndrolGenhald
01868a9766
Mark loadXdebugStub as deprecated (removed in #7107 ).
2022-01-22 16:03:35 -06:00
m1ke
1b8f337748
Allow psalm to load threads from the config
2022-01-20 09:49:45 +00:00
orklah
5a6dccd4a9
Merge pull request #7420 from orklah/remove-old-things
...
Remove forbidEcho
2022-01-19 20:32:19 +01:00
4cfe1a0773
Add configuration option to disable @psalm-suppress all
2022-01-19 13:24:26 +01:00
orklah
477c0113c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master3
2022-01-18 18:37:04 +01:00
orklah
5f749c8a33
remove forbidEcho
2022-01-18 18:14:39 +01:00
Fabien Villepinte
c9eafa15ad
Improve signature of DOMDocument::loadXML()
2022-01-17 22:52:58 +00:00
orklah
b633619a2c
Merge remote-tracking branch 'upstream/4.x' into upstream-master
2022-01-14 21:01:25 +01:00
orklah
d786e9deef
deprecate attribute forbidEcho
2022-01-14 19:31:03 +01:00
orklah
af37af7d8c
Merge pull request #7242 from zoonru/seal_all_properties
...
PHP 8.2: seal all properties configuration
2022-01-10 21:36:31 +01:00
b530f23acc
PHP 8.2: seal all properties by default, add configuration key for lower versions
2022-01-10 10:11:28 +01:00
Wouter de Jong
e4e9edda27
Support multiple <issueHandlers> elements
...
This is likely to occur when including multiple Psalm config files.
2022-01-09 14:11:03 +01:00
Bruce Weirdan
1a1b5a9e6a
Merge branch '4.x' into upstream-master
2022-01-08 23:38:29 +02:00
Stefan Vetsch
7f2f0d99ec
Issue #7243 : Do not throw exception on xinclude with fallbacks
2022-01-07 09:40:19 +01:00
Bruce Weirdan
8726065d21
Applied ClosureToArrowFunctionRector
2022-01-06 00:48:04 +02:00
Bruce Weirdan
94395f18a4
Applied JsonThrowOnErrorRector
2022-01-05 19:32:43 +02:00
Bruce Weirdan
5758d31161
Apply literal number separator rector
...
I opted for customary 3-digit groups, except version id, where 2-digit
groups are used to match the version id encoding.
2022-01-05 01:00:05 +02:00
Bruce Weirdan
02b91cc54e
Replaced deprecated webmozart/path-util
2022-01-04 15:15:34 +02:00
Bruce Weirdan
55eb4b018b
Dropped removed config entries
2022-01-03 12:41:17 +02:00
Bruce Weirdan
966b6ae2b2
Merge pull request #6808 from orklah/exitFunctions3
2022-01-03 06:04:01 +02:00
Bruce Weirdan
f19e4cedc1
Merge pull request #6705 from orklah/phpstorm-generics-removal
2022-01-03 06:03:36 +02:00
orklah
b658b2738f
remove exitFunctions
2022-01-02 15:20:01 +02:00
orklah
4f7c1d05c1
remove support for allowPhpstormGenerics
2022-01-02 15:06:04 +02:00
orklah
8d6b781b3e
use consistent way to compare php version
2022-01-02 13:35:43 +02:00
edc797d1c2
Add docs
2021-12-30 11:56:16 +01:00
ralila
6ee3d44092
Conversion of misc
2021-12-14 02:52:44 +01:00
ralila
c0adde8f45
Conversion of Psalm\CodeLocation\DocblockTypeLocation|Raw
2021-12-14 02:31:26 +01:00
ralila
e06d4ab5ac
Conversion of Psalm\Exception\*Exception
2021-12-14 02:31:26 +01:00
AndrolGenhald
bfe7f96b56
Allow suppressing UnusedPsalmSuppress, remove unused suppressions.
2021-12-11 13:23:00 -06:00
AndrolGenhald
b29fc6ad3c
Allow operator overloading for Decimal extension ( fixes #3938 ).
2021-12-08 10:59:37 -06:00
rarila
39402c233d
Return type hints ( #7065 )
...
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
f833085a15
Fix fqn usage in php-doc
2021-12-04 03:37:19 +01:00
ralila
30a65685a2
Import instead of using fqn classes
2021-12-03 21:40:18 +01:00
ralila
7c32325e03
Import instead of using fqn constants
2021-12-03 21:25:22 +01:00
ralila
2a956498bf
Import instead of using fqn functions
2021-12-03 21:07:25 +01:00
ralila
245920e53c
Import instead of using fqn
2021-12-03 20:11:20 +01:00
Bruce Weirdan
d19aad7db1
Display target PHP version
...
Historically it was often not quite clear to users what PHP version
Psalm assumes, and why. This PR addresses this issue by printing the
version and where we got it from right before scanning the files.
2021-11-27 02:18:09 +02:00
Kamil Tekiela
d922808e8f
Create mysqli.phpstub
...
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-24 22:30:22 +00:00
AlessandroMinoccheri
ddc13a0dba
using lenght istead of count for php 7.1 compatibility
2021-11-23 21:32:55 +01:00
Bruce Weirdan
01d07f9392
Report deprecated elements
2021-11-14 04:55:28 +02:00
orklah
1464e8f91e
make ignore falsable/nullable dependent on the config
2021-11-13 11:37:22 +01:00
sasezaki
5a01c8d601
Added phpcs SelfMemberReference rule, and applied
2021-11-07 15:47:39 +09:00
orklah
3503f198a6
add deprecated tags to the array
2021-11-04 00:39:09 +01:00
orklah
1288d49130
add SimpleXMLIterator to universalObjectCrates
2021-10-18 21:59:17 +02:00
orklah
ef7e6cdf01
allow Psalm to choose PHP8.1 if it's the lower PHP version allowed
2021-10-14 16:54:27 +02:00
orklah
8660f68007
Merge pull request #6519 from gmessier/advanced-issue-handlers
...
Add support for advanced IssueHandler in plugins
2021-10-04 09:47:59 +02:00
orklah
430fd619ec
cleanup
2021-10-04 00:23:53 +02:00
orklah
ab6efe49b2
fix CS
2021-09-26 23:41:26 +02:00
orklah
38dac34846
unnecessary null initialization
2021-09-26 23:34:32 +02:00
orklah
c91bdfb689
old casts
2021-09-26 23:34:32 +02:00
orklah
72eab30a3a
coalesce operator
2021-09-26 23:34:31 +02:00
orklah
46801c4b98
clearer string operations
2021-09-26 23:34:31 +02:00
Guillaume Messier
c9db2dfb53
Merge branch 'master' of https://github.com/gmessier/psalm into advanced-issue-handlers
2021-09-24 12:48:12 +00:00
orklah
c74e81ca8f
fix build
2021-09-23 19:29:15 +02:00
Guillaume Messier
666367fbd5
Add unit test
2021-09-23 15:30:30 +00:00
Guillaume Messier
97a3f54164
Add support for advanced IssueHandler in plugins
2021-09-22 14:56:07 +00:00
Tyson Andre
3486490080
Use different psalm cache for different error levels
...
Fixes #4952
2021-08-06 12:46:15 -04:00
orklah
58dd3f6f94
change wording
2021-07-20 23:53:04 +02:00
orklah
acfdb82856
Basic implementation
2021-07-20 23:34:38 +02:00
Joshua Behrens
0c6031f7f2
Use same working directory for preparing cache directory as it used in running analysis
2021-07-17 01:55:41 +03:00
Bruce Weirdan
e552925af6
Emit separate type of issue when foreach value is unused ( #5932 )
...
* Emit separate type of issue when foreach value is unused
Fixes vimeo/psalm#5929
* Fixed var name case sensitivity
2021-06-17 00:40:24 -04:00
Matt Brown
47bf5ed567
Fix #5918 - add new issue to detect unquoted strings
2021-06-10 17:43:04 -04:00
Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00
Matthew Brown
7301e3a35f
Fix redundant cast
2021-06-07 13:19:00 -04:00
Bruce Weirdan
86050df4d0
Formally deprecate allowCoercionFromStringToClassConst
( #5897 )
...
* Mark allowCoercionFromStringToClassConst as deprecated in xml schema
* Emit deprecation warning for `allowCoercionFromStringToClassConst`
2021-06-07 10:46:26 -04:00
Oliver Hader
e457a7d5af
[FEATURE] Allow plugins to declare their custom scanner or analyzer ( #5883 )
...
* [FEATURE] Allow plugins to declare their custom scanner or analyzer
Related: #5882
* [TEST] Check plugin declaring own scanner/analyzer
* [TASK] Document plugins declaring scanner or analyzer
* [TEST] Clean up code
* [!!!][TASK] Extend Psalm\Plugin\RegistrationInterface
* add method `addFileTypeScanner(string $fileExtension, string $className): void`
* add method `addFileTypeAnalyzer(string $fileExtension, string $className): void`
* [TASK] Ignore IntelliJ/PhpStorm workspace folder in VCS
* [TASK] Remove superfluous class import
2021-06-04 15:32:53 -04:00
Fran Moreno
e89f7e3960
Add mongodb Cursor and CursorInterface stubs and fix WriteConcern::__construct ( #5813 )
...
* Add mongodb Cursor and CursorInterface stubs
* Use proper variable name
* Update WriteConcern constructor
Based on https://www.php.net/manual/es/mongodb-driver-writeconcern.construct.php
2021-05-22 19:03:07 -04:00
Matthew Brown
832a190dd4
Support enums ( #5699 )
...
* Add initial enum preparation
* Support cases method
* Ignore bad use error
cc @weirdan
* Fix type
2021-05-03 17:54:09 -04:00
Bruce Weirdan
105c6f3a1c
Remove (and prevent) unused uses ( #5704 )
...
* Updates `slevomat/coding-standard`
* Removes unused uses
* Prevents unused uses
* Fixes a number of symbol case mismatches
2021-05-03 17:22:15 -04:00
Matt Brown
ece138562f
Fix too-long line
2021-03-30 18:39:51 -04:00
Martin Gold
667568d925
Double directory separator on "Cannot resolve stubfile path" ( #5509 )
...
* fix: double directory separator on invalid stubfile path
* fix: non-existing stubfile error message
2021-03-30 11:55:33 -04:00
Matt Brown
d4377c0baf
Check upper bound too
2021-03-28 23:54:38 -04:00
Matt Brown
2d197e3e12
Allow older composer/semver cc @xurizaemon
2021-03-28 23:45:52 -04:00
Matt Brown
9f3f420a5b
Turn on unused variable detection by default on level 1
2021-03-22 09:44:40 -04:00
AndrolGenhald
45694d37d4
Fix composer major.minor version detection ( fixes #5415 ) ( #5416 )
...
* Fix composer major.minor version detection (fixes #5415 )
* Add PHP 8 polyfill dependency.
* Fix version check.
2021-03-18 09:42:01 -04:00
Matt Brown
c05a3ea073
Break up CoreGenericClasses
2021-03-06 16:05:14 -05:00
Vincent Langlet
a80d5b736b
Rename stub to avoid phpstorm conflict ( #5213 )
2021-02-13 18:42:34 -05:00
orklah
0e17a3354f
add stubs for standard iterators ( #4725 )
...
* add stubs for standard iterators
* Apply suggestions from code review cc @weirdan
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
* complete stub + delete code made redundant by stubs + fix some syntax in stubs
* fix parse error
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-01-07 10:07:07 -05:00
orklah
f9fccb2b2d
implement DTO for plugins ( #4881 )
...
* implement DTO for plugins
* introduce EventHandler + reintroduce legacy API for plugins
2021-01-06 09:05:53 -05:00
orklah
09fb141e49
Document lowercase-string when possible ( #4904 )
...
* document lowercase-string
* fix missing strtolower
2020-12-29 11:42:12 +00:00
Matt Brown
387ab14bda
Use better stubs for Serializable and SoapClient
2020-12-08 11:27:51 -05:00
Matt Brown
1a629ccc82
Fix a few issues
2020-12-01 18:26:15 -05:00
Matt Brown
b717356f95
Simplify more things
2020-11-27 17:48:39 -05:00
Markus Staab
d393b4a69d
Added PDOStatement->fetchObject() stub ( #4693 )
...
* Added PDOStatement->fetchObject() stub
* fix stub param
* fix Xdebug spelling
* Use extension_loaded check instead
Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-25 12:08:04 -05:00
Markus Staab
3dc311fd45
fixed exception message ( #4692 )
2020-11-24 16:04:34 -05:00
Matt Brown
2c77424e16
Fix #4656 - separate UnusedConstructor from UnusedMethod
2020-11-22 11:48:17 -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
854a5b2ec5
Allow TaintedInput to suppress all emitted issues
2020-11-17 16:08:05 -05:00
Matt Brown
b731b53d5e
Add debug stuff for code complexity
2020-11-10 12:49:42 -05:00
Matt Brown
388e804ed8
Allow opt-in to strict return type checking
2020-11-05 18:20:04 -05:00
Matt Brown
cbd09adb2a
Only load xdebug stub afterwards
...
Ref #4459
2020-10-30 15:11:40 -04:00
Matt Brown
579327a470
Detect when targets are incorrectly targeted
2020-10-30 13:28:45 -04:00
Matt Brown
82f35c1454
Ensure Stringable is always available to tests that need it
2020-10-29 19:41:10 -04:00
Matt Brown
2e95d1fb98
Use more robust check for Stringable stub
2020-10-29 14:15:35 -04:00
Matt Brown
0344ff6858
Add polyfill for Stringable interface
2020-10-28 00:55:53 -04:00
Matt Brown
d58642a982
Maintain old behaviour when file does not exist
2020-10-25 16:38:58 -04:00
Matt Brown
2ea41b245c
Fix output in tests (for non-existent files)
2020-10-25 16:31:42 -04:00
Matt Brown
b26983cc34
Fix #4410 - use better path normalisation
2020-10-25 16:18:05 -04:00
feek
cc684eeccd
feature: ensure universal object crate class exists ( #4375 )
2020-10-20 17:17:49 -04:00
orklah
ceaaa39ec3
improve phpdoc ( #4352 )
2020-10-17 12:36:44 -04:00
Matt Brown
f3b05f5ab5
Move static code out of src
2020-10-12 00:59:19 -04:00
feek
8d2db4e673
feature: universal object crates ( #3948 )
...
* feature: universal object crates
* docs: document universal object crate config option
Co-authored-by: Matthew Brown <github@muglug.com>
2020-10-07 09:56:21 -04:00
Matt Brown
377dc8da8f
4.x - change/remove some default config values
2020-10-05 10:08:41 -04:00
Matt Brown
d5f4fd5b9c
4.x - don’t skip checks on unresolvable includes
2020-10-05 09:57:54 -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
1a1b88bb5e
add visibilities to constants ( #4219 )
2020-09-20 12:54:46 -04:00
orklah
a9a364e363
Misc improvements ( #4216 )
...
* misc changes
* fix CI
2020-09-20 08:55:28 -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
5db75dfbf2
align default value with documentation ( #4188 )
2020-09-17 21:40:19 -04:00
Bruce Weirdan
cd110c7e2f
Added @psalm-stub-override
for classlikes and methods ( #4177 )
...
Fixes vimeo/psalm#1252
2020-09-13 16:40:31 -04:00
orklah
da47588f91
replace return;
by return null;
in every non-void method, add return null;
when mising, add return types, remove redundant phpdoc ( #4176 )
2020-09-13 16:39:06 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
6ffe471525
Make new InvalidLiteralArgument issue for strpos refs
...
Ref #4070
2020-09-10 22:54:32 -04:00
Brown
fe4af8ff1a
Minor fixes
2020-09-07 17:22:43 -04:00
Brown
a83c0fe21a
Fix signature
2020-09-07 16:44:09 -04:00
Wouter Sioen
f3d3ef9074
Add consistent array type for predefined constants ( #4151 )
...
When running psalm through https://github.com/Roave/infection-static-analysis-plugin , you get a lot of warnings
```
Warning: array_key_exists() expects parameter 2 to be array, null given in /Users/woutersioen/Sites/madewithlove/htaccess/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Sta
tements/Expression/Fetch/ConstFetchAnalyzer.php on line 124
```
This is because the config is instantiated without calling the collectPredefinedConstants method, thus making this a null value.
By adding a default value, we make it not required to call this method before running psalm.
2020-09-07 10:54:29 -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
the-toster
e296abbabf
Add option to show link to source in console output ( #4085 )
...
* add option to change console output for PhpStorm suitable format, so filenames become links, closes #3271
* fix code style
* rename option to php-storm-format
* replace flag with new report format
* fix code style
2020-09-04 16:24:14 -04:00
Brown
6f92846fd6
Make reportInfo="false" flag better
2020-09-01 18:09:57 -04:00
orklah
c6ea274180
Config reportInfo to speed up analysis for big projects ( #4095 )
2020-09-01 09:22:05 -04:00
Bruce Weirdan
aa09a1c780
Use per-user cache folder ( #4098 )
...
Fixes vimeo/psalm#3869
2020-09-01 09:20:24 -04:00
Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Brown
c13b0efd49
Improve understanding of negated count queries
2020-08-30 11:32:01 -04:00
Matthew Brown
ef0486ce35
Add some pure annotations
2020-08-23 13:52:31 -04:00
Michel Hunziker
3538fe1955
Add configuration attribute to find unused @psalm-suppress ( #4041 )
2020-08-22 10:01:26 -04:00
Matthew Brown
72ecb57def
Improve names of things
2020-08-14 00:27:33 -04:00
Brown
209d17c868
Fix #2891 - treat autoloaded constants better
2020-08-13 09:14:27 -04:00
Brown
6def99d653
Add ConstructorSignatureMismatch issue distinct from MethodSignatureMismatch
2020-08-10 12:26:25 -04:00
lhchavez
ab3016af6e
Fix File-related analysis plugin hooks ( #3970 )
...
This change does a few things:
* Renames `BeforeAnalyzeFileInterface` to `BeforeFileAnalysisInterface`.
* Adds a few more parameters to `BeforeFileAnalysisInterface`.
* Since the analysis was never called due to a bug, the above two
changes are safe to do.
* Fix the above-mentioned bug, and now adds the hooks to the config.
* Update the documentation about the File-related analysis plugin hooks.
* Add a test to ensure that this does not break again in the future.
Fixes : #3969
2020-08-10 10:49:53 -04:00
Matthew Brown
6085e42fc1
Detect mismatching param names effectively
2020-08-10 09:58:43 -04:00
Brown
488a899823
Fix Psalm issues
2020-08-05 19:49:09 -04:00
Nat Zimmermann
a1a403e046
make meta path optional ( #3833 )
2020-07-17 10:09:42 -04:00
kesselb
aaba3a08ec
Add option to supress a referenced but undefined global variable. ( #3827 )
2020-07-16 09:49:59 -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
Joe Hoyle
0119cd09c1
Always deep scan stubs ( #3781 )
...
In many sitations, stub files will receive a shallow _and_ deep scan when project files require extra analysys on things like parent classes. This makes stub file scanning inconsistent (orders become much less predictable for example), and adds extra process time to scan the files twice. In the case of stubs providing classes and functions for large projects, this is a non-trivial amount of time.
As deep scanning stubs should take just about as long as a shallow scan, it makes sense to just always deep scan them.
Fixes #3568 .
2020-07-08 17:42:51 -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
fbe3433edd
Use escape terminology
2020-06-21 11:43:08 -04:00
Brown
078b8b7b1a
Fix #3618 - add way to load non-analyzed files
2020-06-19 00:13:09 -04:00
Olle Härstedt
e1cc27f7a2
Add new config: sealAllMethods ( #3578 )
...
* Add new config: sealAllMethods
* Add some more tests
* Fix codesniffer issue with preg_quote
* Fix missing method in test
Co-authored-by: Olle <noemail>
2020-06-15 22:36:42 -04:00