Bruce Weirdan
230bdb43ad
Merge pull request #6345 from orklah/multiple_properties
...
use better solution to check for project dir paths
2021-08-19 20:53:07 +03:00
orklah
d416d46900
fix CS
2021-08-19 19:36:01 +02:00
orklah
ef34cbd321
use better solution to check for project dir paths
2021-08-19 18:49:28 +02:00
orklah
3e236fc2fe
don't report UnusedSuppressions in non project dirs
2021-08-19 18:43:29 +02:00
Maximilian Bösing
c9aebe3082
bugfix: resolve recursive aliases in multiple methods
...
- `ClassLikes#hasFullyQualifiedClassName`
- `ClassLikes#hasFullyQualifiedInterfaceName`
- `ClassLikes#hasFullyQualifiedEnumName`
- `ClassLikes#hasFullyQualifiedTraitName`
- `ClassLikes#classExtends`
- `ClassLikes#classImplements`
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-18 16:37:08 +02:00
Maximilian Bösing
4e0484f283
bugfix: resolve recursive aliases
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-18 16:18:58 +02:00
orklah
2b37bdf253
get rid of the final check that was there only for static:: before
2021-08-17 23:40:03 +02:00
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
Bruce Weirdan
e5b797c764
Merge pull request #6327 from boesing/bugfix/class-alias
2021-08-17 23:35:25 +03:00
Maximilian Bösing
158f2144b5
qa: use ClassLikes#getUnAliasedName
instead of accessing the classlike_aliases
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 21:43:58 +02:00
Maximilian Bösing
5ef606a5f6
qa: avoid array_keys
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 21:39:53 +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
Maximilian Bösing
f8db5a0461
bugfix: enable ClassLikes
to properly detect implementing class aliases
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 18:40:18 +02:00
piporoid
1df5f3012a
Prevent @property annotations on class properties
2021-08-17 23:40:26 +09:00
Maximilian Bösing
cb244d5c1e
bugfix: add missing TNonEmptyMixed
to Atomic#create
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 10:46:45 +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
Bruce Weirdan
f245c4ace7
Prevent failures when parsing in-array assertions
...
Fixes vimeo/psalm#6309
2021-08-16 01:23:48 +03: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
Thomas Bley
04177496cc
Fixed ReflectionException: Class \LanguageServerProtocol\TextDocumentContentChangeEvent does not exist
2021-08-14 05:54:36 +02: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
Alexandr Zolotukhin
d7f83c3b5e
Fix issues detected by psalm
2021-08-10 20:07:53 +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
Bruce Weirdan
94f034b7ad
Merge pull request #6272 from orklah/sealed-array-combination
2021-08-09 23:33:00 +03:00
orklah
b975dd7f73
add documentation
2021-08-09 21:59:29 +02: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
Bruce Weirdan
2431d162a9
Merge pull request #6251 from TysonAndre/reset-cache-level
...
Use different psalm cache for different error levels
2021-08-08 21:28:27 +03:00
bjscharp
07d48d779a
Merge branch 'master' into callmap-delta-inconsistencies
2021-08-08 10:41:42 +02:00
bjscharp
96056d329f
Add simple test to verify outout of getCallMap method
...
Convert deltafile format to new style proposed by weirdan
Modify CallMapTest to use new format
Modify InternalCallMapHandler to use new format
Move assertions to base testcase
2021-08-08 10:39:54 +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
Maximilian Bösing
9d59fbe6bb
feature: introduce literal float methods to Union
type
...
- Added `Psalm\Type\Union#isSingleFloatLiteral`
- Added `Psalm\Type\Union#getSingleFloatLiteral`
- Added `Psalm\Type\Union#hasLiteralFloat`
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-06 21:05:26 +02:00
Tyson Andre
3486490080
Use different psalm cache for different error levels
...
Fixes #4952
2021-08-06 12:46:15 -04:00
Alexandr Zolotukhin
65a129e3c2
Fix type reconciliation for complex cases with union types
2021-08-06 00:13:26 +03:00
Alexandr Zolotukhin
9687836519
Fix intersection calculation for unions of scalar types
2021-08-05 23:15:58 +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
Alexandr Zolotukhin
6dd24285c5
Return Empty type if there's no intersection between existing and assertion type
2021-08-03 21:10:59 +03: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
Alexandr Zolotukhin
586e8a157e
Fix tests with loose types. Fix return type in the reconciler.
2021-08-03 19:34:35 +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
9d68e2e39c
Merge pull request #6231 from tm1000/patch-get-position-from-offset-error-php80
2021-08-03 04:06:02 +03:00
Your Name
9f3f366cf3
Fixes: PHP 8.0: Argument #3 ($offset) must be contained in argument #1 ($haystack)
2021-08-02 16:49:09 -07:00
Bruce Weirdan
caaff6e3b4
Merge pull request #6210 from orklah/int-range3
2021-08-01 16:37:15 +03:00
Bruce Weirdan
3a1714e732
Merge pull request #6215 from weirdan/fix-6211
...
Use fully-qualified name for virtual class strings
2021-08-01 16:36:25 +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
e4ead74879
Use fully-qualified name for virtual class strings
...
Fixes vimeo/psalm#6211
2021-08-01 02:22:16 +03: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
d22b4b3c23
forgot an occurence of >
2021-07-31 22:24:07 +02: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
565336febd
fix mistake
2021-07-31 18:52:28 +02:00
orklah
a6431c4055
fix comment
2021-07-31 18:47:17 +02:00
orklah
3230ee8bcb
fix mistakes
2021-07-31 17:57:07 +02:00
orklah
f3fb20efc5
threshold for too heavy conditions
2021-07-31 16:54:27 +02:00
orklah
67318b33f7
fix reconciliation when a bound is null
2021-07-31 16:02:58 +02:00
orklah
a8efe58784
fix isset assertion
2021-07-31 15:47:12 +02:00
orklah
c5165710d3
fix comparison
2021-07-31 15:47:12 +02:00
orklah
a6fa63a0cf
allow checking if an int is contained inside a range
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
orklah
7e137f5b95
Improve internals of TIntRange ( #6208 )
...
* Improve internals of TIntRange
* fix PositiveInt aliasing
2021-07-31 09:19:20 -04:00
orklah
ba9f7d09ac
fix CS
2021-07-30 22:22:38 +02:00
orklah
0252a65e0d
fix syntax
2021-07-30 21:46:11 +02:00
orklah
1e3e6a85e4
introduce basic integer range
2021-07-30 21:44:51 +02:00
Bruce Weirdan
9414b11c2f
Merge pull request #6204 from orklah/class-string-attributes
2021-07-29 22:35:42 +03: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
orklah
a1c4ece7bd
Create a virtual ClassConstFetch when encountering a TLiteralClassString
2021-07-29 20:23:53 +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
orklah
72d60249a9
Inaccurate error with different types in PHPDoc and typehint
2021-07-26 23:03:00 +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
358f83d66b
Merge pull request #6181 from Jack97/date-time-interface-type-reconciliation
2021-07-26 16:28:10 +03:00
Jack Robertson
0e6160c1e0
Update DateTimeInterface type reconciliation
2021-07-26 13:41:52 +01: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
783dc610df
Merge pull request #6172 from Jack97/malformed-parentheses
2021-07-25 13:08:23 +03:00
Jack Robertson
ce6642d1aa
Handle malformed parentheses
2021-07-25 10:43:34 +01: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
Jack Robertson
1c0de36795
Support array_slice template parameter return type inference
2021-07-24 16:09:29 +01: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
8189409bd4
refine documentation
2021-07-23 21:41:31 +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
58dd3f6f94
change wording
2021-07-20 23:53:04 +02:00
orklah
9ff0fceb71
CS changes
2021-07-20 23:41:11 +02:00
orklah
9160a4e8a6
review
2021-07-20 23:37:34 +02:00
orklah
acfdb82856
Basic implementation
2021-07-20 23:34:38 +02:00
Bruce Weirdan
b149097086
Replace array cast with get_object_vars() which Psalm understands
2021-07-20 23:26:15 +03:00
Nathan Dench
39555a2df8
add type signature in XmlReport
2021-07-20 21:54:44 +10:00
Nathan Dench
ca2c125218
fix: Handle DataFlowNodeData in XmlReport
2021-07-20 21:39:09 +10: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
b589525eb1
Merge pull request #6131 from orklah/bindtextdomain
...
makes bindtextdomain impure
2021-07-18 16:53:59 +03:00
Bruce Weirdan
7418e6e167
grammar
2021-07-18 16:52:00 +03:00
orklah
f1269d2425
makesbindtextdomain impure
2021-07-18 14:24:43 +02: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
fcbd443bc8
initialize array
2021-07-17 22:04:22 +02:00
orklah
79d0647d19
fix issue when setting a value to a global is considered unused
2021-07-17 22:00:54 +02:00
Bruce Weirdan
2127da387b
Merge pull request #3903 from greg0ire/redundant-not-identical-with-false
...
Add negated identity with false case
2021-07-17 04:07:40 +03: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
4c197afc09
Merge pull request #5512 from ngmy/shepherd-envvar
...
Add the environment variable for using Shepherd
2021-07-17 02:50:15 +03:00
Yuta Nagamiya
bcd5fc4b6a
Add the environment variable for using Shepherd
2021-07-17 02:26:13 +03:00
Joshua Behrens
0c6031f7f2
Use same working directory for preparing cache directory as it used in running analysis
2021-07-17 01:55:41 +03:00
Bruce Weirdan
c9f52c449b
Merge pull request #6127 from weirdan/deprecated-properties
...
Check deprecated properties on $this->prop reads
2021-07-17 01:43:08 +03:00
Matthew Brown
88c4e2468e
Support interface-string<Foo> as temporary alias of class-string<Foo> ( #6106 )
2021-07-16 18:38:39 -04:00
Bruce Weirdan
a6a261b537
Merge pull request #6123 from caugner/codeclimate-relative-paths
...
fix(CodeClimateReport): use relative path
2021-07-17 01:29:26 +03:00
Bruce Weirdan
af5cdb4dd4
Check deprecated properties on $this->prop reads
...
Fixes vimeo/psalm#6118
2021-07-17 01:20:35 +03:00
Claas Augner
d0df69afb5
Fix CodeClimateReport to use relative paths
...
Both GitLab and the Code Climate Engine Specification require the code
climate report to contain the *relative* path to the source code file.
2021-07-16 22:39:47 +02:00
Bruce Weirdan
4a516005a3
Allow 0 for all bitmask types
...
Fixes vimeo/psalm#6119
2021-07-16 23:20:33 +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