Matthew Brown
d63da1f66e
Prevent array{a: Foo} going cleanly into array<Foo> ( #8691 )
...
* Prevent array{a: Foo} going cleanly into array<Foo>
* Add test for new behaviour
* Fix code style issues
* Allow unions to be cloned again
* Simplify params properties
2022-11-10 09:18:27 -05:00
Bruce Weirdan
d81543f83e
Emit DeprecatedInterface
when an interface is referenced in a generic
...
Fixes vimeo/psalm#8617
2022-11-08 20:34:08 -04:00
65d6a469b6
Fix tests
2022-11-08 10:45:21 +01:00
68a5511057
Merge remote-tracking branch 'origin/4.x' into HEAD
2022-11-08 10:25:04 +01:00
Corey Taylor
b87ebd697f
Fix assert testing callmap return types
2022-11-06 00:59:55 -05:00
1986c8b4a8
Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists ( #8395 )
...
* Immutable CodeLocation
* Remove excess clones
* Remove external clones
* Remove leftover clones
* Fix final clone issue
* Immutable storages
* Refactoring
* Fixes
* Fixes
* Fix
* Fix
* Fixes
* Simplify
* Fixes
* Fix
* Fixes
* Update
* Fix
* Cache global types
* Fix
* Update
* Update
* Fixes
* Fixes
* Refactor
* Fixes
* Fix
* Fix
* More caching
* Fix
* Fix
* Update
* Update
* Fix
* Fixes
* Update
* Refactor
* Update
* Fixes
* Break one more test
* Fix
* FIx
* Fix
* Fix
* Fix
* Fix
* Improve performance and readability
* Equivalent logic
* Fixes
* Revert
* Revert "Revert"
This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.
* Fix
* Fix reference bug
* Make default TypeVisitor immutable
* Bugfix
* Remove clones
* Partial refactoring
* Refactoring
* Fixes
* Fix
* Fixes
* Fixes
* cs-fix
* Fix final bugs
* Add test
* Misc fixes
* Update
* Fixes
* Experiment with removing different property
* revert "Experiment with removing different property"
This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.
* Uniform naming
* Uniform naming
* Hack hotfix
* Clean up $_FILES ref #8621
* Undo hack, try fixing properly
* Helper method
* Remove redundant call
* Partially fix bugs
* Cleanup
* Change defaults
* Fix bug
* Fix (?, hope this doesn't break anything else)
* cs-fix
* Review fixes
* Bugfix
* Bugfix
* Improve logic
* Add support for list{} and callable-list{} types, properly implement array_is_list assertions (fixes #8389 )
* Default to sealed arrays
* Fix array_merge bug
* Fixes
* Fix
* Sealed type checks
* Properly infer properties-of and get_object_vars on final classes
* Fix array_map zipping
* Fix tests
* Fixes
* Fixes
* Fix more stuff
* Recursively resolve type aliases
* Fix typo
* Fixes
* Fix array_is_list assertion on keyed array
* Add BC docs
* Fixes
* fix
* Update
* Update
* Update
* Update
* Seal arrays with count assertions
* Fix #8528
* Fix
* Update
* Improve sealed array foreach logic
* get_object_vars on template properties
* Fix sealed array assertion reconciler logic
* Improved reconciler
* Add tests
* Single source of truth for test types
* Fix tests
* Fixup tests
* Fixup tests
* Fixup tests
* Update
* Fix tests
* Fix tests
* Final fixes
* Fixes
* Use list syntax only when needed
* Fix tests
* Cs-fix
* Update docs
* Update docs
* Update docs
* Update docs
* Update docs
* Document missing types
* Update docs
* Improve class-string-map docs
* Update
* Update
* I love working on psalm :)
* Keep arrays unsealed by default
* Fixup tests
* Fix syntax mistake
* cs-fix
* Fix typo
* Re-import missing types
* Keep strict types only in return types
* argc/argv fixes
* argc/argv fixes
* Fix test
* Comment-out valinor code, pinging @romm pls merge https://github.com/CuyZ/Valinor/pull/246 so we can add valinor to the psalm docs :)
2022-11-05 22:34:42 +01:00
orklah
205e8cc73e
Merge pull request #8670 from danog/fix_8669
...
Fix #8669
2022-11-05 22:29:37 +01:00
923f1d2eb7
Possible fix
2022-11-05 22:23:31 +01:00
Bruce Weirdan
81423dc12b
Remove argc
and argv
elements from $_ENV
...
Fixes vimeo/psalm#8662
2022-11-05 15:19:21 -04:00
da21229cab
Fix #8664
2022-11-05 19:15:46 +01:00
d0be59e16e
Immutable unions ( #8627 )
...
* Immutable CodeLocation
* Remove excess clones
* Remove external clones
* Remove leftover clones
* Fix final clone issue
* Immutable storages
* Refactoring
* Fixes
* Fixes
* Fix
* Fix
* Fixes
* Simplify
* Fixes
* Fix
* Fixes
* Update
* Fix
* Cache global types
* Fix
* Update
* Update
* Fixes
* Fixes
* Refactor
* Fixes
* Fix
* Fix
* More caching
* Fix
* Fix
* Update
* Update
* Fix
* Fixes
* Update
* Refactor
* Update
* Fixes
* Break one more test
* Fix
* FIx
* Fix
* Fix
* Fix
* Fix
* Improve performance and readability
* Equivalent logic
* Fixes
* Revert
* Revert "Revert"
This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.
* Fix
* Fix reference bug
* Make default TypeVisitor immutable
* Bugfix
* Remove clones
* Partial refactoring
* Refactoring
* Fixes
* Fix
* Fixes
* Fixes
* cs-fix
* Fix final bugs
* Add test
* Misc fixes
* Update
* Fixes
* Experiment with removing different property
* revert "Experiment with removing different property"
This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.
* Uniform naming
* Uniform naming
* Hack hotfix
* Clean up $_FILES ref #8621
* Undo hack, try fixing properly
* Helper method
* Remove redundant call
* Partially fix bugs
* Cleanup
* Change defaults
* Fix bug
* Fix (?, hope this doesn't break anything else)
* cs-fix
* Review fixes
* Bugfix
* Bugfix
* Improve logic
* Update
2022-11-04 19:04:23 +01:00
Vincent Langlet
fbaf6afb30
Try
2022-11-03 18:11:01 +01:00
Vincent Langlet
b2f095f1b8
Add tests
2022-11-03 14:39:48 +01:00
Vincent Langlet
4a27322144
serialize is not pure for array of object
2022-11-03 11:48:33 +01:00
Vincent Langlet
ef0a17ee11
Do not report serialize as unused
2022-11-02 22:52:42 +01:00
kkmuffme
e064a0c14d
fix unrelated CI error
2022-10-27 09:23:25 +02:00
kkmuffme
87eb83616e
add basename return type provider
...
Like dirname return type provider of https://github.com/vimeo/psalm/pull/8611
2022-10-26 13:03:53 +02:00
Chauncey McAskill
0afd873787
Fix dirname return type provider
...
Changed:
- Replaced extraction of `$dir_level` literal value to be from the NodeTypeProvider instead of from the statement; based on similar logic in `RoundReturnTypeProvider`.
- Replaced `new` return type creation with `Type` method creation.
- Replaced `null` return with string type.
Fixed:
- Typo on variable name for extracted `StatementsSource`.
- Edge case where `$dir_level` is less than 1.
- Broken unit tests.
2022-10-23 12:11:58 -04:00
Chauncey McAskill
1dfadfa9ec
Add dirname return type provider
2022-10-23 11:56:02 -04:00
orklah
b739b67080
Merge pull request #8594 from kkmuffme/callable-invalidargument-required-param-mismatch-missing-error
...
ensure callbacks have the required number of params
2022-10-22 12:20:29 +02:00
kkmuffme
7d953dfb90
add tests
2022-10-22 08:53:40 +02:00
orklah
48b8efde99
Merge pull request #8584 from boesing/feature/8521
...
Enhance type detection for internal php functions `key`, `current`, `end` and `reset`
2022-10-18 00:07:13 +02:00
Maximilian Bösing
eb6bbfb3b5
qa: remove redundant check as !empty
already ensures that key
does not return null
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-10-17 20:38:34 +02:00
c9ff8c2c67
Prevent re-resolution of static
2022-10-17 20:31:11 +02:00
Maximilian Bösing
7f35bff0d9
feature: enhance type detection for internal php functions key
, current
, end
and reset
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-10-17 20:24:40 +02:00
kkmuffme
2c47d06968
fix tests
2022-10-17 16:25:43 +02:00
7b6e09afc9
Merge branch 'merge_4.x' into immutable_readonly_3
2022-10-17 12:58:41 +02:00
56805ab089
Fix
2022-10-17 12:54:46 +02:00
15f5c593a7
Fix
2022-10-17 12:40:50 +02:00
1abade3c30
Skip
2022-10-17 12:14:07 +02:00
150be5ca22
Update
2022-10-17 10:45:18 +02:00
8d4d0c0e4a
Fixes
2022-10-17 10:33:33 +02:00
53e3889745
Fixes
2022-10-17 10:21:26 +02:00
f816c06331
Fix
2022-10-16 14:39:34 +02:00
8518372cad
Fixes
2022-10-16 14:23:31 +02:00
34000ca90d
Fixes
2022-10-16 13:59:15 +02:00
cbd1a27ea7
Merge branch 'master' into merge_4.x
2022-10-16 13:49:21 +02:00
b79c43a288
Merge remote-tracking branch 'origin/4.x' into merge_4.x
2022-10-16 13:42:43 +02:00
748a74bb2c
Merge remote-tracking branch 'origin/4.x' into HEAD
2022-10-16 13:41:27 +02:00
orklah
921801707d
Merge pull request #8583 from gphargreaves/#8484/fix-datetimeimmutable-sub
...
Correct return type of DateTimeImmutable sub method stub
2022-10-15 14:51:43 +02:00
ADmad
9bd4d7a740
Fix template param for SplDoublyLinkedList.
...
It's key is always an integer.
2022-10-14 11:54:53 +05:30
Greg Hargreaves
06581ce4b0
Add additional checks for concat of non-empty strings to return non-falsy
2022-10-14 01:54:06 +01:00
Greg Hargreaves
8849e8ca38
Fix test for DateTimeImmutable sub method return type
2022-10-14 00:59:54 +01:00
8c9558c92b
Fix #6983 , #8564
2022-10-13 13:42:35 +02:00
orklah
bb9aabe5b1
Merge pull request #8570 from Nicelocal/fix_8569
...
Fix #8569
2022-10-12 20:59:04 +02:00
a7af027645
Fix #8562
2022-10-12 11:40:29 +02:00
3ac0bce203
Fix #8569
2022-10-12 11:24:42 +02:00
Steven Dickinson
68f6ba873e
Fix MinMaxReturnTypeProvider when handling TDependentListKeys
2022-10-11 14:13:40 +01:00
Alies Lapatsin
30dc46528d
Cleaup $ignoredFunctions
2022-10-09 17:40:36 +03:00
f06c459415
Bugfix
2022-10-07 13:18:57 +02:00
Gregory Hargreaves
41a6afda32
Add check for const with reserved word class
2022-10-07 09:44:10 +01:00
Peter de Blieck
15453d4306
Removed imap_delete and imap_undelete from the ignoredFunctions list.
2022-10-06 14:44:49 +02:00
0155ad7472
Immutable readonly 3
2022-10-03 15:13:47 +02:00
45452c7125
Immutable readonly 2
2022-10-03 14:02:41 +02:00
c2ce7e63da
Immutable readonly 1
2022-10-03 11:53:05 +02:00
f11ed46f26
Immutable assertions
2022-10-03 11:32:15 +02:00
ef60a0c88c
Fix properties-of on generics&intersections
2022-10-03 11:28:01 +02:00
3abd0b961f
Immutable Unions
2022-10-03 10:45:36 +02:00
kkmuffme
328561d388
add code for faster debugging next time
2022-09-22 01:01:08 +02:00
kkmuffme
ce76158085
fix crash in <PHP8 with ResourceBundle
...
partially reverts https://github.com/vimeo/psalm/pull/8217
2022-09-22 01:01:08 +02:00
kkmuffme
d69e062426
add RiskyCast tests
2022-09-20 10:59:46 +02:00
kkmuffme
d69be4b9a2
objects even with __toString methods cannot be cast to int/float
2022-09-19 21:54:16 +02:00
Ricardo Boss
bf1c0320fd
Cherry-pick: Try to provide literal int types when possible ( fixes #6966 ) ( #7071 )
...
* Fixed vimeo/psalm#6966
* Only accept >= 0 values for mode argument in round()
* Made round() only return float or literal float values and remove unneeded test
* Registered RoundReturnTypeProvider
* Updated cast analyzer to handle single string literal int values as literal ints
* Fixed psalm errors
* Fix invalid property accesses
* Addressed comments
* Added Tests
* Marked RoundReturnTypeProvider as internal
* Fixed CS
2022-09-19 21:54:16 +02:00
dennis
3a6b709845
Test to describe use statements being applied
2022-09-19 21:09:45 +02:00
dennis
ab690df4da
Improved class name generation for @throws annotation
2022-09-19 21:09:45 +02:00
dennis
8ffc747349
Add test to document cross namespace behaviour
2022-09-19 21:09:45 +02:00
dennis
b88d2890e2
Fix existing tests
2022-09-19 21:09:45 +02:00
dennis
44785fadfc
Introduce test with code inside namespace
2022-09-19 21:09:45 +02:00
orklah
3b7e508c78
Merge pull request #8473 from kkmuffme/detailed-superglobal-types
...
make superglobals more specific
2022-09-19 10:48:44 +02:00
kkmuffme
e2e6265ba1
ignore nullable issues for $argv/$argc
2022-09-19 09:45:55 +02:00
Peter van Dommelen
05f28ce8cd
Do not widen type to mixed
and lose the existing type information when an Any
assertion is used.
...
Fixes #8084 .
2022-09-18 17:02:09 +02:00
orklah
5db59910bd
Merge pull request #8491 from HypeMC/array-column-fix
...
Fix array_column with object and column name null
2022-09-18 11:25:42 +02:00
HypeMC
602e26edd4
Fix array_column with object and column name null
2022-09-17 21:21:33 +02:00
hirokinoue
2f870776e2
add test case derived from issue #7428
2022-09-17 23:02:25 +09:00
hirokinoue
a2118c65d3
add test case reproducing issue #7428
2022-09-17 22:11:28 +09:00
kkmuffme
b701c7074b
fix tests for detailed $_SERVER
2022-09-15 19:39:02 +02:00
kkmuffme
5c39e66b15
fix tests
2022-09-15 19:38:51 +02:00
Vincent Langlet
32aedbac58
Add dateTimeModify return type provider
2022-09-14 00:53:12 +02:00
Matthew Brown
d957ff2015
Fix mixed type hole when sending Foo<string> to Foo<mixed> ( #8481 )
...
* Fix mixed type hole when sending Foo<string> to Foo<mixed>
* Fix ifThisIs test
* Suppress bugs highlighted with fix
* Fix PHPDoc parsing
2022-09-13 13:13:06 -04:00
kkmuffme
62df25a741
fix test cache inconsistency
2022-09-11 10:28:16 +02:00
kkmuffme
8da5f5eb1a
use exceptions instead of error_log for ParserCacheProvider
...
* use exceptions instead of error_log for ParserCacheProvider like all other cache providers do
* remove duplicate code in ParserCacheProvider
* use same hash as other cache providers
* update Config.php cache directory creation to use same code as ParserCacheProvider
2022-09-11 10:22:48 +02:00
orklah
5cf6fb3574
Merge pull request #8468 from kkmuffme/class-alias-should-not-be-case-insensitive
...
classlike_alias incorrect casing not handled correctly
2022-09-08 23:03:17 +02:00
orklah
eba63a3821
Merge pull request #8367 from kkmuffme/revert-nullable-curl_multi_getcontent
...
partial revert nullable type for curl_multi_getcontent
2022-09-08 22:58:29 +02:00
kkmuffme
6e4c1823d6
partial revert nullable type for curl_multi_getcontent
...
Fix https://github.com/vimeo/psalm/issues/8351
Partially reverts f28ac73777
2022-09-08 21:46:15 +02:00
kkmuffme
4c6abccfb2
fix tests
2022-09-08 21:33:06 +02:00
kkmuffme
1a10654cb3
fix tests
2022-09-08 13:28:43 +02:00
Semyon
f0a8810cf5
Fix ctype_digit assertion bug
2022-09-07 15:49:35 +03:00
Semyon
969c7a098b
Make ctype_digit and ctype_lower work as assertions
2022-09-02 17:37:10 +03:00
Aleksandr Zhuravlev
d7097281ba
trim(), ltrim(), rtrim() now keep lowercase string attribute
2022-08-31 21:02:20 +12:00
Tim Düsterhus
3c2018a1e0
Configure a correct attribute target in stubs/CoreGenericClasses.phpstub
2022-08-24 21:32:26 +02:00
Vincent Langlet
6bc714c867
Add support for callable in array_reduce
2022-08-24 16:04:22 +02:00
Markus Staab
198347fac7
fix test
2022-08-22 16:58:23 +02:00
Markus Staab
a3d58cf2fd
imports
2022-08-22 16:55:26 +02:00
Markus Staab
63915d1e2c
added SensitiveParameter, AllowDynamicProperties php 8.2 attributes
2022-08-22 16:44:55 +02:00
orklah
7ee3a81bce
Merge pull request #8370 from someniatko/issue-8363
...
Ensure we recognize inherited static methods for the first-class callables
2022-08-18 21:50:20 +02:00
0220da0b32
Add tests
2022-08-17 13:30:36 +02:00
Paul Fedorow
8908638219
Fix imageinterlace
function signature
2022-08-12 11:22:45 +02:00
Markus Staab
8f6e16add6
added truthy-string alias for non-falsy-string
2022-08-11 16:49:58 +02:00
Teemu Koskinen
89b7b3234b
Add test for #8373
...
Undefined classes in function dockblocks should not crash psalm.
Test provided by @AndrolGenhald
2022-08-08 23:49:14 +03:00
orklah
57fcc3968e
Merge pull request #8350 from Ocramius/fix/datetime-constructor-is-not-immutable
...
Added better stubs for `DateTimeImmutable`, highlighting how the constructor is **NOT** immutable
2022-08-07 22:57:43 +02:00
Marco Pivetta
68ffae097e
Simplified DateTimeImmutable::format()
: always returns a string
...
Also:
* a non-empty format string will always lead to `non-empty-string`
* it seems that you can throw **everything** at `DateTimeInterface#format()`, even null bytes,
and it will always produce a `string`
2022-08-05 13:21:28 +02:00
someniatko
be02e7e5c7
#8363 - support static
as a type parameter in return types of the first-class callables
2022-08-04 17:16:06 +03:00
someniatko
f3d67845c5
#8363 - ensure we recognize inherited static methods for the first-class callables
2022-08-04 17:01:42 +03:00
Bitwise Operators
9f6ce3059d
tests: added tests for bitwise-and, bitwise-xor, bitwise-not and boolean-not class constants
2022-08-04 08:52:43 +02:00
kkmuffme
d2be169ce5
update tests
2022-08-03 20:12:18 +02:00
Marco Pivetta
c205d652d1
DateTimeImmutable#sub()
always returns another static
instance, never false
2022-07-31 18:12:07 +02:00
Marco Pivetta
dcaf610b0a
Removed @psalm-immutable
marked from MyDate
extending DateTimeImmutable
...
`DateTimeImmutable` is not really immutable, therefore this marker was wrong upfront
2022-07-31 18:08:01 +02:00
24f7920e9a
Fix if propagation ( #8326 )
...
* Add failing unit test
* Fix test
* Revert "Add comment for skipped test"
This reverts commit e4f73beb08
.
* Revert "Simplify context updates even more"
This reverts commit a32e63f131
.
* Revert "Remove special handling for elseifs that breaks for else if"
This reverts commit d7d9ddc653
.
* Fix test
2022-07-30 19:20:05 -04:00
Bruce Weirdan
58e87fa5e0
Applied ArraySpreadInsteadOfArrayMergeRector (take 2)
2022-07-29 18:17:21 -04:00
AndrolGenhald
148264305f
Merge pull request #8341 from someniatko/issue-7731
...
recognize `@psalm-allow-private-mutation` in PHP 8+ constructors
2022-07-29 09:31:20 -05:00
someniatko
0abde258fa
#7731 - recognize @psalm-allow-private-mutation
in PHP 8+ constructors
2022-07-29 16:50:56 +03:00
someniatko
0c652f72f6
#8330 - take into account that static
type may have been unwrapped in ExistingAtomicStaticCallAnalyzer#hasStaticInType()
2022-07-29 12:31:37 +03:00
orklah
7c4228fb56
Merge pull request #8324 from Nicelocal/fix_union_assertions
...
Fix union assertions
2022-07-28 19:06:14 +02:00
33d8f3a62d
Fix unit tests
2022-07-28 12:03:12 +02:00
6ce32a48d5
Fix
2022-07-27 20:24:24 +02:00
c409675e3e
Fix intersection of final classes
2022-07-27 18:46:07 +02:00
e19589117d
Fix unit test
2022-07-27 17:56:41 +02:00
37274b308f
Add temporary failing test
2022-07-27 17:51:55 +02:00
09fb879428
Fix #8322 , #8319
2022-07-27 17:42:48 +02:00
AndrolGenhald
ee68184527
Fix key comparison when unpacking Traversables.
2022-07-26 12:00:05 -05:00
AndrolGenhald
d54eebfe02
Fix various array spread issues.
...
- Correctly infer `array` and `list` instead of `non-empty-array` and `non-empty-list` (fixes #7296 )
- Add support for spreading string keys (fixes #7297 ).
- Show issue when trying to unpack non-iterable
- Show issue when trying to unpack iterable with non-array-key key
- Re-added invalid PHP 8.0 tests removed in #6613
- Unpacked lists with known keys will be inferred as eg `array{0: int, 1: int}<int<0, max>, int>` now but will still be treated as lists
- Unpacked arrays with known keys will now be inferred as eg `array{a: string, b: string}<int, int>` instead of `array<int|string, int|string>`
2022-07-26 12:00:03 -05:00
Semyon
462ce7138a
Make DatePeriod implement Traversable oh PHP 7, rename constructor params
2022-07-25 17:11:36 +03:00
Semyon
9d3253482d
Add stub for DatePeriod
2022-07-25 17:11:36 +03:00
Andrew Nagy
4109e4bd53
Merge branch '4.x' of https://github.com/vimeo/psalm into feature/upgrade-lsp
2022-07-21 21:04:50 +00:00
AndrolGenhald
ba6270c06a
Fix type reconciliation breaking Context::$references_in_scope ( fixes #8289 ).
2022-07-21 14:27:21 -05:00
Oliver Hader
98502d4613
Assert ReconcilerTest::arrayReferencesAreHandled reaches the end
2022-07-20 21:44:28 +02:00
Oliver Hader
ac315fb0a3
Demonstrate flaw in type reconciliation on array references
2022-07-20 20:33:02 +02:00
orklah
85fe7e8bcf
Merge pull request #8283 from AndrolGenhald/feature/value-of-backed-enum
...
Allow `value-of` to work with backed enums (fixes #7874 ).
2022-07-20 18:03:58 +02:00
AndrolGenhald
b51b5ac903
Allow value-of
to work with backed enums ( fixes #7874 ).
2022-07-18 14:10:06 -05:00
Matthew Brown
e4f73beb08
Add comment for skipped test
2022-07-17 14:06:07 -04:00
Matt Brown
d7d9ddc653
Remove special handling for elseifs that breaks for else if
2022-07-17 12:51:17 -04:00
Matt Brown
8c716f8be7
Support taints in new $_GET["a"] calls
2022-07-15 22:17:59 -04:00
AndrolGenhald
cac9ec957c
Merge pull request #8249 from someniatko/issue-8200
...
Improve inferring the "final" `static` type when calling static methods inside a different class
2022-07-14 16:41:01 -05:00
someniatko
1e0b572264
#8200 - bikeshedding the tests
2022-07-14 10:03:47 +03:00
orklah
4fbbf820d8
Merge pull request #8228 from othercorey/callmap-nullable
...
Fix nullable return types for CallMap functions
2022-07-14 09:03:35 +02:00
Corey Taylor
f28ac73777
Fix nullable return types for CallMap functions
2022-07-13 22:44:38 -05:00
someniatko
21a6dd9096
#8200 - move tests to the correct provider ("valid" instead of "invalid")
2022-07-12 21:53:14 +03:00
orklah
416b597d1c
Merge pull request #7994 from aszenz/4.x
...
Adds support for fixing missing throws doc block
2022-07-12 20:46:14 +02:00
someniatko
ecbceb1d58
#8200 - move Issue8200Test to ClassTemplateTest
2022-07-12 21:38:23 +03:00
someniatko
b3e673d7ec
#8200 - flip logic of determining "source" of static
type in ExistingAtomicStaticCallAnalyzer::getMethodReturnType()
2022-07-12 21:17:10 +03:00
someniatko
3a5054018b
#8200 - generalize ExistingAtomicStaticCallAnalyzer::hasStaticInType() for non-object cases
2022-07-12 21:00:19 +03:00
someniatko
470885e4f1
#8200 - improve inferring the "final" static
type when calling static methods inside a different class
...
differentiate between `static` defined in a class which CALLS a given static method, and `static` defined in the method which IS CALLED.
2022-07-12 13:51:28 +03:00
Jack Worman
3b76ac85dc
Count Report Format
2022-07-10 17:50:50 -05:00
AndrolGenhald
285740a753
Merge branch '4.x'
2022-07-07 15:01:38 -05:00
Corey Taylor
31bee0c845
Fix codestyle erors in InternalCallMapHandlerTest
2022-07-06 03:33:34 -05:00
orklah
e28cd128db
Merge pull request #8217 from othercorey/fix-callmap-funcs
...
Fix several CallMap function signatures
2022-07-06 07:16:13 +02:00
Corey Taylor
b1e3094bae
Allow testing expected CallMap return types and ignore functions that currently fail
2022-07-05 17:32:34 -05:00
Corey Taylor
e0ebfe19a2
Fix class functions CallMap signatures
2022-07-05 15:36:09 -05:00
Corey Taylor
2469b6222d
Fix extract() CallMap signature
2022-07-05 15:36:09 -05:00
Corey Taylor
c71dcd581e
Fix fputcsv() CallMap signature
2022-07-05 15:36:09 -05:00
Corey Taylor
d0dcd543e4
Fix count() CallMap signature
2022-07-05 15:36:06 -05:00
orklah
fbd240b6b6
Merge pull request #8191 from Nicelocal/fix_namespace
...
Fix namespace of test
2022-06-28 18:32:01 +02:00
4bd5ca7e6f
Fix
2022-06-28 15:46:30 +02:00
367b311021
Fix namespace of test
2022-06-28 15:42:32 +02:00
orklah
7dff408b25
Merge pull request #8077 from boesing/bugfix/5657
...
Feature: allow non-union assertion types
2022-06-27 20:55:37 +02:00
orklah
06dd975cb5
Merge pull request #8174 from AndrolGenhald/fix-attribute-crash
...
Fix crash when redefining method with fewer params (fixes #8141 ).
2022-06-26 13:47:54 +02:00
AndrolGenhald
e751a27eaf
Fix crash when redefining method with fewer params ( fixes #8141 ).
2022-06-26 06:27:46 -05:00
orklah
b3038f0936
Merge pull request #8164 from AndrolGenhald/encapsed-literal-strings
...
Encapsed literal strings
2022-06-26 12:52:33 +02:00
AndrolGenhald
b671117417
Improve @psalm-internal and prevent usage of IssueBuffer::add().
2022-06-25 02:09:40 -05:00
AndrolGenhald
3aea0987ef
Fix non-empty encapsed string check.
2022-06-24 20:28:04 -05:00
AndrolGenhald
2559222f67
More interpolation and concatenation improvements.
2022-06-24 19:22:59 -05:00
orklah
8b7bc07ad6
Merge pull request #8155 from Nicelocal/prohibition_analyzer_clone
...
Run method call prohibition analyzer when cloning
2022-06-25 01:31:00 +02:00
orklah
9b4c8cb53f
Merge pull request #8151 from othercorey/fix-array-sigs
...
Fix array_* function signatures
2022-06-24 18:43:00 +02:00
orklah
cd54574616
Merge pull request #8152 from othercorey/fix-filter-var
...
Fix filter_var and filter_var_array signatures
2022-06-24 18:42:31 +02:00
7a5120c4f7
Run method call prohibition analyzer when cloning
2022-06-24 12:37:33 +02:00
Corey Taylor
3297e35d9a
Fix datefmt_* function signatures
2022-06-23 22:55:29 -05:00
Corey Taylor
e1e858512d
Fix filter_var and filter_var_array signatures
2022-06-23 21:50:41 -05:00
Corey Taylor
417bf87df0
Fix array_* function signatures
2022-06-23 20:32:29 -05:00
Matt Brown
e6c444410c
Remove debug code
2022-06-23 18:03:33 -04:00
Matt Brown
15387d19cd
Track taints in static properties
2022-06-23 16:43:42 -04:00
Corey Taylor
b053253513
Fix signatures of ldap_* functions
2022-06-23 04:21:56 -05:00
Sam
de8187d138
Update tests/Internal/Codebase/InternalCallMapHandlerTest.php
2022-06-22 19:04:28 +02:00
orklah
cbc597f80c
Merge pull request #8140 from AndrolGenhald/stubs-dom-simplexml
...
Update DOM stub and add separate SimpleXML stub
2022-06-22 18:52:45 +02:00
Sam Mousa
c393a20471
fix static analysis comments
2022-06-22 15:37:51 +02:00
Sam Mousa
ac091902c1
php version specific ignores
2022-06-22 15:32:35 +02:00
Sam Mousa
08aea9c8ca
remove debug code
2022-06-22 15:08:50 +02:00
Sam Mousa
f8e548e811
fix code style remove debug code
2022-06-22 15:05:24 +02:00
Sam Mousa
d13a428cb5
update ignores, cleanup test file
2022-06-22 14:57:40 +02:00
Sam Mousa
d2467cfb7e
sort ignore list add more functions to it
2022-06-22 13:28:17 +02:00
Sam Mousa
37549ee03c
add test for ignore list cleanup
2022-06-22 12:59:47 +02:00
AndrolGenhald
4e3c2ea4d0
Fix tests.
2022-06-22 01:53:42 -05:00
Matt Brown
6fa0da9e37
Fix minor taint analysis bug with nested array assignment
2022-06-21 12:42:32 -04:00
Sam
db3447513e
Merge branch '4.x' into automated-callmap-validation
2022-06-15 16:06:36 +02:00
Sam Mousa
f6be3efa42
fix: added more type annotations
2022-06-15 15:05:06 +02:00
Sam Mousa
cc58fd9401
fix: add more typehints
2022-06-15 14:46:50 +02:00
Sam Mousa
df750709cc
fix: ignore last remaining failing function
2022-06-15 13:29:22 +02:00
Sam Mousa
b46f556662
chore: fix cs
2022-06-15 13:28:09 +02:00
Sam Mousa
0e7ea855d0
fix: ignore functions that fail on windows
2022-06-15 13:23:32 +02:00
orklah
c60e0a890c
Merge pull request #8056 from kkmuffme/phpdoc-false-positives-for-partially-invalid
...
fix false positives for partially invalid phpdoc
2022-06-15 13:21:26 +02:00
Sam Mousa
c3a97e0258
fix: add typehints
2022-06-15 13:16:24 +02:00
Sam Mousa
0484ee1560
chore: remove unused property
2022-06-15 13:13:24 +02:00
kkmuffme
a86dbf3640
update test cases
2022-06-15 12:31:53 +02:00
Sam Mousa
e826110417
fix: ignore all faulty callmap entries and revert callmap changes
2022-06-15 12:09:47 +02:00
Sam Mousa
ded566e79a
fix: callmap improvements and updated ignore list
2022-06-15 10:56:15 +02:00
Sam Mousa
c638006f5b
fix: add memcache family of function to ignore list
2022-06-15 09:27:40 +02:00
Sam Mousa
7bc5721d4c
fix: php8.1 syntax in tests
2022-06-15 09:11:14 +02:00
Sam Mousa
c1c3b20016
fix: more callmap fixes
2022-06-14 16:58:49 +02:00
Sam Mousa
e78c0a5e11
chore: remove undefined skip function
2022-06-14 15:43:13 +02:00
Sam Mousa
1b5a01dd77
wip: lots of fixes to the callmap
2022-06-14 15:16:13 +02:00
Sam Mousa
507e792d91
added more type validity checks to reduce possible false positives
2022-06-13 15:29:21 +02:00
Sam Mousa
c7e39e76fc
tests: add test that validates the callmap in the current runtime
2022-06-13 15:10:23 +02:00
Bitwise Operators
651ad6cb50
release:fix: Change return type of createFromInterface() methods on DateTime and DateTimeImmutable to 'static' so extending classes are recognized.
2022-06-13 14:41:02 +02:00
Maximilian Bösing
7e033d8051
bugfix: do not extend the type - only narrow down
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 19:20:38 +02:00
Maximilian Bösing
92b4bf1f01
qa: use dedicated variable for asserting a specific value
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:58:08 +02:00
Maximilian Bösing
083da24551
qa: add more specific unit test(s) for the oneOf
detection
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:53:04 +02:00
Maximilian Bösing
a9daa3ba02
qa: add failing test for one-of assertion
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-09 00:26:06 +02:00
orklah
02d5beecb0
Merge pull request #8051 from AndrolGenhald/bugfix/8048
...
Fix possibly empty array shape appearing non-empty (fixes #8048 ).
2022-06-08 19:22:12 +02:00
AndrolGenhald
271dce8b6c
Fix test format after cherry-pick from master.
2022-06-07 19:16:53 -05:00
AndrolGenhald
af5c191e7b
Fix generic object comparison to use template constraint as default ( fixes #8068 ).
2022-06-07 19:12:36 -05:00
Bruce Weirdan
4e59398f77
Coerce null to empty string in array keys
...
Fixes vimeo/psalm#8063
Alters the fix for vimeo/psalm#2165 (1a48be8e9c
)
/cc: @iluuu1994, @muglug
2022-06-06 17:41:42 -04:00
AndrolGenhald
c271b1245e
Fix possibly empty array shape appearing non-empty ( fixes #8048 ).
2022-06-02 14:00:52 -05:00
AndrolGenhald
2f090e5722
Fix TypeCombiner::combine
to not modify TIntRange arguments.
...
This keeps coming up in obscure places, hopefully this fixes it once and for all. I would reeeaaally love to have an immutable type system at some point...
2022-06-02 12:36:41 -05:00
Bruce Weirdan
de49946e4d
Update empty list/array notation
2022-05-28 16:19:49 -04:00
Bruce Weirdan
ff50516fbd
Post-merge fixes
2022-05-28 15:05:17 -04:00
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master
2022-05-28 14:49:12 -04:00
AndrolGenhald
31b4dceaf4
Improve handling of unsupported references ( fixes #8018 ).
2022-05-26 18:28:23 -05:00
asrar
f94b7abb18
chore: add another test
2022-05-22 18:38:18 +02:00
asrar
e28831dff8
feat: fix ci + preserve existing throws
2022-05-22 18:27:38 +02:00
asrar
c6854cf567
Adds support for fixing missing throws doc block
2022-05-21 17:39:51 +02:00
AndrolGenhald
80e94daefb
Fix class const issue when using floats declared in future consts ( fixes #7973 ).
...
- Calculate literal type for float arithmetic instead of only for int arithmetic
- Fix copy/paste fail causing InvalidConstantAssignmentValue to be marked as fixable
2022-05-20 14:46:05 -05:00
Matt Brown
990887148c
Fix #7968 - combine and simplify types where necessary in ternary analysis
2022-05-19 22:32:14 -04:00
hirokinoue
e7005245b8
add test case for implode()
2022-05-14 23:36:51 +09:00
Theodore Brown
4eef964048
Infer object shape when array or scalar is cast to object
...
Also detect redundant object casts.
Fixes #7916 , fixes #7934
2022-05-09 20:31:29 -05:00
Andrew Nagy
2264fd5b50
more cleanup
2022-04-28 18:28:59 +00:00
Andrew Nagy
7819821be9
fix tests
2022-04-28 18:26:38 +00:00
Andrew Nagy
2d8cc8d623
fixes from shepard
2022-04-28 18:20:51 +00:00
Andrew Nagy
e5c9952963
cleanups
2022-04-28 18:12:50 +00:00
hirokinoue
4bb5c38eb6
add test case for usort()
2022-04-29 00:52:37 +09:00
hirokinoue
139948e774
add test case for uksort()
2022-04-29 00:33:08 +09:00
hirokinoue
d4470cc99e
add test case for uasort()
2022-04-29 00:18:27 +09:00
hirokinoue
c7b9e1eebb
add test case for shuffle()
2022-04-28 23:18:39 +09:00
hirokinoue
db565f1d32
add test case for rsort()
2022-04-28 23:05:33 +09:00
Matt Brown
1e15ed393a
Fix merge conflict with attribute tests
2022-04-27 10:31:58 -04:00
Matt Brown
fccc366c1e
Merge pull request #7887 from ging-dev/lsp-fixes
...
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
d064d9fc6c
Add test
2022-04-27 01:47:02 -04:00
Matt Brown
2ef993928c
Document @psalm-ignore-variable-*
2022-04-27 01:46:13 -04:00
Matt Brown
a9e3c1fdc1
Fix namespaced min/max int range keyword issue introduced in #7775 .
2022-04-27 01:44:57 -04:00
Matt Brown
402280d4f9
Merge pull request #7791 from ohader/issue-7771-4x
...
Avoid json_encode when serializing non-UTF8 literals
2022-04-27 01:44:06 -04:00
Matt Brown
20351c6667
Avoid json_encode when serializing non-UTF8 literals
...
`\Psalm\Internal\Clause::$hash` basically holds a hash on
arbitrary input literals, used for later comparison. Using
`json_encode` fails when dealing with non-UTF8 literals,
which has been replaced by plain PHP `serialize`.
Resolves : #7771
2022-04-27 01:42:37 -04:00
Matt Brown
d0524c2418
Forbid min bound greater than max bound in int range
2022-04-27 01:38:21 -04:00
Matt Brown
9cc2af56b4
Support Stringable before PhpToken autoloading
2022-04-27 01:36:17 -04:00
Matt Brown
0c65a19554
Allow null to ArrayAccess::offsetSet $offset param
2022-04-27 01:34:09 -04:00
Matt Brown
d58736a550
fix #7747 : DateInterval::createFromDateString can be false
2022-04-27 01:32:38 -04:00
Andrew Nagy
2c1100d45e
Merge branch '4.x' into feature/upgrade-lsp
2022-04-26 21:12:43 +00:00
hirokinoue
3a6ebbb8ff
add test case for sort()
2022-04-24 01:00:38 +09:00
hirokinoue
63faa0c919
test the correct function
2022-04-24 00:54:58 +09:00
hirokinoue
a525342bc7
add test case
2022-04-16 14:05:51 +09:00
orklah
6d0cc07255
Merge pull request #7838 from VincentLanglet/sortTypes
...
Fix Incompatible types found for T (Stub&ProxyQueryInterface is not in ProxyQueryInterface&Stub)
2022-04-10 10:20:30 +02:00
Jeremiasz Major
5717516f2f
Remove @psalm-generator-return
annotation
2022-04-09 22:15:37 +02:00
Vincent Langlet
48bc030eec
Add test
2022-04-09 21:59:23 +02:00
Jeremiasz Major
ce25b39b5d
Document @psalm-ignore-variable-*
2022-04-08 00:30:23 +02:00
Jeremiasz Major
e1fe1161bd
Remove documented annotations from wall of shame
2022-04-07 21:44:33 +02:00
Jeremiasz Major
f4f1a26cf9
Document @psalm-yield
2022-04-07 21:43:12 +02:00
orklah
b72f0564bc
fix refining lowercase string and non-empty-string together
2022-04-05 21:05:23 +02:00
Andrew Nagy
979ae34268
Merge branch '4.x' of https://github.com/vimeo/psalm into feature/upgrade-lsp
2022-03-31 18:02:36 +00:00
AndrolGenhald
0bdf9425e3
Fix namespaced min/max int range keyword issue introduced in #7775 .
2022-03-30 16:08:14 -05:00
Andrew Nagy
26434c525f
Merge branch '4.x' of https://github.com/vimeo/psalm into feature/upgrade-lsp
2022-03-25 17:01:05 +00:00
Oliver Hader
9e4e468907
Adjust test case format
...
Related: #7771
2022-03-16 10:35:36 +01:00
Oliver Hader
b00d9e9514
Add test case reproducing issue #7771
...
Related: #7771
2022-03-15 10:34:46 +01:00
orklah
32f10c392d
Merge pull request #7788 from AndrolGenhald/attribute-analysis-improvements
...
More attribute fixes.
2022-03-14 21:11:19 +01:00
AndrolGenhald
08d4d797ef
More attribute fixes.
2022-03-14 14:15:07 -05:00
Matthew Brown
a9ccfd3da4
Fix test with sort
2022-03-14 13:02:55 -04:00
Matthew Brown
76119237cc
Fix #7776
...
When a new clause contains tautology it can be disregarded entirely
2022-03-12 23:21:42 -05:00
Matthew Brown
ed4782e0e0
Improve performance of large formula operations
2022-03-12 22:31:12 -05:00
Semyon
9beb0a62b2
Forbid min bound greater than max bound in int range
2022-03-11 17:26:59 +03:00
Semyon
a7e98f4bfc
Forbid any non literal int in int range (except min and max named objects)
2022-03-11 17:26:07 +03:00
Matthew Brown
da47f198ad
Remove reference
2022-03-07 14:59:11 -05:00
Matthew Brown
d17435252a
Remove unused class
2022-03-07 14:57:13 -05:00
Matthew Brown
9b69c7a089
Remove references to unused SqlStringProvider plugin
2022-03-07 14:54:35 -05:00
orklah
769e316f52
Merge pull request #7760 from mtk3d/fix/array_column_type_inference
...
Fix #7750 : array_column type inference
2022-03-07 19:00:37 +01:00
Mateusz Cholewka
cd1b155f53
test if the type of second argument is not uncertain
2022-03-07 14:10:03 +01:00
orklah
19ac15077f
Merge pull request #7759 from franmomu/fix_array_access_offsetset
...
Allow null to ArrayAccess::offsetSet $offset param
2022-03-06 22:35:00 +01:00
Mateusz Cholewka
70abbbee01
refactor array column test
...
add one more test when index key not exist in array
reorganise samples to keep all similar together
2022-03-06 15:45:22 +01:00
Mateusz Cholewka
d48965d929
add failing test
2022-03-06 14:09:07 +01:00
Fran Moreno
ff195e76c9
Allow null to ArrayAccess::offsetSet $offset param
2022-03-06 13:47:32 +01:00
Ne-Lexa
a57bb1f128
fix #7747 : DateInterval::createFromDateString can be false
2022-03-05 22:37:55 +03:00
Andrew Nagy
e18f9ccecb
Merge branch '4.x' of https://github.com/vimeo/psalm into feature/upgrade-lsp
2022-03-04 18:04:53 +00:00
orklah
cb158726a0
Merge pull request #7359 from Patrick-Remy/feat/properties-of
...
feat(types): add properties-of<T> type
2022-02-28 19:28:21 +01:00
orklah
2f3c150690
merge fixes
2022-02-26 21:28:15 +01:00
orklah
0fe6eaf5d9
Merge remote-tracking branch 'upstream/4.x' into upstream-master13
2022-02-26 21:26:59 +01:00
orklah
fc2c6ab4d5
Merge pull request #7727 from AndrolGenhald/attribute-analysis-improvements
...
Attribute analysis improvements
2022-02-24 21:34:05 +01:00
orklah
26bfc95b13
allow SimpleTypeInferer to infer non empty lists
2022-02-24 20:57:29 +01:00
AndrolGenhald
43764f0c3d
Add Reflection getAttributes analysis.
2022-02-23 22:12:32 -06:00
AndrolGenhald
1387f94324
Attribute analysis improvements.
2022-02-23 22:12:32 -06:00
Patrick Remy
be49037d70
feat: add template support to properties-of<T>
2022-02-23 21:30:09 +01:00
orklah
3a85f49268
Merge pull request #7673 from VincentLanglet/pdoException
...
PDOException extends RuntimeException and can use int code errors
2022-02-23 13:45:57 +01:00
Bei Xiao
40cc346991
Update stub
2022-02-23 00:52:53 +02:00
Bei Xiao
0b24b07423
Specify required php version for test
2022-02-22 23:41:53 +02:00
Patrick Remy
d81c74eb62
style: fix linting issues and failing tests
2022-02-22 20:13:24 +01:00
Patrick Remy
6e783d863d
feat: ignore static properties in properties-of<T>
2022-02-22 19:49:03 +01:00
Bei Xiao
6a3b5679fe
Support interfaces extending enums
2022-02-22 16:04:56 +02:00
Aaron Piotrowski
97b5685f55
Fix first-class callable in loop
2022-02-21 18:37:20 -06:00
Patrick Remy
9c6deacc69
feat: expand properties-of to keyed array
2022-02-21 23:02:27 +01:00
Patrick Remy
30fac906c6
feat(types): add properties-of<T> type
2022-02-21 21:15:02 +01:00
AndrolGenhald
103ec628b0
Improve tests.
2022-02-21 10:44:59 -06:00
AndrolGenhald
04c0db5aff
Use current context when analyzing attributes ( fixes #7710 ).
2022-02-21 10:38:50 -06:00
Bruce Weirdan
997bded2e3
Merge branch '4.x' into upstream-master
2022-02-21 01:08:21 +02:00
orklah
b8cda9eb00
Merge pull request #7684 from AndrolGenhald/bugfix/minor-reference-fixes
...
Fix some minor issues with references.
2022-02-20 23:21:56 +01:00
Bruce Weirdan
97bd81cf5e
Merge pull request #7699 from AndrolGenhald/bugfix/int-range-unpacking
2022-02-19 00:04:32 +02:00
AndrolGenhald
9310a4ff5a
Fix issues with int range unpacking and with min/max.
2022-02-18 15:55:26 -06:00
AndrolGenhald
525a86e19d
Improve bool to int casting.
2022-02-18 13:22:17 -06:00
Andrew Nagy
045bbe23a9
basic testing, disable log filtering
2022-02-18 17:29:09 +00:00
AndrolGenhald
ea2f452c25
Analyze attribute statements instead of constructing virtual statements.
2022-02-18 08:18:34 -06:00
AndrolGenhald
d09e420939
Add @psalm-check-type
and @psalm-check-type-exact
.
...
I initially added these as part of my TryAnalyzer rewrite to allow testing complicated `finally` types like this:
```
$foo = 1;
try {
$foo = 2;
} catch (Exception $_) {
$foo = 3;
} finally {
$bar = $foo;
/** @psalm-check-type-exact $bar = 1|2|3 */;
}
/** @psalm-check-type-exact $bar = 2|3 */;
```
Using the `'assertions'` in tests doesn't work since the type is different inside the `finally`.
I decided to extract the new annotation from the rest of my changes and do a separate pull request since I think others may find it useful, and it should be much easier to review than the entire TryAnalyzer rewrite.
2022-02-17 10:37:13 -06:00
AndrolGenhald
580278d323
Fix some minor issues with references.
...
References assigned to properties on `$this` should never be unused.
Using a `@var` docblock before a reference should be allowed if it targets a variable instead of the assignment statement.
2022-02-17 09:31:33 -06:00
Bruce Weirdan
e517295f7e
Fixed PSR-4 warnings
...
Fixes the following warnings that were emitted by `composer install`:
```
Generating optimized autoload files
Class Psalm\Tests\KeyOfTemplateTest located in ./tests/Template/KeyOfTemplateTest.php does not comply with psr-4 autoloading standard. Skipping.
Class Psalm\Tests\ValueOfTemplateTest located in ./tests/Template/ValueOfTemplateTest.php does not comply with psr-4 autoloading standard. Skipping.
```
2022-02-17 03:52:07 +02:00
Bruce Weirdan
e47752afb4
Merge pull request #7666 from AndrolGenhald/more-class-const-improvements
...
More class const improvements.
2022-02-16 03:43:37 +02:00
Mark McEver
828b093964
Prevent unnecessary filter_var() warnings on primitive types
2022-02-15 14:13:44 -06:00
Andrew Nagy
cc8c775abf
fix linting
2022-02-15 00:18:49 +00:00
Vincent Langlet
694157b2e0
PDOException extends RuntimeException and can use int code errors
2022-02-14 21:04:10 +01:00
AndrolGenhald
cc2334f40d
More class const improvements.
...
Add InvalidClassConstType issue as alternative to LessSpecificClassConstType when type isn't contravariant.
Handle final class consts (#6395 ).
Use double quotes for types in class const issues.
2022-02-13 17:19:25 -06:00
orklah
5aa06ae64e
fix merge issues
2022-02-14 00:12:31 +01:00
orklah
1142c818c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master9
2022-02-14 00:10:28 +01:00
orklah
b796f4558a
Merge pull request #7665 from orklah/matchcount
...
fix count with match on arrays
2022-02-13 22:49:31 +01:00
orklah
97a6abd823
don't anonymize call to count to allow assertions on count to be retrieved
2022-02-13 22:38:38 +01:00
AndrolGenhald
32c389482c
Fix issue with nested try
block and add more tests.
2022-02-13 15:30:06 -06:00
AndrolGenhald
7b1599d783
Fix false positive for unused variable in try ( fixes #7613 ).
2022-02-13 15:14:59 -06:00
orklah
aaf34d7573
add test
2022-02-13 19:38:45 +01:00
orklah
59d3d2aa31
Merge pull request #7655 from orklah/enumCollapsing
...
Enum collapsing
2022-02-13 11:01:07 +01:00
orklah
9cc82d55f7
add test
2022-02-13 10:52:22 +01:00
Bruce Weirdan
edddc87002
Merge branch '4.x' into upstream-master
2022-02-13 07:14:23 +02:00
Bruce Weirdan
45a19b3f3c
Honour global function suppressions for UndefinedFunction
...
Fixes vimeo/psalm#7610
2022-02-13 00:22:55 +02:00
orklah
e6d491a4ab
Merge remote-tracking branch 'upstream/master' into upstream-master7
2022-02-12 10:01:08 +01:00
orklah
fac55576ab
Merge remote-tracking branch 'upstream/4.x' into upstream-master7
2022-02-12 09:59:55 +01:00
orklah
24ae96b373
remove usage of totallyTyped internally
2022-02-12 09:51:06 +01:00
orklah
5c2336f4d0
skip a test because we removed the feature for now
2022-02-11 21:53:29 +01:00
Bruce Weirdan
11e60fa261
Merge branch '4.x' into upstream-master
2022-02-11 03:51:48 +02:00
Matthew Brown
6d057669fc
Fix #6683 by improving simplification of CNF ( #7631 )
2022-02-10 19:37:42 -05:00
Matthew Brown
b49b5f1c20
Make error message for truthy/falsy more accurate
2022-02-10 18:46:22 -05:00
Matthew Brown
547f11ebd9
Fix signature
2022-02-10 18:35:50 -05:00
Matthew Brown
c885dbcbe0
Prevent duplicate type comparison errors
2022-02-10 01:04:14 -05:00
Matthew Brown
2eca28c912
Remove more unused code from LoopAnalyzer
2022-02-09 16:37:15 -05:00
Bruce Weirdan
21e6371ce2
Strip colours from success message
...
Fixes vimeo/psalm#7619
2022-02-09 15:35:40 +02:00
Matthew Brown
457abc6e13
Don’t subtract int from array-key if not equality
2022-02-08 11:24:05 -05:00
Matthew Brown
13824d5a33
Fix awkward workaround for loop assignment map
2022-02-08 10:59:29 -05:00
AndrolGenhald
5b469ca577
Fix crash when assigning reference to unknown array offset.
2022-02-04 08:32:35 -06:00
AndrolGenhald
588d9e08bc
Fix extension capitalization issue, add extensions to version message.
2022-02-03 11:34:50 -06:00
Vincent
3c3e692e7e
AtomicStaticCallAnalyzer: clear tmp var from context ( fix #7556 )
2022-02-02 13:51:54 +01:00
Bruce Weirdan
dadb1f2167
Merge pull request #7539 from vimeo/revert-7363-81_returntypewillchange
2022-02-01 01:03:09 +02:00
Bruce Weirdan
f61193b798
Reinstate MethodSignatureMustProvideReturnType
...
It's never emitted, but is there for BC.
2022-01-31 23:38:15 +02:00
orklah
68e67aeb10
Merge pull request #7546 from orklah/impure-callable
...
Handle first class callable on unknown functions
2022-01-31 22:02:35 +01:00
orklah
5a19d42dab
fix test
2022-01-31 21:51:31 +01:00
orklah
2e01e9b7cd
Merge pull request #7396 from Patrick-Remy/feat/key-of-value-of-improvements
...
feat: make key-of/value-of usable with non-const arrays
2022-01-31 21:39:01 +01:00
orklah
a598efb4ab
Handle first class callable on unknown functions
2022-01-31 21:36:01 +01:00
adrew
121a801616
Fix object constant inference
2022-01-31 23:03:34 +03:00
Patrick Remy
51d4bf556a
fix: replace template args in key-of/value-of
...
Extend TTemplateKeyOf from Atomic instead of Scalar, to ensure it is
only compared in AtomicTypeComparator to reduce duplicate code.
2022-01-31 20:53:36 +01:00
orklah
fc281672ea
fix wrong detection of purity
2022-01-31 20:52:25 +01:00
Bruce Weirdan
603714518b
Revert "PHP 8.1: Report missing typehints in overridden native methods"
2022-01-31 14:37:42 +02:00
6f51b4a432
Fix tests
2022-01-31 10:28:47 +01:00
52872c05a8
Fixes
2022-01-31 10:06:32 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits
2022-01-31 10:06:31 +01:00
Bruce Weirdan
997592de64
Merge pull request #7530 from ohader/issue-7528
2022-01-31 10:36:47 +02:00
Bruce Weirdan
0cbcd0fcf9
Fixed ExceptionCodeTest provider to emit array keys
2022-01-31 00:26:23 +02:00
Bruce Weirdan
a2977a5ca9
Merge branch '4.x' into upstream-master
2022-01-31 00:16:27 +02:00
Oliver Hader
e3602bbfe1
[FEATURE] Allow to intercept adding issue in IssueBuffer
...
This change introduces new `BeforeAddIssueEvent` which is invoked
from `IssueBuffer::add`, which allows to collect and intercept code
issue in a generic way.
Resolves : #7528
2022-01-30 17:46:08 +01:00
orklah
f93bd10c61
Merge pull request #7517 from orklah/fixEmptyArray
...
Fix empty array
2022-01-30 16:14:24 +01:00
orklah
0592c03cda
fix issues resulting from previous commit
2022-01-30 16:05:38 +01:00
Vincent Langlet
584344fda3
Failing test
2022-01-30 15:17:18 +01:00
Oliver Hader
62a0ece035
!!! Allow plugins to modify Config::$fileExtensions early
...
ProjectAnalyzer consumed Config::$fileExtensions early in its
constructor - without having processed plugins' modifications,
registering their custom scanners or analyzer implementations.
This change
* adds new specific interface \Psalm\Plugin\FileExtensionsInterface
to be used by plugin implementations
* extracts file extension handling from \Psalm\PluginRegistrationSocket
and interface \Psalm\Plugin\RegistrationInterface to a new dedicated
\Psalm\PluginFileExtensionsSocket and new interface
\Psalm\Plugin\FileExtensionsInterface
!!! this is a breaking change in PluginRegistrationSocket !!!
* adds runtime in-memory cache for Config::$plugins
* calls new method Config::processPluginFileExtensions(), providing
modifications to file extension only early in ProjectAnalyzer
* adjusts documentation
2022-01-30 13:06:00 +01:00
orklah
1220320e0b
fix some iterator stubs ( #6970 )
...
* fix some iterator stubs
* fix iterators
* update stubs
* fix a test
* fixes
* fixes
* fix a test
* fix
2022-01-30 01:18:05 +01:00
Matthew Brown
faaf7690f6
Remove mic-drop hack from if analysis ( #7484 )
...
* Remove mic-drop hack from if analysis
* Remove more special handling
* Remove some unnecessary ElseAnalyzer code
* Add back necessary code
* Fix return type of method never returning null
* Add a comment
* Simplify && handling
* Add comments to make stuff clearer
* Move if-specfic logic to more appropriate setting
2022-01-28 18:30:47 -05:00
orklah
048025b1d6
Merge pull request #7511 from orklah/literal-inequality
...
improve literal inequality with ranges and rework GreaterThan/LessThan assertions
2022-01-28 22:27:09 +01:00
orklah
3b73654db7
handle literal inequality with ints
2022-01-28 21:59:30 +01:00
orklah
4609bc4e25
Merge pull request #7471 from klimick/function-dynamic-storage-provider
...
Function dynamic storage provider
2022-01-28 18:46:26 +01:00
orklah
2966f1c9d4
Merge pull request #7107 from AndrolGenhald/feature/5482-load-extensions-based-on-composer-config
...
Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482 ).
2022-01-28 18:45:52 +01:00
AndrolGenhald
b473d812aa
Fix side effect when loading config.
2022-01-28 09:26:58 -06:00
adrew
70cea447c8
Fix CS
2022-01-28 15:18:30 +03:00
adrew
dd0e00e153
Renaming all occurrences of "function dynamic storage" to "dynamic function storage"
2022-01-28 15:18:30 +03:00
adrew
e5dae6a901
Prevent first-class-callable handling with FunctionDynamicStorageProvider
2022-01-28 15:18:30 +03:00
adrew
9b383a5a19
Try to create public api for new hook
2022-01-28 15:18:30 +03:00
adrew
aefe971b90
Fix template creation in ArrayMapStorageProvider
2022-01-28 15:18:30 +03:00
adrew
ce1cec5d3a
Using FuncCall instead of list<Arg> in FunctionDynamicStorageProvider for more flexibility
2022-01-28 15:18:30 +03:00
adrew
3210aab278
Test for FunctionDynamicStorageProvider
2022-01-28 15:18:29 +03:00
AndrolGenhald
282518ce5f
Fix failing case in ClassConstAnalyzer and add test.
2022-01-27 21:50:36 -06:00
Patrick Remy
51cab704c4
fix: key-of/value-of handle nested template params
2022-01-28 00:04:21 +01: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
Patrick Remy
f87e429e58
fix: infer key-of/value-of type if still templated
...
Not in all cases the TemplateParam gets replaced before type checking,
in these cases, use the defined `as` type.
Refactor to extract key/value type of array union to method.
2022-01-27 22:39:50 +01:00
Patrick Remy
8cd5ccd076
feat: make value-of<T>
capable for template types
2022-01-27 22:28:40 +01:00
Patrick Remy
ed87465f71
tests: correct 'SKIPPED' prefix for skipped test
2022-01-27 22:28:40 +01:00
Patrick Remy
1f28d025c3
feat: allow unions for key-of/value-of
...
Add tests for TValueOfArray.
2022-01-27 22:28:24 +01:00
Patrick Remy
2880d046ce
feat: make key-of/value-of usable with non-const arrays
2022-01-27 22:22:14 +01:00
orklah
9168cef2d4
Merge remote-tracking branch 'upstream/4.x' into upstream-master6
2022-01-26 21:06:25 +01:00
Matthew Brown
ac29afcfe4
Don’t expect config exception in test
2022-01-26 14:30:01 -05:00
AndrolGenhald
740a10141d
Fix crash when a reference is reassigned in a loop.
2022-01-26 12:56:17 -06:00
AndrolGenhald
57b99be519
Improve reference support for assertions, array offsets, and properties.
2022-01-26 12:55:47 -06:00
AndrolGenhald
089700d1be
Add more reference tests.
2022-01-26 12:55:47 -06:00
AndrolGenhald
3c7d176f87
Minor CS fix, phrasing improvement, fix test.
2022-01-26 12:55:47 -06:00
AndrolGenhald
f9450656e1
Add support for references and improve UnusedVariable checks ( fixes #7254 ).
2022-01-26 12:55:47 -06:00
AndrolGenhald
b68c6116d8
Use PHP 8.1 when testing AmbiguousConstantInheritance.
2022-01-25 15:49:09 -06:00
AndrolGenhald
0b81f46bb1
Fixes after rebasing.
2022-01-25 15:31:09 -06:00
AndrolGenhald
0edf260d8b
Improve class constant static analysis.
...
Add class const covariance support (fixes #5589 ).
Add check for overriding const from interface in PHP < 8.1 (fixes #7108 ).
Add check for ambiguous const inheritance.
2022-01-25 15:20:17 -06:00
orklah
204d09b271
fix error with 0 being considered positive
2022-01-25 21:54:55 +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
ElisDN
9f01c16ae9
Fix array_replace type
2022-01-25 15:22:50 +03:00
Matthew Brown
8ab0eec4dd
Fix key
2022-01-25 01:36:23 -05:00
Matthew Brown
302c72d5b1
Add a couple of currently-working tests
2022-01-25 01:32:35 -05:00
Matthew Brown
c974f23852
Simplify context references
2022-01-24 16:35:42 -05:00
Matthew Brown
61d450a267
Fix combination of templated types
2022-01-24 13:56:32 -05:00
Matthew Brown
944b281cbe
Prevent negation from removing unmatched template vars
2022-01-24 13:20:02 -05:00
orklah
f1c4b62f5c
Merge pull request #7414 from b2pweb/call-docblock-method-using-parent
...
Add support of docblock method using parent keyword
2022-01-24 13:02:57 +01:00
orklah
0619b404e5
Merge pull request #7390 from VincentLanglet/exceptionCode
...
Add Exception->getCode() return type provider
2022-01-24 12:56:57 +01:00
Vincent
280de4bc98
Fix undefined parent method call (ref #7414 )
2022-01-24 09:17:29 +01:00
orklah
63b802bff4
remove TPositiveInt
2022-01-23 23:49:23 +01:00
orklah
7c4f08067b
Merge remote-tracking branch 'upstream/4.x' into upstream-master5
2022-01-23 23:44:04 +01:00
orklah
a7b72b865f
remove TPositiveInt usage for TIntRange
2022-01-23 22:04:18 +01:00
orklah
82d84b0b3a
fix internal properties on interfaces
2022-01-23 13:08:35 +01:00
AndrolGenhald
7d256975e4
Fix cs/psalm errors after rebase.
2022-01-22 17:06:54 -06:00
AndrolGenhald
1686f28a37
Default to using inferred type unless in late static binding context.
2022-01-22 17:06:54 -06:00
AndrolGenhald
0fb0632e0d
Infer type from known ternary condition.
2022-01-22 17:06:54 -06:00
AndrolGenhald
558208e44e
Add type checking for class const assignments, fix several other const issues.
2022-01-22 17:06:54 -06:00
AndrolGenhald
c877ce031e
Use inferred type instead of annotated type where possible.
2022-01-22 17:06:54 -06:00
AndrolGenhald
c18a155f77
Support type annotations for class consts ( fixes #942 ).
2022-01-22 17:06:53 -06:00
AndrolGenhald
3510f55e31
Check for indirect circular dependencies with stubbed parents.
2022-01-22 13:56:10 -06:00
AndrolGenhald
c24cf9aa8c
Add test for circular reference with stub class.
2022-01-22 13:54:44 -06:00
AndrolGenhald
2f2c24cb4f
Add reproducer for stub parent class not being loaded.
2022-01-22 13:30:10 -06:00
orklah
0e891f25ad
refactor description of types in Atomic
2022-01-22 19:34:57 +01:00
orklah
841d4f4429
improve support for enum_exists
2022-01-22 18:27:24 +01:00
orklah
070a1cc7a3
fix merge induced errors
2022-01-22 18:05:32 +01:00
orklah
af1888b631
Merge remote-tracking branch 'upstream/4.x' into upstream-master4
2022-01-22 17:48:42 +01:00
orklah
997d5d5f5f
handle two more cases of firstClassCallable
2022-01-22 17:37:35 +01:00
orklah
d1a946c221
Merge pull request #7454 from petewalker/feat/native-intersections
...
feat: Handle native intersection types
2022-01-22 11:18:54 +01:00
Pete Walker
057a99c9f1
fix: Tests / minor bug
2022-01-22 00:00:45 +00:00
Pete Walker
299eca4daa
fix: Add PHP version checks / more tests
2022-01-21 17:31:48 +00:00
Pete Walker
a3bdf1ba8c
feat: Handle native intersection types
...
Adds native intersection type handling to psalm, removing the previous `UnexpectedValueException`.
Where an intersection is found in the parse tree, the types are resolved using the existing `Type::intersectUnionTypes` function, which I assume is being used when they're encountered in the existing docblock annotations.
I've added a handful of tests to cover this, but they're certainly not exhaustive. Are there any specific edge cases I should target?
This change feels way too simple... so apologies if I've missed something fundamental..!
2022-01-21 12:59:55 +00:00
orklah
f9b26acf6e
Array key exists assert both ways
2022-01-21 00:26:37 +01:00
orklah
f9e392316f
remove unused imports
2022-01-21 00:17:06 +01:00
orklah
fe9d3f02a8
nitpicks
2022-01-20 23:47:41 +01:00
Matthew Brown
0a81f8cd6c
Use objects, not strings, for assertions ( #7410 )
...
* Use objects, not strings, for assertions
* Remove unnecessary param
* Remove some unnecessary checks
* Fix bad find/replace
* Add note about assertions no longer stored as strings in UPGRADING.md
2022-01-20 17:33:06 -05:00
orklah
eb53f7e99c
fix tests
2022-01-20 22:18:03 +01:00
orklah
6f1a5e8a47
Merge pull request #7417 from klimick/partially-applied-closure-inference
...
Contextual type inference for high order function arg
2022-01-20 21:03:46 +01:00
Alberto Piai
9b22d63c5b
fix proc_open stub for php >= 8.0
...
The argument names are defined here:
https://github.com/php/php-src/blob/PHP-8.0.0/ext/standard/basic_functions_arginfo.h#L1773-L1780
2022-01-20 13:57:34 +01:00
Vincent Quatrevieux
c7bfc03a6b
Merge branch '4.x' into call-docblock-method-using-parent
2022-01-20 08:59:50 +01:00
orklah
5c4be6bc21
Merge pull request #7435 from orklah/old-phpunit
...
drop phpunit compatibility aliases
2022-01-19 20:36:44 +01:00
orklah
7d07f42790
fix CS
2022-01-19 20:36:09 +01:00
orklah
5a6dccd4a9
Merge pull request #7420 from orklah/remove-old-things
...
Remove forbidEcho
2022-01-19 20:32:19 +01:00
orklah
bbfdd57d5c
Merge pull request #7363 from zoonru/81_returntypewillchange
...
PHP 8.1: Report missing typehints in overridden native methods
2022-01-19 20:31:54 +01:00
orklah
52a7f0694e
drop compatibility aliases
2022-01-19 19:29:16 +01:00
1914be4ca1
Rollback
2022-01-19 12:44:55 +01:00
78a125ab95
Fix
2022-01-19 12:33:16 +01:00
d970661182
Add separate issue
2022-01-19 12:20:50 +01:00
cee9eb0ead
PHP 8.1: Report missing typehints in overridden native methods
2022-01-19 12:06:35 +01:00
Vincent
7b25ca75f4
Resolve generics of inherited pseudo methods ( fix #7419 )
2022-01-19 11:45:19 +01:00
orklah
cb976f8416
fix merge induced errors
2022-01-18 23:07:35 +01:00
adrew
7e623ed48e
Upcast invokable to callable during hof arg analysis
2022-01-19 00:37:05 +03:00
orklah
477c0113c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master3
2022-01-18 18:37:04 +01:00
orklah
dceaa117cf
remove forbidEcho
2022-01-18 18:25:18 +01:00
orklah
5f749c8a33
remove forbidEcho
2022-01-18 18:14:39 +01:00
adrew
379d0d6c49
Add tests
2022-01-18 18:54:47 +03:00
adrew
3886d5b4c6
Add test for high order function arg inference in class context
2022-01-18 13:12:13 +03:00
adrew
fac7115eae
Add simple test for high order function arg inference
2022-01-18 12:48:53 +03:00
Vincent
33f0de073f
Add test case for parent method call without declared pseudo method
2022-01-18 09:34:05 +01:00
adrew
00ce1107d3
Infer partially applied closure arg by previous function arg
2022-01-18 03:02:21 +03:00
Fabien Villepinte
c9eafa15ad
Improve signature of DOMDocument::loadXML()
2022-01-17 22:52:58 +00:00
Vincent
09fc43a4d8
Add support of docblock method using parent keyword ( fix #7411 )
2022-01-17 19:26:42 +01:00
Matthew Brown
e1d2da792c
More specific test name
2022-01-16 15:34:25 -05:00
Ricardo Boss
26dd4c5b8f
Try to provide literal int types when possible ( fixes #6966 ) ( #7071 )
...
* Fixed vimeo/psalm#6966
* Only accept >= 0 values for mode argument in round()
* Made round() only return float or literal float values and remove unneeded test
* Registered RoundReturnTypeProvider
* Updated cast analyzer to handle single string literal int values as literal ints
* Fixed psalm errors
* Fix invalid property accesses
* Addressed comments
* Added Tests
* Marked RoundReturnTypeProvider as internal
* Fixed CS
2022-01-16 21:33:04 +01:00
Matthew Brown
91902943bd
Make test more of a real-world example
2022-01-16 10:19:51 -05:00
andrew
10012c9e09
Fix self parsing for psalm-if-this-is and psalm-self-out
2022-01-16 16:11:40 +03:00
orklah
de824d6724
Merge pull request #7403 from orklah/readonly_phpdoc_promoted
...
support @readonly for promoted properties
2022-01-16 09:38:37 +01:00
orklah
6578396afb
add test
2022-01-16 09:31:58 +01:00
orklah
3c726e76df
Merge pull request #7401 from orklah/getObjectVarsNoValue
...
Psalm can't be sure get_object_vars will return an empty array unless object is known AND final
2022-01-15 23:27:33 +01:00
orklah
3260b1ad74
make class final in test to revalidate what it's testing
2022-01-15 21:53:05 +01:00
orklah
0beb8e7a4e
fix test
2022-01-15 21:39:29 +01:00
orklah
4344c8ec3f
add test
2022-01-15 21:29:24 +01:00
orklah
e8c8161dd6
fix merge induced errors
2022-01-15 20:32:09 +01:00
orklah
5b82082bbd
Merge remote-tracking branch 'upstream/4.x' into upstream-master2
2022-01-15 20:21:00 +01:00
orklah
9a9243e5fe
Merge pull request #7385 from b2pweb/handle-template-on-pseudo-method
...
Add support of template for docblock methods
2022-01-15 11:26:03 +01:00
orklah
75947c97c6
Merge pull request #7391 from b2pweb/docblock-method-inheritance
...
Handle inherited docblock method
2022-01-15 11:24:06 +01:00
orklah
d2faa5b94f
fix errors after merge
2022-01-14 21:13:34 +01:00
orklah
b633619a2c
Merge remote-tracking branch 'upstream/4.x' into upstream-master
2022-01-14 21:01:25 +01:00
orklah
93fe3e81d4
Merge pull request #7304 from orklah/classconst5
...
Refactor Reconciler::handleLiteralEquality
2022-01-14 19:16:23 +01:00
Vincent
a52362465b
Handle inherited docblock method ( fix #7198 )
2022-01-14 10:30:09 +01:00
Matthew Brown
0ded59d968
Remove unused use
2022-01-13 19:01:56 -05:00
Vincent Langlet
b376a8d4d7
Wip
2022-01-13 22:23:41 +01:00
Vincent Langlet
b1285bd058
Fix cs
2022-01-13 21:53:34 +01:00
Vincent Langlet
1d6ae16504
Add Exception code return type provider
2022-01-13 21:44:06 +01:00
Matthew Brown
58b567a91d
Fix test
2022-01-13 14:44:24 -05:00
Matthew Brown
b49682a485
Simplify issue suppression in tests
2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys ( #7386 )
...
* Transformation that updates assertions
* Simplify transformation
* Ensure that all tests have keys
* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
Vincent
fe7665aaaf
Add support of template for docblock methods ( fix #7320 )
2022-01-13 11:04:37 +01:00
AndrolGenhald
ceb5644d5b
Add script to generate issues.md.
2022-01-12 15:22:21 -06:00
AndrolGenhald
240032568c
Add test for issues.md to ensure all documented issues are listed.
2022-01-12 14:29:23 -06:00
AndrolGenhald
7558ef5e85
Fix @covers annotation.
2022-01-11 10:03:00 -06:00
orklah
d52c3f0117
Merge pull request #7163 from dvz/explicit-symlink-resolution
...
Add explicit `resolveSymlinks` option for project directories
2022-01-10 21:50:08 +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
orklah
611583c481
Merge pull request #7354 from wouterj/issue-7353/issuehandlers-elements
...
Support multiple <issueHandlers> elements
2022-01-10 21:34:43 +01:00
Patrick Remy
a555543c0c
fix: pass static class name to ReturnTypeAnalyzer
2022-01-10 21:23:52 +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
orklah
549c02d661
Merge pull request #7356 from orklah/keep-class-strings-through-array_merge
...
keep class-strings through array_merge
2022-01-09 16:16:55 +01:00
orklah
413da78568
Merge pull request #7326 from orklah/short_closures_returning_never
...
allow short closure to return never
2022-01-09 16:01:26 +01:00
orklah
52ae26f143
fix test
2022-01-09 15:53:43 +01:00
orklah
65efab3a8d
keep class-strings through array_merge
2022-01-09 15:48:58 +01:00
Wouter de Jong
f92841f2df
Only pass existing paths to realpath()
...
`realpath()` returns `false` if the path does not exists. This caused
these tests to not test what they were expected to (due to `false` being
transformed into `""`, which never matches the project paths).
2022-01-09 14:23:48 +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
orklah
9877517284
add test
2022-01-09 00:37:16 +01:00
orklah
80f617decd
fix test
2022-01-09 00:37:16 +01:00
orklah
48ebbe8c4b
fix test
2022-01-08 22:52:22 +01:00
Bruce Weirdan
1a1b5a9e6a
Merge branch '4.x' into upstream-master
2022-01-08 23:38:29 +02:00
Matthew Brown
4abbd9cb1b
Simplify object comparison
2022-01-07 18:50:13 -05:00
orklah
0d9480ad00
Merge pull request #7335 from orklah/errors_on_int_reconciliation
...
Errors on superior/inferior reconciliation
2022-01-07 20:19:35 +01:00
orklah
5ce626fcdf
fix test
2022-01-07 19:39:24 +01:00
orklah
af28687708
fix reconciliation when the assertions is not part of the existing range and add tests
2022-01-07 19:39:19 +01:00
orklah
6296a60553
add new test that was failing before
2022-01-07 18:18:47 +01:00
Stefan Vetsch
7f2f0d99ec
Issue #7243 : Do not throw exception on xinclude with fallbacks
2022-01-07 09:40:19 +01:00
Bruce Weirdan
762ef8dab4
Merge branch '4.x' into upstream-master
2022-01-07 08:44:32 +02:00
orklah
cbb0c6398f
allow short closure with never
2022-01-06 21:36:34 +01:00
Fabien Villepinte
b9d8dd9d3f
Fix analysis when __invoke() exists
2022-01-06 21:22:18 +01:00
Bruce Weirdan
46bcb626f5
Merge pull request #7321 from weirdan/dont-crash-on-array_map-first-class-callable
2022-01-06 14:11:35 +02:00
Bruce Weirdan
fe036d4db0
Prevent crashes on array_map(...)
...
Fixes vimeo/psalm#7305
2022-01-06 10:38:58 +02:00
orklah
18ab5a099f
Merge pull request #7309 from orklah/emptyStringKeyedArray
...
fix empty string not quoted in keyed array offset
2022-01-06 09:37:28 +01:00
Bruce Weirdan
3fb3db3516
Merge branch '4.x' into upstream-master
2022-01-06 10:05:53 +02:00
orklah
f3bc55e409
Merge pull request #7312 from orklah/empty-array
...
Support PHPStan notation for empty-arrays
2022-01-06 08:45:40 +01:00
Bruce Weirdan
8726065d21
Applied ClosureToArrowFunctionRector
2022-01-06 00:48:04 +02:00
orklah
9d3a51db6a
remove obsolete test and fix a missing exception
2022-01-05 23:08:34 +01:00
orklah
030195a395
parse array{} into an empty array
2022-01-05 23:08:33 +01:00
orklah
a6a0769402
fix test
2022-01-05 22:39:13 +01:00
orklah
72216f9354
fix test
2022-01-05 22:36:22 +01:00
orklah
e7bc6f273a
don't crash when pushing a template to in_array
2022-01-05 22:33:20 +01:00
orklah
7e2b9d0fab
fix empty string in keyed array offset
2022-01-05 22:26:35 +01:00
Bruce Weirdan
94395f18a4
Applied JsonThrowOnErrorRector
2022-01-05 19:32:43 +02:00
Bruce Weirdan
758e0afd96
Merge branch 'master' into rector-literal-number-separator
2022-01-05 12:32:52 +02:00
Bruce Weirdan
9b488e673f
Merge pull request #7300 from weirdan/dead-code-phpversion
2022-01-05 12:31:12 +02:00
Matthew Brown
7595a3c579
Make treatment of interfaces and classes more symmetrical
2022-01-05 01:10:57 +00:00
Bruce Weirdan
c81c5faa83
Drop dead code based on PHP_VERSION_ID
...
Psalm now requires PHP 7.4, so this test is never skipped.
2022-01-05 01:49:27 +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
f5dc2ee964
Merge branch '4.x' into upstream-master
2022-01-04 19:42:08 +02:00
Fabien Villepinte
1fa6b612b1
Fix parse_url() return type
2022-01-04 16:09:18 +01:00
Bruce Weirdan
cf962eebc2
Promote conditional tests to always-running
2022-01-04 11:40:55 +02:00
Bruce Weirdan
30013cb81a
Drop orphaned token
...
Refs vimeo/psalm#7285
2022-01-04 10:13:44 +02:00
Bruce Weirdan
ff9b214f65
Merge branch '4.x' into upstream-master
2022-01-04 10:07:18 +02:00
orklah
6f9cbc698b
resolve type alias and class const on UnionTypeComparator
2022-01-04 00:14:08 +01:00
Bruce Weirdan
afa6497051
Dropped THtmlEscapedString
2022-01-03 22:48:59 +02:00
Bruce Weirdan
2e24a16cbb
Dropped legacy plugin API
2022-01-03 18:18:44 +02:00
Bruce Weirdan
ab60d311c2
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-less
2022-01-03 06:04:42 +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
d912663da4
remove isEmpty
2022-01-03 04:10:41 +02:00
Matthew Brown
83911c7408
Remove unnecessary references to empty in TypeCombiner
2022-01-03 04:10:41 +02:00
Matthew Brown
2358b96f54
Fix merge errors
2022-01-03 04:10:39 +02:00
orklah
0747b48d06
remove TEmpty
2022-01-03 04:09:59 +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
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion
2022-01-02 14:56:18 +02:00
orklah
8d6b781b3e
use consistent way to compare php version
2022-01-02 13:35:43 +02:00
Bruce Weirdan
36d5a2a83c
Merge pull request #7019 from zoonru/no_ksort_list
2022-01-02 07:37:21 +02:00
Bruce Weirdan
697db76dc1
Merge pull request #7252 from AndrolGenhald/feature/allow-assertions-on-mutable-object-properties
2022-01-02 07:29:02 +02:00
Bruce Weirdan
094a0651d7
Increase composer timeout
...
This should prevent random failures we've been observing lately.
2022-01-02 07:06:16 +02:00
Bruce Weirdan
376d2a389e
Merge pull request #7259 from klimick/infer-this-context-for-psalm-if-this-is
2022-01-02 05:31:24 +02:00
orklah
2a6f12296e
Merge pull request #7260 from orklah/6691
...
forbid calling impure callable in immutable context
2022-01-01 12:08:07 +01:00
orklah
8e5c9f02bb
fix test
2022-01-01 11:21:43 +01:00
orklah
8049438408
forbid calling impure callable in immutable context
2022-01-01 11:13:45 +01:00
adrew
29af83bf61
Add tests for psalm-if-this-is variables and template inference
2022-01-01 13:03:17 +03:00
adrew
878dfa2250
Variable types inference in method context when method marked with psalm-if-this-is
2022-01-01 13:03:17 +03:00
orklah
51ba96c09d
Merge pull request #7253 from orklah/5874
...
allow calling mutation_free function inside a mutation_free context
2021-12-31 00:24:29 +01:00
AndrolGenhald
1b9f57f214
Fix directory separator cross-platform issue.
2021-12-30 16:29:40 -06:00
AndrolGenhald
dd631c0c85
Skip reference tests, allow assertions on magic properties ( fixes #6770 ).
2021-12-30 16:23:59 -06:00
orklah
6c6eac9f2f
fix test
2021-12-30 22:39:30 +01:00
orklah
392402cf6d
allow calling mutation_free function inside a mutation_free context
2021-12-30 22:29:36 +01:00
AndrolGenhald
cb9231b62f
Add failing tests for reference property mutation.
2021-12-30 14:44:03 -06:00
AndrolGenhald
3ac497c811
Allow assertions on mutable object properties.
...
All of the functionality is already there, we just have to not prevent it.
2021-12-30 14:07:55 -06:00
adrew
4a903c71a1
Checking psalm-if-this-is before applying psalm-this-out
2021-12-30 21:48:25 +03:00
546438bec1
Another small fix
2021-12-30 12:05:03 +01:00
ff7abec2bd
Fix tests
2021-12-30 12:01:25 +01:00
Bruce Weirdan
03b7e94748
Merge pull request #7232 from trowski/issue-7196
2021-12-30 10:03:17 +02:00
orklah
f047d5bc53
allow suppressing unevaluatedCode
2021-12-29 00:44:48 +01:00
orklah
3828db52b9
Merge pull request #7229 from orklah/cleanup5
...
remove always true/false conditions
2021-12-27 22:08:06 +01:00
Aaron Piotrowski
e23a915bb1
Fix first-class callables when used with magic method, built-in, or undefined methods
...
Closes #7196 .
2021-12-27 14:29:33 -06:00
orklah
3ae80983cc
fix unused and CS
2021-12-27 20:10:39 +01:00
orklah
9029e1d613
remove always true/false conditions
2021-12-27 19:59:11 +01:00
adrew
87deb19a87
Remove dead code from test
2021-12-27 19:43:06 +03:00
adrew
c0ca383020
Contextual inference for closure param types
2021-12-27 19:35:37 +03:00
sji
a90456ed8b
trim whitespaces in namespaces specified at @psalm-internal
2021-12-27 02:31:11 +02:00
adrew
3d212c642c
Add test for mismatch param type from docblock
2021-12-27 00:45:26 +02:00
adrew
d6d0fc6704
Remove undefined variables
2021-12-27 00:45:25 +02:00
adrew
2e4d75d6bd
Fix closure param type inference in generic context
2021-12-27 00:45:22 +02:00
Bruce Weirdan
fb56d5ce58
Merge pull request #7210 from vstm/improve-cli-utils-argv-handling
2021-12-27 00:35:32 +02:00
orklah
d4fcb7f61c
handle literal equality with integer ranges
2021-12-26 21:09:27 +01:00
orklah
fb97980bf9
fix test
2021-12-26 19:27:13 +01:00
orklah
f7b6c4e1b6
escape more special chars in keyed array names that won't be read by the parser
2021-12-26 19:27:13 +01:00
Stefan Vetsch
3893abff72
Use directory separator to make test more portable
2021-12-24 15:55:24 +01:00
Stefan Vetsch
c3752b4a2b
Fix psalm issues
2021-12-24 10:59:39 +01:00
Stefan Vetsch
5331091f5e
Simplify argv handling, the first element is always the script name
2021-12-24 10:05:52 +01:00
Stefan Vetsch
ecc7400530
Add CliUtilsTest with test cases for old behaviour
2021-12-24 09:54:37 +01:00
orklah
2c9541c1ed
flag the context as "inside_conditional" when analyzing leftover cases to prevent emitting unused error
2021-12-23 22:18:27 +01:00
Tomasz Mlynski
daaa74ce41
Merge branch 'master' into explicit-symlink-resolution
2021-12-22 18:42:55 +01:00
Philip Hofstetter
fdeb1954c2
update docs for enum case deprecation
2021-12-22 06:16:42 +01:00
Philip Hofstetter
e8e968e8c2
recognize Deprecated attribute on enum cases
...
just like with properties, this recognizes both `Psalm\Deprecated` and
`JetBrains\PhpStorm\Deprecated`
2021-12-22 06:16:42 +01:00
Philip Hofstetter
d45cb64827
allow marking enum cases as @deprecated
2021-12-22 06:16:42 +01:00
orklah
cc618bc916
allow successful destructuring to also be null if the source was nullable
2021-12-20 22:48:27 +01:00
orklah
639b1b94a3
fix stub and fix test
2021-12-20 09:57:06 +01:00
Matthew Brown
2e32a18222
Fix callable negation
2021-12-18 19:42:43 +00:00
S.M. Ataur Rahman
e408abf119
Fixed ignoreTypeStats & useStrictTypes flag value detection for directories in config
2021-12-18 19:59:25 +06:00
orklah
ba6a4d8af5
fix test
2021-12-17 00:16:50 +01:00
orklah
9583d6a7e7
invert stub, add test
2021-12-17 00:12:54 +01:00
Matthew Brown
89a1c5acbc
Fix faulty comparison with typed closure
2021-12-16 16:39:08 +00:00
Bruce Weirdan
7e97c5c84e
Merge pull request #7167 from AndrolGenhald/bugfix/7164-conflicting-fake-variable
2021-12-15 20:56:51 +02:00
orklah
16c0496d1c
Merge pull request #7157 from nowaja/master
...
ISSUE-5962 Fixed wrong line number for @method annotations
2021-12-15 18:37:26 +01:00
orklah
2dfe45a96e
Merge pull request #7152 from orklah/7109
...
display class-strings in keyed arrays syntax and allow using them for assertions
2021-12-15 18:36:40 +01:00