Evan Shaw
c8393bd50d
Fix language server first-class callable crashes
2023-02-19 14:18:17 +13:00
Bruce Weirdan
ee823619b8
Flag direct constructor calls
...
Fixes vimeo/psalm#2975
2023-02-15 20:14:00 -04:00
Bruce Weirdan
8c491e93e8
Flag class constant references where LHS is ordinary string
...
Fixes vimeo/psalm#2185
2023-02-15 02:57:00 -04:00
Bruce Weirdan
3f2ecaec7e
Allow @var
annotations on global vars
...
The actual code was extracted from `StaticAnalyzer`
Fixes vimeo/psalm#1111
2023-02-15 01:20:03 -04:00
Bruce Weirdan
39c992c255
Emit issues for calls to is_a(string, class-string, false)
...
Fixes vimeo/psalm#4092
2023-02-14 02:25:46 -04:00
Andrew Boyton
5d976900d1
Fix divide by a floating point zero
...
The code was failing when dividing by 0.0.
2023-02-09 11:55:06 +11:00
Bruce Weirdan
3c4a829f71
Fixed more CS issues
2023-02-07 11:20:02 -04:00
Matthew Brown
d450b40da8
Remove some logic that didn't need to be there ( #9209 )
...
* Remove check to see what breaks
* Simplify following logic
* Add tests from @kkmuffme‘s branch
* Reduce scope of fix
* Clean up logic a little
* Add failing test
* Improvements
* Fix for non-Paradoxical Condition result
2023-02-03 21:08:16 -05:00
Matt Brown
234787bcd6
Fix logic bugs caught by better elseif checks
2023-02-03 00:30:42 -05:00
orklah
54cd529642
Merge pull request #9170 from mmcev106/filter-var-pure
...
Added @psalm-pure to filter_var()
2023-02-02 23:39:06 +01:00
Bruce Weirdan
fb65c79079
Fix newly discovered CS issues
2023-02-02 12:19:22 -04:00
Mark McEver
77ea545244
Attempted to avoid a psalm warning that was not accurate
2023-02-01 15:50:36 -06:00
Mark McEver
b5781c34e8
Fixed a case where the conditional taint, specialize, & flow features were not playing nicely together
2023-02-01 15:41:52 -06:00
Leo Viezens
7966fd574a
Merge branch 'master' into master
2023-01-30 15:38:29 +01:00
Anner Visser
d86fcf4a85
Narrow ->value of enum case(s) to only the possible values
...
Using $stmt_var_type to determine if we're dealing with a subset of the
enum cases. If so, we only consider those cases for the possible values.
Fixes #8568
Fixes #8812
2023-01-21 12:05:24 +01:00
kkmuffme
166df8a99f
dont report MissingFile error when file_exists is validated beforehand
...
Fix https://github.com/vimeo/psalm/issues/3886
2023-01-05 09:32:36 +01:00
orklah
5bfb87c624
Merge pull request #9022 from Ocramius/fix/#8983-allow-large-union-types-in-array-type-inference
...
Better type inference and type checking for large union types used in array keys/values
2022-12-29 10:48:05 +01:00
Marco Pivetta
e6600fea21
Better type inference and type checking for large union types used in array keys/values
...
Fixes #8983
This patch adds a basic test showing that, when reaching a union type with 30 elements
or more, Psalm used to fail with an error, because the large union type got simplified
into a more general type as part of performance optimizations done in `TypeCombiner::combine()`.
This means that a type like `array<1|2|3|(etcetera...)|100, mixed>` was internally
simplified to `array<int, mixed>`, after reaching 30 elements or more, which in turn
led to problems and confusing errors when large union types are in play.
Such union types are relatively common in lookup-table-alike value objects.
By removing the hardcoded call-time limit of `30` types to be combined, we hereby
rely on the default `TypeCombiner::combine()` limit of `500` items, which is more
healthy.
This may come with some performance implications, but it is worth trying out, for
now.
Further parameters passed to `TypeCombiner::combine()` that were already matching
parameter default values were also omitted from the call-sites.
2022-12-29 10:05:23 +01:00
orklah
a0a9d979d5
remove useless import
2022-12-28 20:47:50 +01:00
orklah
fa4891ce58
create proper TClosure instead of TNamedObject with a Closure value
2022-12-28 20:42:59 +01:00
Theodore Brown
e4b0343f76
Fix PHPCS trailing comma
2022-12-28 09:35:34 -06:00
orklah
41ae518800
Merge pull request #9001 from fluffycondor/http_response_header-non-empty-list
...
Make `$http_response_header` a non-empty-list
2022-12-28 00:27:30 +01:00
fluffycondor
040737de24
Fix non-empty-list class
2022-12-25 11:45:56 +06:00
fluffycondor
a077bd4351
Make http_response_header possibly undefined
2022-12-25 11:38:51 +06:00
Jack Worman
1bb9eb4cfc
forbidden function bug and better get_defined_functions() signature
2022-12-24 12:34:40 -06:00
fluffycondor
69da58d578
Make http_response_header a non-empty-list of non-falsy-string
2022-12-25 00:02:58 +06:00
8013b0eea2
Replace some LNumber usages
2022-12-19 22:14:32 +01:00
750e2da542
Cleanup
2022-12-19 21:29:13 +01:00
dc5a4576a5
Fix
2022-12-19 21:25:06 +01:00
8b4d5f871c
Fix
2022-12-19 21:16:03 +01:00
ab2692fdd3
Update
2022-12-19 18:31:43 +01:00
2617b68ca9
Simplify
2022-12-19 17:40:45 +01:00
ce06f4e0d0
Fix
2022-12-19 17:27:49 +01:00
b9424a88cb
Update
2022-12-19 17:22:00 +01:00
9d7dd20293
Fix some tests
2022-12-19 13:04:24 +01:00
b91ad2cb1d
Begin fixing #8942
2022-12-19 12:55:32 +01:00
Jack Worman
1c19260cdd
Require trailing commas
2022-12-18 13:20:31 -06:00
c454a181cc
Fixes
2022-12-18 15:00:15 +01:00
orklah
a76a1d1a52
Merge pull request #8916 from jack-worman/Remove_useless_ifs
...
Remove useless ifs
2022-12-17 15:54:28 +01:00
orklah
62ced63375
Merge pull request #8910 from jack-worman/Last_property_typehints
...
Last property typehints
2022-12-17 15:53:36 +01:00
Jack Worman
30a8f71958
Remove useless ifs
2022-12-16 22:00:34 -06:00
Bruce Weirdan
425d9fa8bf
Recognize casts from object-with-properties to array
...
Previously `(array)(object)['a' => 1, 'b' => 'foo']` would result in
`array<array-key, mixed>`. Now it would be inferred as
`array{a:1,b:foo,...<array-key,mixed>}`
2022-12-16 20:12:02 -04:00
Jack Worman
9ce31a7709
Re-add short closure sniff
2022-12-16 17:02:10 -06:00
Leo Viezens
0ef7ec100a
#7387 Add asserting non-empty-string by strlen
2022-12-16 17:04:01 +01:00
Jack Worman
76a7c7da4a
Added SlevomatCodingStandard.TypeHints.PropertyTypeHint sniff
2022-12-14 20:43:26 -06:00
Jack Worman
69658e8315
SlevomatCodingStandard.Commenting.DocCommentSpacing
2022-12-14 13:34:41 -06:00
Jack Worman
36fa162d6d
Use php-cs-fixer to clean up docblocks
2022-12-13 20:46:43 -06:00
Jack Worman
fc2df8e8ae
Add more property typehints
2022-12-13 20:20:15 -06:00
cca276768e
List refactoring v5 ( #8820 )
...
* Squash
* Remove BC break
* Suppress
* Possibly fix
* Fixes
* Fix test
* Trigger build
* Update psl
* Update psl
* Fixes
* Fixes
* Cleanup
* fix
* Fix build
* Do not consider never when getting the max count
* Add assertion
* Cleanup
* Fix
* Cleanup
2022-12-13 21:40:19 +01:00
Jack Worman
dd0d8300b1
Use rector to add property typehints
2022-12-11 17:25:23 -06:00