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
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
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
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
AndrolGenhald
0bdf9425e3
Fix namespaced min/max int range keyword issue introduced in #7775 .
2022-03-30 16:08:14 -05: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
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
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
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