1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 02:47:02 +01:00
Commit Graph

2624 Commits

Author SHA1 Message Date
orklah
ee53c57952 add back alter blocks but remove renaming the $stmt->class part when it's a variable 2021-08-17 23:11:28 +02:00
Barney Laurance
88276d7f1e Fix error message for call to internal method from root namespace 2021-08-17 18:54:57 +01:00
orklah
1bf7447685 small refactor, add LiteralClassString, remove alter code blocks 2021-08-17 18:51:59 +02:00
orklah
7308c86bb2 fix build 2021-08-16 21:56:37 +02:00
orklah
9264ea5cbb Allow type inference on dynamic ClassConstFetch 2021-08-16 21:20:20 +02:00
orklah
1e17069c24 Change > assertion back to @ and put back a perf threshold 2021-08-15 10:13:05 +02:00
Bruce Weirdan
a9ead63ae1
Revert "Assertions for Integer Range" 2021-08-14 18:06:41 +03:00
Matthew Brown
6cc5ba970a Fix tests 2021-08-14 10:45:32 -04:00
Matthew Brown
a4479761a7 Fix #3660 - ensure mixed percentage for file never drops below 0 2021-08-14 10:35:31 -04:00
Bruce Weirdan
7ff2a660dd
Merge pull request #6233 from supersmile2009/fix-in-array-assert 2021-08-13 01:39:31 +03:00
Bruce Weirdan
568a9e0412
Prevented empty assertions
and simplified the code a bit.
2021-08-13 00:39:24 +03:00
Bruce Weirdan
6294e06955
Improve constant array inference
This fixes int offset inference and adds handling for array unpacks in
constant arrays. Mostly it's copy/pasted from `ArrayAnalyzer` with
further adjustments.

Fixes vimeo/psalm#6263
Fixes vimeo/psalm#6289
2021-08-12 20:39:21 +03:00
Bruce Weirdan
8f85f580da
Extract item handling 2021-08-11 01:18:23 +03:00
Bruce Weirdan
f9a75983f9
Use ArrayCreationInfo for is_list flag 2021-08-11 00:47:45 +03:00
Bruce Weirdan
b6ade31dd0
Use ArrayCreationInfo for can_create_objectlike flag 2021-08-11 00:39:56 +03:00
Bruce Weirdan
ba4f1db2cd
Use ArrayCreationInfo for class strings 2021-08-11 00:29:14 +03:00
Bruce Weirdan
47d3d31c47
Use ArrayCreationInfo for property types 2021-08-11 00:19:18 +03:00
Bruce Weirdan
abe5ef774c
Use ArrayCreationInfo for key and value types 2021-08-11 00:05:00 +03:00
Bruce Weirdan
a64a30cdda
Combine value types at once 2021-08-10 21:30:57 +03:00
Bruce Weirdan
a41d5c5b4f
Combine offset types at once 2021-08-10 21:23:13 +03:00
Bruce Weirdan
cf28859faf
Extract array type inference 2021-08-10 20:48:45 +03:00
Bruce Weirdan
5dc748d372
Merge pull request #6273 from VincentLanglet/nonEmptyConstant
Constants are non empty strings
2021-08-09 23:36:41 +03:00
Bruce Weirdan
868a1672c1
Merge pull request #6253 from orklah/unusedSuppress 2021-08-09 23:34:14 +03:00
Vincent Langlet
b28316c27c Declare some constant as non empty 2021-08-09 21:39:49 +02:00
orklah
5134747edd CS 2021-08-09 20:46:15 +02:00
orklah
e688781383 seal the result of two sealed KeyedArrays 2021-08-09 20:43:17 +02:00
orklah
2253667bd5 fix CS, remove redundant vars 2021-08-07 00:22:47 +02:00
orklah
b194291bb3 try to fix offsets 2021-08-07 00:08:19 +02:00
Alexandr Zolotukhin
65a129e3c2 Fix type reconciliation for complex cases with union types 2021-08-06 00:13:26 +03:00
orklah
3fe678b914 ignore UnnecessaryVarAnnotation 2021-08-05 21:05:44 +02:00
orklah
c706497cbd restrict types 2021-08-04 19:45:25 +02:00
orklah
0c75ac89d0 refactor arithmetics 2021-08-04 19:43:27 +02:00
Bruce Weirdan
2ecd1d8bd3
Merge pull request #6238 from orklah/unused-foreach-fixable
don't flag UnusedForeachValue as fixable
2021-08-03 19:37:07 +03:00
orklah
006088d578 don't flag UnusedForeachValue as fixable 2021-08-03 18:24:53 +02:00
Alexandr Zolotukhin
097e88a7cb Improved in_array assertion extraction
Extract non-literal type assertion from in_array

Extract false, true and null assertion

Fix assertion against arrays with union-typed values

Fix assertion against non-sealed arrays
2021-08-03 17:29:32 +03:00
Bruce Weirdan
caaff6e3b4
Merge pull request #6210 from orklah/int-range3 2021-08-01 16:37:15 +03:00
Matthew Brown
00c062267d Fix space 2021-07-31 21:15:26 -04:00
Matthew Brown
a205a23ccb Fix #6212 - remove untested code, add test for reasonable behaviour 2021-07-31 19:50:56 -04:00
Bruce Weirdan
2562e37e60
Scan preloaded stubs earlier
This should prevent Psalm from sometimes marking user-defined classes as
built-in.

Fixes vimeo/psalm#5126
Fixes vimeo/psalm#5626
2021-08-01 01:36:37 +03:00
orklah
2a9ddab738 replace +/- by >/< 2021-07-31 22:06:36 +02:00
orklah
5f764b9d8f replace > by @ 2021-07-31 21:59:35 +02:00
orklah
059eb5e29d break the > assertion thing to see what start to fall apart 2021-07-31 21:54:15 +02:00
orklah
a8efe58784 fix isset assertion 2021-07-31 15:47:12 +02:00
orklah
128a811174 add internal assertions for superior and inferior 2021-07-31 15:47:12 +02:00
Bruce Weirdan
4cb9d8ceec
Merge pull request #6205 from orklah/typos
fix typos
2021-07-29 22:31:03 +03:00
orklah
d0fe1528b6 fix typos 2021-07-29 20:59:52 +02:00
Bruce Weirdan
7aa5564047
Merge pull request #6192 from orklah/array_replace_not_nullable
make array_replace and array_replace_recursive not nullable
2021-07-28 00:20:46 +03:00
orklah
d9df3211c5 make array_replace and array_replace_recursive not nullable 2021-07-27 23:02:41 +02:00
Jack Robertson
f0193f20fa Consider print, and conditionally exit / die impure 2021-07-27 13:26:54 +01:00
Bruce Weirdan
ae0c8f57fd
Merge pull request #6187 from orklah/wrong-nullable-type 2021-07-27 00:52:20 +03:00
orklah
06af927f12 fix an error I made a few months ago 2021-07-26 23:09:27 +02:00
Bruce Weirdan
4d99fbcce0
Merge pull request #6185 from orklah/typo
fix wrong wording from #6083
2021-07-26 23:00:42 +03:00
orklah
2259113727 fix wrong wording 2021-07-26 21:09:12 +02:00
Bruce Weirdan
82dfbbc12e
Merge pull request #6167 from orklah/non-div-with-numeric-and-int 2021-07-25 13:56:48 +03:00
orklah
55245cf558 Arithmetic operation between numeric and int or float gives int|float 2021-07-25 12:29:11 +02:00
Bruce Weirdan
aa23aa5387
Merge pull request #6166 from orklah/StringIncrementOnNumericString 2021-07-24 23:27:17 +03:00
orklah
f63f1b5d2a use is_numeric for checking if a Literal is numeric 2021-07-24 21:44:12 +02:00
orklah
9189fa1745 add tests and code for handling LiteralString that are Numeric 2021-07-24 21:21:50 +02:00
orklah
b48a42ffab don't try to handle preinc/postinc 2021-07-24 21:18:11 +02:00
Bruce Weirdan
3caceb7131
Merge pull request #6169 from orklah/numeric-strictBinaryOperands 2021-07-24 15:45:42 +03:00
orklah
1a41ee4dd4 keep wording consistency 2021-07-24 11:18:50 +02:00
orklah
7146c646e3 Trigger InvalidOperand when processing two numeric types in strict operands mode 2021-07-24 11:04:09 +02:00
orklah
4b660aa941 handle every increment/decrement 2021-07-24 10:51:10 +02:00
orklah
c8ee73ce30 Allow increment on numeric-string 2021-07-23 21:10:29 +02:00
Bruce Weirdan
198fdf876e
Merge pull request #6142 from orklah/trigger_error 2021-07-23 09:22:55 +03:00
Matthew Brown
43cff22b25 Add support for native PHP readonly 2021-07-21 13:29:07 -04:00
Bruce Weirdan
052c7478cc
Unary plus and minus mark operand as used
Fixes vimeo/psalm#6145
2021-07-21 01:15:51 +03:00
orklah
9ff0fceb71 CS changes 2021-07-20 23:41:11 +02:00
orklah
acfdb82856 Basic implementation 2021-07-20 23:34:38 +02:00
Bruce Weirdan
7bcefb783a
Simplify InstancePropertyAssignmentAnalyzer::analyzeAtomicAssignment()
... to fix build issues.
2021-07-20 00:08:49 +03:00
Bruce Weirdan
0317f1dbec
Merge pull request #6130 from weirdan/forbid-dynamic-access-to-static-props 2021-07-19 16:11:29 +03:00
Bruce Weirdan
d992331125
Expand magic properties
Fixes vimeo/psalm#4344
Fixes vimeo/psalm#5663
Fixes vimeo/psalm#5639
Fixes vimeo/psalm#5955
Fixes vimeo/psalm#3272
2021-07-18 23:43:33 +03:00
Bruce Weirdan
7418e6e167
grammar 2021-07-18 16:52:00 +03:00
Bruce Weirdan
a180dc6099
Flag staticness mismatch
This handles two new cases:
1. Accessing static property with `->` (produces notices and warnings: https://3v4l.org/TiGan)
2. Accessing non-static property with `::` (causes fatal error: https://3v4l.org/IdYSh)

Fixes vimeo/psalm#6117
2021-07-18 02:51:33 +03:00
Bruce Weirdan
53ae7764e9
Merge pull request #6129 from orklah/unused-global 2021-07-18 02:33:50 +03:00
orklah
79d0647d19 fix issue when setting a value to a global is considered unused 2021-07-17 22:00:54 +02:00
Grégoire Paris
26f8e5b333
Add negated identity with false case
This is the opposite of === true and works the same.
2021-07-17 03:20:23 +03:00
Bruce Weirdan
af5cdb4dd4
Check deprecated properties on $this->prop reads
Fixes vimeo/psalm#6118
2021-07-17 01:20:35 +03:00
orklah
0bd8b03f7a Fix usage of gettype in a switch with closed resource 2021-07-14 12:49:46 +02:00
Bruce Weirdan
601c8cac5b
Merge pull request #6086 from orklah/cleanup 2021-07-14 09:08:18 +03:00
orklah
c3a4e513f9 add more detailed phpdoc for $conditional and remove unused code 2021-07-14 00:02:36 +02:00
orklah
bcd22335b6 add some detailed phpdoc for $conditional 2021-07-13 22:35:57 +02:00
orklah
874b8ed7ae fix doc 2021-07-13 22:29:27 +02:00
orklah
647b9b78dc cleanup and refactor AssertionFinder 2021-07-13 20:54:47 +02:00
Ruslan Karimov
8a08489dcc Merge branch 'master' into fix-5957
# Conflicts:
#	tests/UnusedVariableTest.php
2021-07-13 10:15:35 +05:00
Ruslan Karimov
cfaca07c6d added dataflow to stringy bitwise op, bitwise not op (fix 5957) 2021-07-13 10:05:21 +05:00
Bruce Weirdan
6729f4db01
Merge pull request #6083 from orklah/falsable-argument 2021-07-13 02:13:39 +03:00
orklah
52033f4b69 fix condition when scalar is allowed 2021-07-13 00:34:22 +02:00
orklah
1fc8982ca9 fix condition when bool is allowed 2021-07-13 00:19:13 +02:00
orklah
688367de38 Always emit InvalidArgument when the parameter is always false and not accepted 2021-07-13 00:06:36 +02:00
Matthew Brown
f2bc6913db
Fix #6061 — delay analysis of array value except when unpacking (#6081) 2021-07-12 17:05:33 -04:00
Bruce Weirdan
e93b37a225
Merge pull request #6060 from VincentLanglet/statement 2021-07-11 22:12:10 +03:00
Matthew Brown
acc7ee261c
Fix #6066 - introduce more robust system for capturing template constraints (#6072)
* Fix #6066 - add better system for capturing template constraints

* Fix comment
2021-07-11 12:03:21 -04:00
Vincent Langlet
3339ce1379 Use stmt instead of args 2021-07-11 11:22:13 +02:00
Matthew Brown
d883d73991 Fix template bound terminology
I had this flipped by mistake
2021-07-10 14:08:09 -04:00
Vincent Langlet
49ed7b045f Pass statement to MethodReturnTypeProviderEvent 2021-07-08 00:02:36 +02:00
orklah
f8644fb508 Improve resolution of __METHOD__ and __FUNCTION__ 2021-07-03 10:01:53 +02:00
Matt Brown
d18a4f4ccc Don’t stop scanning loop contents due to possibly-null iterator 2021-06-28 13:13:12 -04:00
Matt Brown
19cc4cb4ee Simplify lots of usage checks 2021-06-25 10:14:49 -04:00
Matt Brown
67d68a5dc0 Use more accurate variable name 2021-06-25 09:54:39 -04:00