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
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
hirokinoue
3a6ebbb8ff
add test case for sort()
2022-04-24 01:00:38 +09: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
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
orklah
9877517284
add test
2022-01-09 00:37:16 +01:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion
2022-01-02 14:56:18 +02:00
rarila
97e6511fab
Set number of lines before and after namespace.
2021-12-15 04:58:32 +01:00
adrew
63de45f0ad
Remove use of nonexistent class
2021-12-11 23:45:34 +03:00
adrew
6cf2e31c4a
Forbid positional arg after named arg
2021-12-11 23:37:15 +03:00
ralila
8fb2e0f885
Handle some partials
2021-12-04 21:55:53 +01:00
Bruce Weirdan
34cb21c7fc
Report cases where object is coerced into object with properties ( #5566 )
...
Fixes vimeo/psalm#5565
2021-04-04 00:00:31 -04:00
AndrolGenhald
d022910599
ConcatAnalyzer improvements and non-falsy-string fixes. ( #5544 )
...
* ConcatAnalyzer improvements.
Deduplicate code.
Improve type inference.
Allow literal type inference when only one side has multiple types (fixes #5483 ).
Fix invalid type inference with negative int as right operand.
* Fix inference to be lowercase-string when concatenating int.
* Fix TNonEmptyLowercaseString to not be subtype of TNonFalsyString.
'0' is a non-empty-lowercase-string that is falsy.
* Fix other issues with non-falsy-string.
* Nest ands and ors
Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-31 23:16:21 -04:00
AndrolGenhald
de5a031088
Improve @no-named-arguments support and variadics. ( #5455 )
...
* Improve @no-named-arguments support and variadics.
Handling of argument unpacking and variadics still needs a pretty big makeover, but this is a good start.
Fixes #5420
Improves #5453 (iterable works, array still causes issues)
* Remove unneeded imports.
2021-03-22 19:58:22 -04:00
Sergey Yakimov
fb94db9b1f
Add proper handling of unpacked arguments with string keys ( #5446 )
...
* Add proper handling of unpacked arguments with string keys
* Fix undefined array key error
* Fix missed named arguments handling
* Fix false-positive on variadic parameter
* Add tests
2021-03-22 09:08:05 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys ( fixes #5427 ). ( #5428 )
...
* Fix object-like array keys (fixes #5427 ).
* Fix incorrect return types for tests.
* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Matt Brown
359a0166e3
Fix #4631 - prevent reusing named params
2021-01-27 22:53:55 -05:00
Matt Brown
4807d38507
Fix using std library functions
2021-01-27 22:28:33 -05:00
Matthew Brown
28d2795e59
Fix #5078 - when unpacking with missing array item, Use the param’s default type if param has one
2021-01-22 00:20:51 -05:00
Matt Brown
e43f2259ea
Fix #4839 - undefined possibly set in by-reference should be treated as such
2020-12-14 16:57:48 -05:00
Dusk
0fe3e1f83b
Allow named arguments to variadic functions ( #4575 )
...
Closes #4563
2020-11-16 15:49:27 -05:00
Matt Brown
4488d5fb1f
Use more accurate arguments count
2020-10-14 18:51:15 -04:00
Matt Brown
7195275993
Fix #4299 - only allow unpacking for the zeroeth-indexed element
2020-10-08 09:51:27 -04:00
Matt Brown
6a91c2f70e
Fix @no-named-arguments more
2020-10-02 21:09:37 -04:00
Matt Brown
63a11bae15
4.x - Support named arguments
...
Ref #4089
2020-10-02 20:27:01 -04:00
Matt Brown
14efde286f
4.x - refactor unused variable detection
...
This turns unused variable detection into an explicit control-flow problem, where before we had a more simplistic mark-and-sweep algorithm
2020-09-30 12:28:13 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
8a0776c8e5
Fix tests
2020-06-11 12:19:34 -04:00
Brown
4c081f7835
Things with mixed values can be the same
2020-03-23 12:08:05 -04:00
Matthew Brown
9cd817077e
Improve fix
2020-03-17 17:34:45 -04:00
Matthew Brown
4166e5a4ef
Fix tests
2020-03-17 16:30:03 -04:00
Matthew Brown
da170efb65
Don’t coerce literal values
...
Fixes #2982
2020-03-17 16:16:58 -04:00
Brown
36f5c51f01
Allow unpacking of list args with known elements
2020-01-21 10:13:37 -05:00
Pavel Batečko
702ca34c41
Improve array function types ( #2566 )
...
* Improve sorting function out types
* Improve return types of array_diff_assoc(), array_intersect_assoc()
* Fix versionCompareAsCallable test
2020-01-07 11:40:23 -05:00
Matthew Brown
b375ebf06f
Fix test
2019-12-29 10:29:03 -05:00
lhchavez
216f991b0c
Normalize stringified type names ( #2239 )
...
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Matthew Brown
a553adb232
Fix test array spacing
2019-06-16 09:42:34 -04:00
Matthew Brown
c772914910
Add some formatting
2019-03-23 14:27:54 -04:00
Brown
6081c742c5
Fix incorrect InvalidArgument for array value scalar mismatch
2019-03-19 16:45:26 -04:00
Brown
880b07783f
Error should be InvalidScalarArgument
2019-03-19 16:12:38 -04:00
Bruce Weirdan
9bdc9f774f
More provider typing
2019-03-02 08:43:19 -05:00
Matthew Brown
4688b25fd9
Move internal classes to own namespace
2018-11-12 11:20:59 -05:00
Matt Brown
34fe935eb6
Fix sort test
2018-09-04 13:30:17 -04:00
Matthew Brown
b5c89084fc
Fix #851 - prevent null being removed in simplifyUnionType
2018-06-30 10:38:37 -04:00
Matthew Brown
a20bdaef45
Fix issue evaluating negated assertion
2018-06-03 20:24:23 -04:00
Matt Brown
4513d24b7d
If there’s any overlap in types use PossiblyInvalidArgument
2018-05-01 14:27:05 -04:00