1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-09 14:38:37 +01:00
Commit Graph

9415 Commits

Author SHA1 Message Date
orklah
27798e69a0
Merge pull request #9970 from kkmuffme/missing-composer-lock-should-not-invalidate-cache-created-with-missing-composer-lock
Missing composer lock should not invalidate cache created with missing composer lock
2023-07-03 21:42:47 +02:00
orklah
a83c3fe325
Merge branch 'master' into missing-composer-lock-should-not-invalidate-cache-created-with-missing-composer-lock 2023-07-03 21:02:00 +02:00
orklah
9575bc319c
Merge branch 'master' into fix/9968-exhume-enum 2023-07-03 20:59:26 +02:00
orklah
3e54feb9b4
Merge pull request #9964 from ygottschalk/fix/phpparser-deprecation-name-parts
Fix/phpparser deprecation name parts
2023-07-03 20:59:09 +02:00
Yannick Gottschalk
e819a608fb Added issue suppression 2023-07-03 10:40:54 +02:00
Yannick Gottschalk
42b3736c39 Fixed psalm self test 2023-07-03 10:28:16 +02:00
Yannick Gottschalk
1787960027 Fixed exhuming enums as enums, not as classes 2023-07-03 09:57:14 +02:00
orklah
8d1876a8a3
Merge pull request #9981 from kkmuffme/fix-replace-functions-return-type-provider-less-specific
fix mixed replace return types for arrays
2023-07-02 12:59:01 +02:00
orklah
53ce62bf28
Merge pull request #9975 from kkmuffme/sprintf-single-arg-splat-array
Fix sprintf single arg splat array
2023-07-02 10:08:08 +02:00
kkmuffme
0377dd9eda code style 2023-07-02 09:45:55 +02:00
kkmuffme
d24df1a077 improve config validation and fix wrong condition 2023-07-02 09:00:53 +02:00
kkmuffme
7593b5bdc6 more code style and shepherd 2023-07-02 08:42:05 +02:00
kkmuffme
c2388b4d90 fix failing tests and shepherd 2023-07-02 08:33:43 +02:00
Roland Franssen :)
b525f9cf70
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY 2023-07-01 17:01:49 +02:00
Roland Franssen :)
bf31ffbd92
Update Psalm.php 2023-07-01 16:56:33 +02:00
Roland Franssen :)
f07cdfc129
Update Psalm.php 2023-07-01 16:50:25 +02:00
Roland Franssen :)
33b0693c4f
ugh 2023-07-01 16:47:16 +02:00
Roland Franssen :)
010306fda8
Update Psalm.php 2023-07-01 14:00:12 +02:00
Roland Franssen :)
ce9d9db115
Update Psalm.php 2023-07-01 13:54:15 +02:00
Roland Franssen :)
52c629c331
infer --debug in GHA 2023-07-01 13:48:58 +02:00
Roland Franssen :)
8ed4f94988
Infer output format from GITHUB_ACTIONS env
aka --output-format=github
2023-06-30 21:45:11 +02:00
kkmuffme
09a3b4b32c code style 2023-06-30 17:14:13 +02:00
kkmuffme
26eb870e47 fix mixed replace return types for arrays
* remove useless replace return type provider code that returned incorrect type for array replacements and was worse duplicate of existing stubs
* require preg patterns to be non-empty-strings as otherwise it will throw a PHP notice
* improve return type of array replacements to be more correct (not fully correct due to https://github.com/vimeo/psalm/issues/5994#issuecomment-1614601590)
2023-06-30 17:08:03 +02:00
kkmuffme
62475cb4e8 code style 2023-06-29 14:42:23 +02:00
kkmuffme
2dd26cb0f1 Fix sprintf single arg splat array
Fix https://github.com/vimeo/psalm/issues/9873#issuecomment-1612901224
2023-06-29 13:47:42 +02:00
Yannick Gottschalk
5a2f7c0a71 Use getParts() instead of $parts on PhpParser\Node\Name.
also use getFirst(), getLast() and getString()
2023-06-28 03:13:25 +02:00
kkmuffme
b877aa7096 misc consistency improvements for cache 2023-06-27 23:23:18 +02:00
kkmuffme
0584339657 if cache was created with missing composer.lock file use it too instead of ignoring it 2023-06-27 23:16:06 +02:00
Yannick Gottschalk
f93d23899d Fix glob CallMap and stub to prevent crash on alpine (and possibly other systems) 2023-06-25 13:17:13 +02:00
kkmuffme
d4dcee3203 code style 2023-06-24 18:11:15 +02:00
kkmuffme
0535c6b877 PHP 7 format with only placeholders isn't falsable if valid
limit tests to PHP 8 to avoid having to create them twice and add specific test for Issue 9941
2023-06-24 18:11:15 +02:00
kkmuffme
c5fee532f3 consistently ignore falsable return, remove unused suppress with new types 2023-06-24 18:11:15 +02:00
kkmuffme
7f0217d1e3 fix incorrect default stubs 2023-06-24 18:11:15 +02:00
kkmuffme
28b9e8dd95 run format checks for splat too 2023-06-24 18:11:15 +02:00
kkmuffme
9599c240b3 code style 2023-06-24 18:11:15 +02:00
kkmuffme
52ca871057 fix try/catch variable must be initialized 2023-06-24 18:11:15 +02:00
kkmuffme
fad17686bd Fix false positive for array unpacking
Fix https://github.com/vimeo/psalm/issues/9873
2023-06-24 18:11:15 +02:00
kkmuffme
f2a9e09136 reorganize code for PHP 7 to also check for invalid argument and reduce duplicate 2023-06-24 18:11:15 +02:00
kkmuffme
151f101f7c fix PHP 7 sprintf too many arguments false positive
Fix https://github.com/vimeo/psalm/issues/9941
2023-06-24 18:11:15 +02:00
Tinjo Schöni
a737ca8072
Consider a property type change as a signature change 2023-06-24 15:31:15 +02:00
Tinjo Schöni
1b1915eaf5
Make file storage cache handling consistent 2023-06-24 14:29:28 +02:00
Tinjo Schöni
9939cae52d
Support project analysis with file diffing in tests 2023-06-24 14:29:28 +02:00
Maximilian Bösing
f482a5cb31
bugfix: pass non-empty information when reconciling iterable
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-06-23 21:15:37 +02:00
orklah
01e2ac78d4
Merge pull request #9950 from orklah/iterableInt
fix reconciliation between a list and iterable
2023-06-22 23:45:39 +02:00
orklah
8929f8b4d8 fix reconciliation between a list and iterable 2023-06-22 23:37:40 +02:00
orklah
bb28c5aa64
Merge pull request #9932 from ygottschalk/fix/cache-fail-silent
Fix/cache fail silent
2023-06-21 21:09:56 +02:00
orklah
03b91561a7
Merge pull request #9935 from ygottschalk/fix/cache-config-warnings
Make config warn about missing cache related functions
2023-06-21 21:08:39 +02:00
Yannick Gottschalk
dbc4f48e2b Make config warn about missing cache related functions 2023-06-20 12:40:08 +02:00
Yannick Gottschalk
503c38df03 Make cache writes fail silent 2023-06-20 11:54:05 +02:00
Yannick Gottschalk
66848306f9 Make cache fail silent 2023-06-20 11:51:24 +02:00
Tinjo Schöni
1161edfa33
Invalidate cached methods when referenced files are deleted 2023-06-20 01:01:24 +02:00
Tinjo Schöni
3e2de9d152
Implement a way to test cache issues 2023-06-20 01:01:23 +02:00
orklah
8e636086b3
put config to true to prevent deprecations for new config files (#9857)
* put config to true to prevent deprecations for new config files
2023-06-19 22:02:29 +02:00
orklah
8ca4110e68
Merge pull request #9930 from orklah/volatile_cache
remove StementsVolatileCache for perf reasons
2023-06-19 22:00:19 +02:00
orklah
da8c1da8be remove StementsVolatileCache for perf reasons 2023-06-19 21:44:00 +02:00
orklah
1b571a1649 improve perfs for switch by not creating reverse assertions against constants 2023-06-19 21:24:46 +02:00
kkmuffme
9d1558b3ca make compressor configurable
Fix https://github.com/vimeo/psalm/issues/9905
Suppress throws for igbinary_unserialize like it was done for @unserialize
2023-06-18 20:22:02 +02:00
orklah
e2dde5d200
Merge pull request #9922 from robchett/elseif_shouldnt_be_modifying_outer_scope
Don't update types of the outer scope when in an elseif conditional
2023-06-18 11:00:16 +02:00
orklah
b5159517ce
Merge pull request #9920 from robchett/CoreGenericAttributes
Add a stub file for Attributes defined by PHP
2023-06-17 22:11:26 +02:00
robchett
4600d2b224 Fix line lenght 2023-06-17 14:13:04 +01:00
robchett
7792b6c36c Don't update types of the outer scope when in an elseif conditional 2023-06-17 13:36:29 +01:00
robchett
5fc48bbb62 Add a stub file for Attributes defined by PHP 2023-06-17 12:26:56 +01:00
robchett
721b65ce2f Add Type::getIntRange 2023-06-17 12:24:09 +01:00
robchett
338b50a959 Change __LINE__ to a positive-int 2023-06-17 12:24:09 +01:00
orklah
eb64a471c4
Merge pull request #9903 from ygottschalk/fix/9827-union-empty-array-and-false
Fixes #9827
2023-06-15 21:19:44 +02:00
kkmuffme
16aaa3ae2b regex cleanup 2023-06-13 22:07:51 +02:00
kkmuffme
d4732f118e fix minor trim bug in original code and small speed up 2023-06-13 22:04:39 +02:00
kkmuffme
e75d514ada speed up on unix 2023-06-13 21:55:43 +02:00
kkmuffme
9a4d7aa719 additional gains 2023-06-13 21:52:03 +02:00
kkmuffme
3f3890382b replace all at once 2023-06-13 21:19:52 +02:00
kkmuffme
5ac3ed08df additional ones 2023-06-13 20:37:33 +02:00
kkmuffme
394a40b0f7 remove preg, minor performance gain (up to 1%) 2023-06-13 20:29:20 +02:00
kkmuffme
51fd63cfbb fix CI warnings 2023-06-13 16:59:25 +02:00
kkmuffme
96988ea5ec code style 2023-06-12 19:44:22 +02:00
kkmuffme
d0f14ba19e ignore complex placeholders for now
Fix https://github.com/vimeo/psalm/issues/9900
Fix https://github.com/vimeo/psalm/issues/9901
Fix original core stubs sprintf returning a wrong type too (unrelated to return type provider) for placeholders that are always empty
2023-06-12 19:44:22 +02:00
kkmuffme
9bc4752e29 add checks for complex empty format and make return type more specific 2023-06-12 19:44:22 +02:00
kkmuffme
9232e4e76b code style 2023-06-12 19:44:22 +02:00
kkmuffme
697d06b24d fix empty format return type, add errors for empty format or format without placeholders 2023-06-12 19:44:22 +02:00
kkmuffme
f2168de96e fix printf bug 2023-06-12 19:44:22 +02:00
orklah
715a91d15c
Merge pull request #9889 from dkarlovi/feat/cache.gz
feat: cache.gz
2023-06-12 18:50:01 +02:00
Yannick Gottschalk
40ce0cf7d7 Fixes #9827 2023-06-12 15:25:17 +02:00
orklah
b6cba5a377
Merge pull request #9877 from kkmuffme/sprintf-improve-return-param-type-validation
Sprintf improve return param type validation
2023-06-11 13:08:24 +02:00
Dalibor Karlović
8d1197427e
fix: import igbinary_* functions 2023-06-09 17:12:35 +02:00
Dalibor Karlović
ddacfeaa3e
SA: add expected types 2023-06-09 16:33:23 +02:00
Dalibor Karlović
5e49ebb8e6
SA: remove obsolete suppresses 2023-06-09 16:28:43 +02:00
Dalibor Karlović
dd0402b6d7
SA: only possible return type is a string 2023-06-09 16:07:41 +02:00
Dalibor Karlović
59f45480c4
feat: Gzip support in PHP parser cache 2023-06-09 16:03:25 +02:00
Dalibor Karlović
495a466c5e
init cache in child classes 2023-06-09 15:57:29 +02:00
Dalibor Karlović
d4f384e13f
cs 2023-06-09 15:48:56 +02:00
Dalibor Karlović
5ffaa117c8
cs 2023-06-09 14:59:49 +02:00
Dalibor Karlović
dc3e0455de
feat: Gzip support in PHP parser cache 2023-06-09 14:58:27 +02:00
Dalibor Karlović
3e95ecd713
feat: Gzip support in ClassStorage cache 2023-06-09 14:44:29 +02:00
Dalibor Karlović
dd5c3ac241
feat: Gzip support 2023-06-09 14:32:56 +02:00
Dalibor Karlović
bd8313a46c
fix: PHP 7 compat 2023-06-09 13:48:09 +02:00
Dalibor Karlović
0db819510d
feat: centralized Cache management 2023-06-09 13:46:00 +02:00
kkmuffme
98d15637ce remove declaration 2023-06-09 12:59:13 +02:00
kkmuffme
1c10673e14 move variable context 2023-06-09 12:59:13 +02:00
kkmuffme
277f9c34f5 fix printf false positive return type when first arg is null, simplify return value handling 2023-06-09 12:59:13 +02:00
kkmuffme
145f1fb242 phpcs code style 2023-06-09 12:59:13 +02:00
kkmuffme
9c1e34b89f fix infinite loop bug in PHP 7 2023-06-09 12:59:13 +02:00
kkmuffme
a0b87ad935 suppress PHP 7 issues and remove unspecific return type 2023-06-09 12:59:13 +02:00
kkmuffme
3179498643 check args for sprintf + printf
* check args for (s)printf for Invalid/TooMany/TooFew
* don't change the return type when we cannot infer it more specifically (nullable return)
* fix https://github.com/vimeo/psalm/issues/9874
* implement https://github.com/vimeo/psalm/issues/9817
* add tests
2023-06-09 12:59:13 +02:00
kkmuffme
0a54c84055 readonly does not have write access, therefore is safe as long as the type is contained in the parent type
Fix https://github.com/vimeo/psalm/issues/9831#issuecomment-1569022701
2023-06-09 12:37:41 +02:00
andrew
4f5dfa7350 Better intersection of template types during inheritance check 2023-06-07 17:58:25 +03:00
kkmuffme
bc121b3f25 more unrelated phpcs code style 2023-06-07 09:09:01 +02:00
kkmuffme
7dcd8e13dd fix phpcs code style issues in unrelated code which is reported now that phpcs is fixed 2023-06-07 09:01:47 +02:00
orklah
9d1c2c4596
Merge pull request #9866 from klimick/fix-generic-type-params-mapping
Fix generic type params mapping
2023-06-04 23:05:04 +02:00
orklah
43df1dc9ba
Merge pull request #9865 from klimick/intersection-with-template
Intersect template types during inheritance check
2023-06-04 23:01:28 +02:00
orklah
c15860508b
Merge pull request #9853 from kkmuffme/multiple-psalm-assert-if-for-array-list
Allow if/false assert for same variable to allow array/list distinction
2023-06-04 22:59:37 +02:00
andrew
02addbe79c Fix generic type params mapping 2023-06-02 17:36:13 +03:00
andrew
38bd4d8c0d Intersect template 2023-06-02 14:48:20 +03:00
kkmuffme
fa644cbb34 code review init variables 2023-06-02 08:54:00 +02:00
Alies Lapatsin
d3a6da7418 Fix coding style issue 2023-06-01 16:38:29 +02:00
Alies Lapatsin
f114858be9 Update array shape 2023-06-01 14:37:05 +02:00
Alies Lapatsin
83063272e5 Add package versions to Shepherd payload 2023-06-01 14:32:25 +02:00
orklah
e55530d627
Merge pull request #9845 from lptn/shepherd-use-list-of-issues
Shepherd: send a list of issues (instead of array with int keys)
2023-06-01 13:36:05 +02:00
Alies Lapatsin
7b7d823b07 Use better var name 2023-06-01 10:51:10 +02:00
orklah
75baaf7889
Merge pull request #9844 from kkmuffme/property-no-set-in-constructor-abstract-false-positive
PropertyNotSetInConstructor should not report for abstract constructors
2023-06-01 07:21:23 +02:00
kkmuffme
103e7b343c PropertyNotSetInConstructor should not report for abstract constructors
since they do not have any code

Fix https://github.com/vimeo/psalm/issues/9830
2023-06-01 01:38:33 +02:00
kkmuffme
322878b1d7 code style 2023-06-01 01:33:12 +02:00
kkmuffme
c17564d27c code style and false positive shepherd 2023-06-01 01:25:46 +02:00
kkmuffme
1f2db5f31c Allow if/false assert for same variable to allow array/list distinction
Fix https://github.com/vimeo/psalm/issues/9037
2023-06-01 01:08:06 +02:00
orklah
a762b6c3bb
Merge pull request #9841 from kkmuffme/sprintf-basic-return-type-provider
sprintf basic non-empty-string return type provider
2023-05-31 23:36:03 +02:00
Alies Lapatsin
5e7e067798 Merge branch 'master' into shepherd-use-list-of-issues
# Conflicts:
#	src/Psalm/Plugin/Shepherd.php
2023-05-31 23:11:56 +02:00
orklah
5b2efad55b
Merge pull request #9846 from lptn/use-consts-for-issue-severity
Introduce and use `IssueData` constants for severity levels
2023-05-31 23:04:13 +02:00
Alies Lapatsin
bf1a7365d2 Use PHPStorm output format by default on JetBrains terminals 2023-05-31 13:30:52 +02:00
Alies Lapatsin
3700ab6c61 Fix RedundantConditionGivenDocblockType issues 2023-05-31 13:11:54 +02:00
Alies Lapatsin
67648ac248 Use new IssueBuffer constants 2023-05-31 13:00:16 +02:00
Alies Lapatsin
174cd5c0fe Introduce and use IssueData constants for severity
they are not the same as Config::REPORT_* constants
2023-05-31 12:38:15 +02:00
Alies Lapatsin
2fa943a8a6 Shepherd: send a list of issues (instead of array with int keys)
as result Shepherd will send an array is issues instead of object with "random" numeric keys
2023-05-31 12:24:49 +02:00
kkmuffme
8606d5585f sprintf basic non-empty-string return type provider
Fix https://github.com/vimeo/psalm/issues/9819
This PR is a starting point for improving the sprintf return type and eventually validate the format, param types and param count.
(see https://github.com/vimeo/psalm/issues/9817, https://github.com/vimeo/psalm/issues/9818)
2023-05-30 22:11:17 +02:00
kkmuffme
9d7d4bff28 non-empty-string always returs non-empty-string, fix tests 2023-05-30 16:44:23 +02:00
kkmuffme
25c7f37a44 add test, fix wrong test and fix shepherd 2023-05-30 16:29:47 +02:00
kkmuffme
f9f1cc244b dirname returns non-empty-string when a non-empty-string is passed and level is 1 2023-05-30 16:09:50 +02:00
orklah
2bbfca6d9f
Merge pull request #9829 from klimick/map-closed-inheritance-to-union
Mapping closed inheritance to union during assertion
2023-05-29 20:14:31 +02:00
Yannick Gottschalk
a41eb35b24 Fix #9824 2023-05-28 17:37:16 +02:00
klimick
56d7b3793e Map closed inheritance to union 2023-05-27 13:39:56 +03:00
Jack Worman
f279c39503 GH-9825 2023-05-26 18:03:05 -04:00
Demmie
72b4ab9310 Use preg_split instead of explode
This also accounts for Windows dir separators
and duplicated wildcards.
2023-05-24 15:28:41 -04:00
Demmie
116795abc4 Fix reported type issues 2023-05-24 14:06:53 -04:00
Demmie
317c683644 Return file_exists to glob files 2023-05-24 01:27:48 -04:00
Demmie
cab10721e6 Add a support for multilevel glob wildcards
This works just like in Python with "**".
2023-05-24 01:13:26 -04:00
orklah
f90118cdea
Merge pull request #9805 from orklah/memory-psalter
allow using more than 8G of memory in psalter
2023-05-22 23:19:03 +02:00
orklah
f65d53f32e fix CS 2023-05-22 23:16:17 +02:00
orklah
d23616cafa allow using more than 8G of memory in psalter 2023-05-22 23:06:02 +02:00
orklah
ed94de5146 fix offset for type param changes 2023-05-21 18:56:54 +02:00
RobChett
100907b61f Improve return types of pow() 2023-05-15 01:22:45 +01:00
Jack Worman
f41da745d1 UnsupportedPropertyReferenceUsage 2023-05-12 14:12:12 -05:00
acdbffbb34
cs-fix 2023-05-11 19:23:33 +02:00
ffd363d7b8
Enable opcache if it is installed 2023-05-11 16:51:37 +02:00