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

8582 Commits

Author SHA1 Message Date
orklah
0f6891c757
fix typo 2022-10-10 18:07:26 +02:00
kkmuffme
3a420f4f7a phpunit bool|string 2022-10-10 17:06:00 +02:00
kkmuffme
0da493b5bb fix docs to match example 2022-10-10 16:28:46 +02:00
kkmuffme
1e6019ddde size and error in $_FILES more specific 2022-10-10 16:18:27 +02:00
kkmuffme
fa53050483 fix $_FILES 2022-10-10 16:07:14 +02:00
kkmuffme
b5f6da7285 add common phpunit $_SERVER values bool
Fix https://github.com/vimeo/psalm/issues/8556
2022-10-10 14:31:35 +02:00
264e146cef cs-fix 2022-10-10 13:03:02 +02:00
26f9b2cd6a Add suppresses 2022-10-10 13:00:46 +02:00
deaa6bd2ea Add purity issues to baseline 2022-10-10 12:53:13 +02:00
8a7b201b2c Update 2022-10-10 12:38:57 +02:00
2e8fd6fc1d Add flag 2022-10-10 11:46:47 +02:00
fe17720441 Revert 2022-10-10 11:43:04 +02:00
f06c459415 Bugfix 2022-10-07 13:18:57 +02:00
Gregory Hargreaves
41a6afda32 Add check for const with reserved word class 2022-10-07 09:44:10 +01:00
William Owen Ponce
0c3a62bc48
Update args 2022-10-05 14:29:24 +08:00
William Owen O. Ponce
ae426a00ce Remove irrelevant types, use keep aliases 2022-10-05 09:09:56 +08:00
William Owen O. Ponce
04c9fe89c1 Arrange use statements alphabetically again 2022-10-04 09:59:34 +08:00
William Owen O. Ponce
6b6c320fe6 Arrange use statements alphabetically 2022-10-04 09:53:22 +08:00
William Owen O. Ponce
58fd83a01f Add int type aliases based on existing codes 2022-10-04 09:47:40 +08:00
0155ad7472 Immutable readonly 3 2022-10-03 15:13:47 +02:00
45452c7125 Immutable readonly 2 2022-10-03 14:02:41 +02:00
5984ccd908 Fix 2022-10-03 12:53:44 +02:00
79b13fab04 Cleanup 2022-10-03 12:09:42 +02:00
c2ce7e63da Immutable readonly 1 2022-10-03 11:53:05 +02:00
f11ed46f26 Immutable assertions 2022-10-03 11:32:15 +02:00
ef60a0c88c Fix properties-of on generics&intersections 2022-10-03 11:28:01 +02:00
3abd0b961f Immutable Unions 2022-10-03 10:45:36 +02:00
orklah
313ebf428b
Merge pull request #8502 from kkmuffme/option-to-only-report-errors-for-passed-file
add hideAllErrorsExceptPassedFiles config option
2022-09-25 13:02:00 +02:00
kkmuffme
b1c0c2d8a1 add hideAllErrorsExceptPassedFiles config option
for files only (not directories, since that wouldn't make practical sense)
2022-09-24 10:44:01 +02:00
kkmuffme
e803af4cd4 use cache for declared function when available before falling back to stubs
fixes return type issues reported for the wrong file
2022-09-22 02:10:51 +02:00
kkmuffme
d69be4b9a2 objects even with __toString methods cannot be cast to int/float 2022-09-19 21:54:16 +02:00
Ricardo Boss
bf1c0320fd Cherry-pick: Try to provide literal int types when possible (fixes #6966) (#7071)
* Fixed vimeo/psalm#6966

* Only accept >= 0 values for mode argument in round()

* Made round() only return float or literal float values and remove unneeded test

* Registered RoundReturnTypeProvider

* Updated cast analyzer to handle single string literal int values as literal ints

* Fixed psalm errors

* Fix invalid property accesses

* Addressed comments

* Added Tests

* Marked RoundReturnTypeProvider as internal

* Fixed CS
2022-09-19 21:54:16 +02:00
kkmuffme
da68e9d739 fix psalm-internal risky casts 2022-09-19 21:54:16 +02:00
kkmuffme
7cdad99645 add RiskyCast 2022-09-19 21:54:16 +02:00
kkmuffme
c3eebe2579 be less strict for generic string type 2022-09-19 21:54:16 +02:00
kkmuffme
d32efb0619 float/int always 1 on "error", no PossiblyInvalidCasts by default 2022-09-19 21:54:16 +02:00
kkmuffme
39ec75523e same for float 2022-09-19 21:54:16 +02:00
kkmuffme
3bec76acb8 fix invalid casts for int
https://psalm.dev/r/0d284c6f48
2022-09-19 21:54:16 +02:00
kkmuffme
e4b7cdf26f fix type for (string) true 2022-09-19 21:54:16 +02:00
dennis
ab690df4da Improved class name generation for @throws annotation 2022-09-19 21:09:45 +02:00
dennis
844d7999c5 Ensure @throws annotations reference valid Exception classes 2022-09-19 21:09:45 +02:00
orklah
3b7e508c78
Merge pull request #8473 from kkmuffme/detailed-superglobal-types
make superglobals more specific
2022-09-19 10:48:44 +02:00
kkmuffme
e2e6265ba1 ignore nullable issues for $argv/$argc 2022-09-19 09:45:55 +02:00
Peter van Dommelen
2eb4ca0e3b Within the reconciler's fast path, do not require the existing type to include mixed when handling an Any assertion. 2022-09-18 17:07:30 +02:00
Peter van Dommelen
05f28ce8cd Do not widen type to mixed and lose the existing type information when an Any assertion is used.
Fixes #8084.
2022-09-18 17:02:09 +02:00
orklah
5db59910bd
Merge pull request #8491 from HypeMC/array-column-fix
Fix array_column with object and column name null
2022-09-18 11:25:42 +02:00
HypeMC
602e26edd4 Fix array_column with object and column name null 2022-09-17 21:21:33 +02:00
hirokinoue
9071e877a8 fix according to psalm analysis 2022-09-18 01:15:09 +09:00
hirokinoue
2cf131fb45 allow StaticPropertyFetch node to behave like Variable node 2022-09-17 23:08:29 +09:00
hirokinoue
faf4e8ef84 allow PropertyFetch node to behave like Variable node 2022-09-17 22:36:16 +09:00
kkmuffme
a3cb10c085 make $_SERVER more detailed 2022-09-15 19:39:02 +02:00
kkmuffme
7bc29a91eb make superglobals more specific
Update VariableFetchAnalyzer.php
2022-09-15 19:38:51 +02:00
Vincent Langlet
fec5c8ab03 Fix cs 2022-09-14 00:55:32 +02:00
Vincent Langlet
32aedbac58 Add dateTimeModify return type provider 2022-09-14 00:53:12 +02:00
Matthew Brown
d957ff2015
Fix mixed type hole when sending Foo<string> to Foo<mixed> (#8481)
* Fix mixed type hole when sending Foo<string> to Foo<mixed>

* Fix ifThisIs test

* Suppress bugs highlighted with fix

* Fix PHPDoc parsing
2022-09-13 13:13:06 -04:00
Matt Brown
6f298d2af2 Fix phpcs violations 2022-09-13 12:33:47 -04:00
kkmuffme
978f37e421 improve unlinking potential race condition
* fix rare race condition on file cache unlink
* remove unnecessary reset()
* improve code readability using variable
2022-09-11 10:28:16 +02:00
kkmuffme
8ac86f0a4d use consistent race condition dir creation code in all places in cache 2022-09-11 10:28:16 +02:00
kkmuffme
4726454f49 update leftover md5 in provider to commonly used hash
Revert "update leftover md5 in provider to commonly used hash"

This reverts commit 66337ecf50446dca8650a0812ebfe516d1993e06.

partially put back

Update StatementsProvider.php
2022-09-11 10:22:48 +02:00
kkmuffme
8da5f5eb1a use exceptions instead of error_log for ParserCacheProvider
* use exceptions instead of error_log for ParserCacheProvider like all other cache providers do
* remove duplicate code in ParserCacheProvider
* use same hash as other cache providers
* update Config.php cache directory creation to use same code as ParserCacheProvider
2022-09-11 10:22:48 +02:00
kkmuffme
c450d95727 fix inconsistent function naming 2022-09-08 21:33:06 +02:00
kkmuffme
249d61ec1b classlike_alias incorrect casing not handled correctly 2022-09-08 21:33:06 +02:00
orklah
76cfb911b2
Merge pull request #8469 from kkmuffme/strictify-anchored-preg-replace
preg_replace with anchor will always only have 1 replacement
2022-09-08 20:01:16 +02:00
kkmuffme
d0984f4e47 fix psalm internal errors reported by new checks 2022-09-08 19:35:44 +02:00
kkmuffme
15046c932b preg_replace with anchor will always only have 1 replacement, add limit for clarity and performance 2022-09-08 18:51:33 +02:00
kkmuffme
a17fa249ac report invalidCasing when using a class that is not user defined too (e.g. new DateTime) 2022-09-08 13:28:43 +02:00
Semyon
f0a8810cf5 Fix ctype_digit assertion bug 2022-09-07 15:49:35 +03:00
Semyon
969c7a098b Make ctype_digit and ctype_lower work as assertions 2022-09-02 17:37:10 +03:00
Vincent Langlet
6bc714c867 Add support for callable in array_reduce 2022-08-24 16:04:22 +02:00
orklah
7ee3a81bce
Merge pull request #8370 from someniatko/issue-8363
Ensure we recognize inherited static methods for the first-class callables
2022-08-18 21:50:20 +02:00
979091d2ab
Optimize 2022-08-17 13:38:11 +02:00
0220da0b32
Add tests 2022-08-17 13:30:36 +02:00
95ef63ece9
Update 2022-08-17 13:25:00 +02:00
24b008ee40
Fix 2022-08-17 13:19:25 +02:00
1401bf94db
Fix #8414 2022-08-17 13:11:27 +02:00
orklah
7e010a7a4f
Merge pull request #8372 from kkmuffme/safely-read-write-cache-data
always use lock when writing/reading cache data to/from file
2022-08-11 18:06:56 +02:00
Markus Staab
8f6e16add6 added truthy-string alias for non-falsy-string 2022-08-11 16:49:58 +02:00
kkmuffme
8ca594a34d always use lock when writing/reading cache data to/from file 2022-08-11 13:12:47 +02:00
Teemu Koskinen
fefd4861d6
Use $codebase->classlike_storage_provider only if it has the required data. Fixes #8373 2022-08-08 23:49:14 +03:00
someniatko
be02e7e5c7 #8363 - support static as a type parameter in return types of the first-class callables 2022-08-04 17:16:06 +03:00
someniatko
f3d67845c5 #8363 - ensure we recognize inherited static methods for the first-class callables 2022-08-04 17:01:42 +03:00
kkmuffme
0d32203f9a add ", but" for InvalidArgument error message where a type is provided 2022-08-03 19:40:30 +02:00
Bitwise Operators
a5c550cea4 Fix incorrect handling of null response 2022-08-03 18:27:32 +02:00
Bitwise Operators
f782313c45 Add BitwiseNot and BooleanNot operators to SimpleTypeInferer. Should fix #8307. 2022-08-03 15:48:54 +02:00
24f7920e9a
Fix if propagation (#8326)
* Add failing unit test

* Fix test

* Revert "Add comment for skipped test"

This reverts commit e4f73beb08.

* Revert "Simplify context updates even more"

This reverts commit a32e63f131.

* Revert "Remove special handling for elseifs that breaks for else if"

This reverts commit d7d9ddc653.

* Fix test
2022-07-30 19:20:05 -04:00
Bruce Weirdan
c9e6b54050
CS fix 2022-07-29 23:08:11 -04:00
Bruce Weirdan
7444ea8e2d
Simplify some methods to keep Psalm happy 2022-07-29 23:01:49 -04:00
Bruce Weirdan
238b54abf8
Revert one particular replacement that confuses Psalm 2022-07-29 22:00:21 -04:00
Bruce Weirdan
58e87fa5e0
Applied ArraySpreadInsteadOfArrayMergeRector (take 2) 2022-07-29 18:17:21 -04:00
AndrolGenhald
148264305f
Merge pull request #8341 from someniatko/issue-7731
recognize `@psalm-allow-private-mutation` in PHP 8+ constructors
2022-07-29 09:31:20 -05:00
someniatko
0abde258fa #7731 - recognize @psalm-allow-private-mutation in PHP 8+ constructors 2022-07-29 16:50:56 +03:00
someniatko
0c652f72f6 #8330 - take into account that static type may have been unwrapped in ExistingAtomicStaticCallAnalyzer#hasStaticInType() 2022-07-29 12:31:37 +03:00
orklah
7c4228fb56
Merge pull request #8324 from Nicelocal/fix_union_assertions
Fix union assertions
2022-07-28 19:06:14 +02:00
7a7a7f6bc9
cs-fix 2022-07-28 12:05:13 +02:00
33d8f3a62d
Fix unit tests 2022-07-28 12:03:12 +02:00
abe58876a7
Fix 2022-07-27 20:32:44 +02:00
6ce32a48d5
Fix 2022-07-27 20:24:24 +02:00
68f3f246f5
Fix 2022-07-27 20:08:00 +02:00
1a4d68e53b
Make private 2022-07-27 18:56:24 +02:00
82e8c0dea8
Disable intersection of unrelated classes 2022-07-27 18:55:01 +02:00
c409675e3e
Fix intersection of final classes 2022-07-27 18:46:07 +02:00
c2a8d1bb06
cs 2022-07-27 18:00:24 +02:00
e19589117d
Fix unit test 2022-07-27 17:56:41 +02:00
09fb879428
Fix #8322, #8319 2022-07-27 17:42:48 +02:00
18106af5e5
Refactor 2022-07-27 14:39:34 +02:00
AndrolGenhald
094621d5bb Fix array-shape value type being mixed instead of single key being mixed. 2022-07-26 12:00:05 -05:00
AndrolGenhald
ee68184527 Fix key comparison when unpacking Traversables. 2022-07-26 12:00:05 -05:00
AndrolGenhald
2b389df270 Use count instead of empty. 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
orklah
d7cd84c4eb
Merge pull request #8302 from kkmuffme/fix-cache-directory-race-conditions
fix race conditions causing notices if directory does not exist
2022-07-25 19:04:37 +02:00
Semyon
b1295d6894 Code style 2022-07-25 17:15:28 +03:00
AndrolGenhald
ba6270c06a Fix type reconciliation breaking Context::$references_in_scope (fixes #8289). 2022-07-21 14:27:21 -05:00
kkmuffme
e1b0255db8 fix triggerErrorExits not working
Fix https://github.com/vimeo/psalm/issues/8270
2022-07-21 12:54:47 +02:00
kkmuffme
233863dc0c circle CI error for unrelated code? 2022-07-21 11:36:55 +02:00
kkmuffme
bb760a2224 fix race conditions causing notices if directory does not exist 2022-07-21 11:36:16 +02:00
Oliver Hader
6c5e5f77fa
Avoid cloning undefined array index 2022-07-20 21:36:49 +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
66ebf4a55c Rename TKeyOfArray to TKeyOf. 2022-07-18 14:44:29 -05:00
AndrolGenhald
6505d8e6d5 Fix trailing comma for PHP 7.4. 2022-07-18 14:19:34 -05:00
AndrolGenhald
b51b5ac903 Allow value-of to work with backed enums (fixes #7874). 2022-07-18 14:10:06 -05:00
Matt Brown
a32e63f131 Simplify context updates even more 2022-07-17 13:11:32 -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
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
931b3bb18b #8200 - simplify ExistingAtomicStaticCallAnalyzer::hasStaticType() 2022-07-12 21:43:31 +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
orklah
7f3d55dfa0
Merge pull request #8244 from jack-worman/CountReport
New "Count" Report Format
2022-07-11 18:55:01 +02:00
Jack Worman
3b76ac85dc Count Report Format 2022-07-10 17:50:50 -05:00
kkmuffme
a77f6fca12 use error_log 2022-07-10 12:04:42 +02:00
kkmuffme
7742d8a903 use lock to fix race condition 2022-07-10 10:03:18 +02:00
AndrolGenhald
285740a753 Merge branch '4.x' 2022-07-07 15:01:38 -05:00
Christian Schiffler
8ffab5eada Remove now obsolete casts 2022-07-06 08:59:19 +02:00
Christian Schiffler
ea9903a2c6 Fix variable annotation 2022-07-06 08:59:07 +02:00
Christian Schiffler
6305c21b5b Remove now obsolete loop
The class names in property map are now always lowercase
2022-06-29 09:23:45 +02:00
kkmuffme
90586083e6 check if file in cache already before adding
* reduces I/O by 30%
* minimal performance improvement (<0.5%)
2022-06-28 20:46:23 +02:00
kkmuffme
9082eab915 improve cache hash performance
* do not concatenate with timestamp as this is slow, since $file_contents may be big
* use file contents not file path for cache hash only to ensure it works if file_path not set but file_content is
* improves performance by ~5%
2022-06-28 20:45:03 +02:00
kkmuffme
57239a7c8e assign keys to variable for better performance
improves performance by ~1-1.5%
2022-06-28 20:40:43 +02:00
kkmuffme
4048bb9d8b only sort when necessary and faster hash
* sort is much more expensive than count, so we only sort if we have something to sort
* could implement for ksort too, but advantage there is minimal since we almost always have more than 1 possibility
* use same hash algorithm as in other places (= faster)
* reduces runtime by 2-3%
2022-06-28 20:40:43 +02:00
kkmuffme
4db928e923 split loop for better performance
* check isset for all elements first, as array_diff is much more expensive
* Improves performance by 1%
2022-06-28 20:40:43 +02:00
Tim Düsterhus
31ad16d29c
Stop using deprecated string interpolation syntax in StatementsProvider.php
This fixed the following PHP 8.2 deprecation:

> Uncaught RuntimeException: PHP Error: Using ${var} in strings is deprecated, use {$var} instead in …/vimeo/psalm/src/Psalm/Internal/Provider/StatementsProvider.php:140

see: https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-06-27 23:41:51 +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
47d83093c3
Merge pull request #8181 from Nicelocal/avoid_reparsing
Avoid re-parsing template types
2022-06-27 19:14:43 +02:00
Maximilian Bösing
df927d076d
qa: drop unnecessary ensure_source_equality check
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-27 18:19:34 +02:00
38089ebec3
Avoid re-parsing template types 2022-06-27 11:38:17 +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
orklah
a4ab664aee
Merge pull request #8165 from AndrolGenhald/stop-using-issuebuffer-add-😡
Improve @psalm-internal and prevent usage of IssueBuffer::add().
2022-06-25 10:12:10 +02:00
AndrolGenhald
b671117417 Improve @psalm-internal and prevent usage of IssueBuffer::add(). 2022-06-25 02:09:40 -05:00
AndrolGenhald
5ff54bce46 CS fix. 2022-06-24 21:03:33 -05:00
AndrolGenhald
3aea0987ef Fix non-empty encapsed string check. 2022-06-24 20:28:04 -05:00
AndrolGenhald
a804e459b6 PHP 7.1 compatibility. 2022-06-24 19:29:12 -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
AndrolGenhald
450409f045 Infer literal string from encapsed (interpolated) string. 2022-06-24 17:24:34 -05:00
Benjamin Morel
933714f6ad Add ReflectionProperty properties 2022-06-24 18:47:49 +02:00
7a5120c4f7
Run method call prohibition analyzer when cloning 2022-06-24 12:37:33 +02:00
Matt Brown
7be32f2020 Remove unused use 2022-06-23 21:30:12 -04: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
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
AndrolGenhald
c0de59c943 Add simplexml stub. 2022-06-22 01:15:43 -05:00
Matt Brown
710768e496 Remove comma 2022-06-21 14:59:01 -04:00
Matt Brown
6fa0da9e37 Fix minor taint analysis bug with nested array assignment 2022-06-21 12:42:32 -04: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
f8724761b3
Fix parameter storage corruption 2022-06-13 10:28:33 +02:00
Maximilian Bösing
0d96766640
bugfix: single does not mean that only one single atomic type is stored within a union
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 19:39:13 +02:00
Maximilian Bösing
3fd7a8b6d7
qa: refactor code to avoid too many nesting levels
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 19:27:54 +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
ed1bb8a9a6
bugfix: in case the old type is already more accurate than the new type, do not consider the new type as a replacement
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 03:35:59 +02:00
Maximilian Bösing
02d4f0c614
feature: add more accurate equals checks for TLiteralFloat, TLiteralInt and TLiteralString
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 03:34:45 +02:00
Maximilian Bösing
6a73fbd1d2
bugfix: tighten the detection of types which narrow down other types
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:51:36 +02:00
Maximilian Bösing
4068f5cbb0
feature: add Union#allFloatLiterals as it was missing
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 02:50:48 +02:00
Maximilian Bösing
e13268f5c0
qa: use $assertion_var_id over $arg_var_id for better type reflection
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 01:33:13 +02:00
Maximilian Bösing
6c1ed90dc1
qa: ensure we use multiple isset to verify the existence of $arg_var_id
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 01:29:30 +02:00
Maximilian Bösing
c68b6e9d26
bugfix: only allow narrowing down types in case the old type is not single
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 01:21:38 +02:00
Maximilian Bösing
4ee1b3feb4
bugfix: only extend existing logic instead of hijacking it
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 01:15:46 +02:00
Maximilian Bösing
2d9133b35a
bugfix: overriding types based on assertions have to pass more checks
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-12 00:32:36 +02:00
Maximilian Bösing
7c85e0c0d9
bugfix: only override templated values in case of literals
This will avoid issues with invalid intersection assertions.

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-11 23:30:52 +02:00
d352ae4e07
Skip native classlike aliases 2022-06-09 11:20:02 +02:00
Maximilian Bösing
40971ff57d
bugfix: allow non-single union types in assertions
fixes #5657

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2022-06-09 00:26:34 +02:00
Matt Brown
a9775c656c Fix style 2022-06-08 16:03:27 -04:00
Matt Brown
6d09c3c794 Remove nonsensical taint analysis rule 2022-06-08 16:00:06 -04: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
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
34322b79dd Fix suppression comment. 2022-06-06 16:19:27 -05:00
kkmuffme
74671e3a3c fix false positives for partially incalid phpdoc 2022-06-05 12:16:01 +02:00
orklah
f47b4180fb
Merge pull request #8054 from kkmuffme/runtime-cache-origin-location
store origin location by ID to speed up psalm by up to 75%
2022-06-04 18:47:14 +02:00
kkmuffme
cb78f54d8a Performance: cut the selected_text from snippet
instead of from full text

50% faster than cutting from full text, improves performance up to 3% depending on file length and number of errors in file
2022-06-04 15:53:02 +02:00
kkmuffme
8b20708063 stores origin location by ID to speed up psalm by up to 75% in certain cases 2022-06-04 14:26:27 +02: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
AndrolGenhald
054ed300f0
Fix side effect when loading config. 2022-05-29 00:16:38 -04:00
Bruce Weirdan
fce4272226
PHP 7.4 fixes 2022-05-28 16:40:49 -04:00
Bruce Weirdan
5d21ff98b6
Suppress false posisitives 2022-05-28 16:34:53 -04:00
Bruce Weirdan
242ee344ec
CS fix 2022-05-28 16:26:08 -04:00