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

2670 Commits

Author SHA1 Message Date
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
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
7a5120c4f7
Run method call prohibition analyzer when cloning 2022-06-24 12:37:33 +02:00
Matt Brown
15387d19cd Track taints in static properties 2022-06-23 16:43:42 -04: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
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
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
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
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
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
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master 2022-05-28 14:49:12 -04:00
AndrolGenhald
6df50159a7 Fix trailing comma in parameter list for PHP 7.4. 2022-05-26 18:41:00 -05:00
AndrolGenhald
31b4dceaf4 Improve handling of unsupported references (fixes #8018). 2022-05-26 18:28:23 -05: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
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
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
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
hirokinoue
b132c3b751 fix error message 2022-04-16 14:05:40 +09:00
hirokinoue
a99532da5e code format 2022-04-16 14:05:31 +09:00
hirokinoue
23c3d87dcc don't emit issues when doing arithmetics on float templates 2022-04-16 14:05:20 +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
Aleksandr Zhuravlev
b4fdc3e326 Made most of callbacks static. Reworked some array_map() into foreach() 2022-04-09 21:58:26 +12:00
Matthew Brown
c8cc3f4607 Add a more homogenous solution 2022-04-06 12:10:11 -04:00
Matthew Brown
4cfab0c441 Fix/ignore dependency issues 2022-04-06 11:45:28 -04:00
Matthew Brown
ed0daaa234 Undo previous commit 2022-04-06 11:45:13 -04:00
Matthew Brown
f3135949fe Clone correct context 2022-04-06 11:36:26 -04:00
Thomas Landauer
587039fd1d Fixing CS 2022-04-03 11:41:39 +02:00
Vincent Langlet
590ac22ea2 Use another strategy 2022-04-03 09:16:00 +02:00
Thomas Landauer
e87c25c825 Second attempt of #7835 2022-04-02 14:57:56 +02:00
b69e22a33b Add a few additional dupes 2022-04-01 12:19:29 +02:00
Matthew Brown
a9f4148db2 Rename referenced_var_ids to cond_referenced_var_ids
Also reduce usage — this was a holdover of the old way of tracking unused variables
2022-03-15 18:40:31 -04:00
orklah
ebffd5258a
Merge pull request #7433 from zoonru/maximum_shaped_array_size
Add configuration for maximum size of shaped array
2022-03-15 21:19:05 +01:00
Matthew Brown
ed4782e0e0 Improve performance of large formula operations 2022-03-12 22:31:12 -05:00
Matthew Brown
427eecdcd8 Remove unnecessary switch statement code 2022-03-11 22:02:55 -05:00
Matthew Brown
4b0667bb14 Group some functionality together 2022-03-07 14:40:28 -05:00
Matthew Brown
9f9fefe7d6 Simplify loop logic a little 2022-03-02 18:49:57 -05:00
Matthew Brown
766fc174a3 Remove unnecessary $child_stmt 2022-03-02 17:34:56 -05:00
Matthew Brown
54edbdabf6 A little light refactoring 2022-03-02 17:27:58 -05: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
5f9a8c9240 Fix types. 2022-02-23 22:12:32 -06:00
AndrolGenhald
43764f0c3d Add Reflection getAttributes analysis. 2022-02-23 22:12:32 -06: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
c9666bbeb5 Reduce method complexity 2022-02-22 20:50:43 +02:00
Bei Xiao
6a3b5679fe Support interfaces extending enums 2022-02-22 16:04:56 +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
d7d846edc8
Merge branch '4.x' into upstream-master 2022-02-20 02:31:15 +02: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
Bruce Weirdan
6a68287700
Merge pull request #7696 from AndrolGenhald/improve-bool-to-int-cast 2022-02-18 22:17:29 +02:00
AndrolGenhald
525a86e19d Improve bool to int casting. 2022-02-18 13:22:17 -06:00
AndrolGenhald
c1077f32d3 Improve documentation for InvalidGlobal to explain that it's sometimes valid. 2022-02-18 11:36:25 -06:00
AndrolGenhald
8f710cc37f Fix crash when data_flow_graph is null. 2022-02-17 10:34:34 -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
Matthew Brown
6af3b502df Remove unnecessary array assignment 2022-02-16 13:04:23 -05: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
87d9a01f78 Add configuration for maximum size of shaped array 2022-02-15 14:09:08 +01:00
eb3df40fbb
Add option to disable @var parsing everywhere except for properties. 2022-02-15 10:04:56 +01: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
1142c818c2 Merge remote-tracking branch 'upstream/4.x' into upstream-master9 2022-02-14 00:10:28 +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
fd0ecf2528 Rename variable to be consistent with existing convention. 2022-02-13 15:34:21 -06: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
59d3d2aa31
Merge pull request #7655 from orklah/enumCollapsing
Enum collapsing
2022-02-13 11:01:07 +01:00
orklah
954884eb48 consistency between TernaryAnalyzer and IfElseAnalyzer 2022-02-13 10:52:22 +01:00
orklah
a915ef5853 also remove a from_calculation flag which was scheduled for removal in Psalm 5 2022-02-12 10:19:39 +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
Matthew Brown
c885dbcbe0 Prevent duplicate type comparison errors 2022-02-10 01:04:14 -05:00
orklah
9984397766
Merge pull request #7622 from orklah/assertions
consistency in AssertionFinder
2022-02-09 22:53:28 +01:00
Matthew Brown
2eca28c912 Remove more unused code from LoopAnalyzer 2022-02-09 16:37:15 -05:00
orklah
1c74774c40 consistency 2022-02-09 21:48:33 +01:00
orklah
0f1efa9079 documentation 2022-02-09 21:15:22 +01:00
Matthew Brown
5575fa1e32 Remove unnecessary method 2022-02-09 12:18:15 -05:00
Matthew Brown
9d8b6d641b Remove more unused code 2022-02-08 18:20:14 -05:00
Matthew Brown
48b702b76a Remove some unnecessary code 2022-02-08 17:12:18 -05:00
Matthew Brown
e130dd9b1c Fix too-long line 2022-02-08 16:28:21 -05:00
Matthew Brown
e35e6fe992 Improve naming of variables 2022-02-08 16:25:33 -05:00
Matthew Brown
13824d5a33 Fix awkward workaround for loop assignment map 2022-02-08 10:59:29 -05:00
Tomasz Kusy
124aa22fe9 Resolve __DIR__ / __FILE__ when const/variable is used for include CS fix fix fix :) 2022-02-04 20:27:45 +01:00
Tomasz Kusy
8da45aa7d8 Resolve __DIR__ / __FILE__ when const/variable is used for include CS fix fix 2022-02-04 20:26:06 +01:00
Tomasz Kusy
b73f2c96d8 Resolve __DIR__ / __FILE__ when const/variable is used for include CS fix 2022-02-04 19:43:55 +01:00
Tomasz Kusy
bcbfbed072 Resolve __DIR__ / __FILE__ when const/variable is used for include 2022-02-04 19:39:39 +01:00
Matthew Brown
3a298d028e Rename getArrayVarId to getExtendedVarId 2022-02-04 12:49:12 -05:00
AndrolGenhald
5b469ca577 Fix crash when assigning reference to unknown array offset. 2022-02-04 08:32:35 -06:00
Matthew Brown
8098755ce5 Remove comma 2022-02-02 11:29:31 -05:00
Matthew Brown
b382d7db3c Remove some unnecessary code around taint analysis 2022-02-02 11:25:03 -05:00
Matthew Brown
2b81990259 Simplify var naming 2022-02-02 11:25:02 -05:00
Vincent
3c3e692e7e AtomicStaticCallAnalyzer: clear tmp var from context (fix #7556) 2022-02-02 13:51:54 +01:00
orklah
1c2ffc81c2 tweaks 2022-02-01 22:49:20 +01:00
orklah
68e67aeb10
Merge pull request #7546 from orklah/impure-callable
Handle first class callable on unknown functions
2022-01-31 22:02:35 +01:00
orklah
a598efb4ab Handle first class callable on unknown functions 2022-01-31 21:36:01 +01:00
adrew
e284b91b82 Remove redundant flag from SimpleTypeInferer 2022-01-31 23:03:34 +03:00
adrew
121a801616 Fix object constant inference 2022-01-31 23:03:34 +03:00
orklah
48e09ab308 fix 2022-01-31 20:55:53 +01:00
orklah
fc281672ea fix wrong detection of purity 2022-01-31 20:52:25 +01:00
Matthew Brown
fcfd4d30f3 Simplify passing in template result for calls 2022-01-31 09:36:40 -05:00
Bruce Weirdan
a2977a5ca9
Merge branch '4.x' into upstream-master 2022-01-31 00:16:27 +02:00
orklah
0592c03cda fix issues resulting from previous commit 2022-01-30 16:05:38 +01:00
orklah
5a3735b90a Change code so it handles what it was designed for 2022-01-30 16:05:22 +01:00
Vincent Langlet
854a3412fe Use function 2022-01-30 15:32:55 +01:00
Vincent Langlet
cd3213201d Fix 2022-01-30 15:30:40 +01:00
Matthew Brown
faaf7690f6
Remove mic-drop hack from if analysis (#7484)
* Remove mic-drop hack from if analysis

* Remove more special handling

* Remove some unnecessary ElseAnalyzer code

* Add back necessary code

* Fix return type of method never returning null

* Add a comment

* Simplify && handling

* Add comments to make stuff clearer

* Move if-specfic logic to more appropriate setting
2022-01-28 18:30:47 -05:00
orklah
048025b1d6
Merge pull request #7511 from orklah/literal-inequality
improve literal inequality with ranges and rework GreaterThan/LessThan assertions
2022-01-28 22:27:09 +01:00
orklah
3b73654db7 handle literal inequality with ints 2022-01-28 21:59:30 +01:00
adrew
3c22ecfa98 Remove args pre-analysis before run params provider hook 2022-01-28 15:18:30 +03:00
adrew
89c6a70dda Simplify dynamic storage handling in FunctionCallAnalyzer 2022-01-28 15:18:30 +03:00
adrew
a4e56ae288 Fix method name 2022-01-28 15:18:30 +03:00
adrew
ce1cec5d3a Using FuncCall instead of list<Arg> in FunctionDynamicStorageProvider for more flexibility 2022-01-28 15:18:30 +03:00
adrew
438be03414 Ability to provide dynamically created function storage via plugin hook 2022-01-28 15:18:29 +03:00
AndrolGenhald
282518ce5f Fix failing case in ClassConstAnalyzer and add test. 2022-01-27 21:50:36 -06:00
AndrolGenhald
35353c6931 Re-add failing assert, enable assertions on CI. 2022-01-27 21:29:43 -06:00
Matthew Brown
1a6f968e15 Remove dodgy assertion cc @AndrolGenhald
This assertion broke tests when assertions were turned on
2022-01-27 20:58:35 -05:00
orklah
9168cef2d4 Merge remote-tracking branch 'upstream/4.x' into upstream-master6 2022-01-26 21:06:25 +01:00
AndrolGenhald
e268a05307 Minor fixes after rebasing. 2022-01-26 12:57:19 -06:00
AndrolGenhald
57b99be519 Improve reference support for assertions, array offsets, and properties. 2022-01-26 12:55:47 -06:00
AndrolGenhald
bf606202f8 Remove impossible TODO. 2022-01-26 12:55:47 -06:00
AndrolGenhald
f9450656e1 Add support for references and improve UnusedVariable checks (fixes #7254). 2022-01-26 12:55:47 -06:00
AndrolGenhald
0b81f46bb1 Fixes after rebasing. 2022-01-25 15:31:09 -06:00
AndrolGenhald
0edf260d8b Improve class constant static analysis.
Add class const covariance support (fixes #5589).
Add check for overriding const from interface in PHP < 8.1 (fixes #7108).
Add check for ambiguous const inheritance.
2022-01-25 15:20:17 -06:00
orklah
7c8441baec
Merge pull request #7123 from AndrolGenhald/feature/942-type-annotate-class-constants
Support type annotations for class consts (fixes #942).
2022-01-25 20:54:40 +01:00
Matthew Brown
c974f23852 Simplify context references 2022-01-24 16:35:42 -05:00
Matthew Brown
18f5446924 Remove unnecessary hack embedding IfScope in Context object 2022-01-24 14:00:20 -05:00
Matthew Brown
c7d938bbbe Remove unnecessary code in Context::removeDescendants 2022-01-24 10:34:48 -05:00
orklah
f1c4b62f5c
Merge pull request #7414 from b2pweb/call-docblock-method-using-parent
Add support of docblock method using parent keyword
2022-01-24 13:02:57 +01:00
orklah
0619b404e5
Merge pull request #7390 from VincentLanglet/exceptionCode
Add Exception->getCode() return type provider
2022-01-24 12:56:57 +01:00
Vincent Langlet
9905baeceb Add flagfrom_calculation 2022-01-24 09:31:10 +01:00
Vincent
280de4bc98 Fix undefined parent method call (ref #7414) 2022-01-24 09:17:29 +01:00
Matthew Brown
ab2b77d9f5 Fix unnecessary array merge
This operation is already performed on line 420
2022-01-23 23:17:51 -05:00
orklah
63b802bff4 remove TPositiveInt 2022-01-23 23:49:23 +01:00
orklah
7c4f08067b Merge remote-tracking branch 'upstream/4.x' into upstream-master5 2022-01-23 23:44:04 +01:00
orklah
c90cffd382
Merge pull request #7472 from orklah/intrange
remove TPositiveInt usage for TIntRange
2022-01-23 22:04:33 +01:00
orklah
a7b72b865f remove TPositiveInt usage for TIntRange 2022-01-23 22:04:18 +01:00
Matthew Brown
865a9f81bc Remove nullability from properties that don’t need them 2022-01-23 14:18:53 -05:00
orklah
82d84b0b3a fix internal properties on interfaces 2022-01-23 13:08:35 +01:00
AndrolGenhald
0fb0632e0d Infer type from known ternary condition. 2022-01-22 17:06:54 -06:00
AndrolGenhald
558208e44e Add type checking for class const assignments, fix several other const issues. 2022-01-22 17:06:54 -06:00
AndrolGenhald
c877ce031e Use inferred type instead of annotated type where possible. 2022-01-22 17:06:54 -06:00
AndrolGenhald
c18a155f77 Support type annotations for class consts (fixes #942). 2022-01-22 17:06:53 -06:00
orklah
841d4f4429 improve support for enum_exists 2022-01-22 18:27:24 +01:00
orklah
af1888b631 Merge remote-tracking branch 'upstream/4.x' into upstream-master4 2022-01-22 17:48:42 +01:00
orklah
73af019110 fix a weird case 2022-01-22 17:45:40 +01:00
orklah
997d5d5f5f handle two more cases of firstClassCallable 2022-01-22 17:37:35 +01:00
Toon Verwerft
6b789bb5a7 [TypeProvider] Provide argument types during FunctionParamsProviderEvent 2022-01-21 16:32:40 +01:00
orklah
f9b26acf6e Array key exists assert both ways 2022-01-21 00:26:37 +01:00
orklah
fe9d3f02a8 nitpicks 2022-01-20 23:47:41 +01:00
Matthew Brown
0a81f8cd6c
Use objects, not strings, for assertions (#7410)
* Use objects, not strings, for assertions

* Remove unnecessary param

* Remove some unnecessary checks

* Fix bad find/replace

* Add note about assertions no longer stored as strings in UPGRADING.md
2022-01-20 17:33:06 -05:00
orklah
6f1a5e8a47
Merge pull request #7417 from klimick/partially-applied-closure-inference
Contextual type inference for high order function arg
2022-01-20 21:03:46 +01:00
Vincent Quatrevieux
c7bfc03a6b
Merge branch '4.x' into call-docblock-method-using-parent 2022-01-20 08:59:50 +01:00
Vincent
f7252417e4 Fix typing (ref #7430) 2022-01-19 13:49:41 +01:00
Vincent
7b25ca75f4 Resolve generics of inherited pseudo methods (fix #7419) 2022-01-19 11:45:19 +01:00
adrew
7e623ed48e Upcast invokable to callable during hof arg analysis 2022-01-19 00:37:05 +03:00
adrew
fca72ee151 Fix psalm issues 2022-01-18 22:05:32 +03:00
orklah
dceaa117cf remove forbidEcho 2022-01-18 18:25:18 +01:00
orklah
5f749c8a33 remove forbidEcho 2022-01-18 18:14:39 +01:00
adrew
6e1957e40a Support higher order func arg inference for static and instance calls 2022-01-18 18:45:28 +03:00
adrew
12648f4c9e Comments for describe how works higher order func arg inference 2022-01-18 13:36:16 +03:00
adrew
ffdf97c44d Remove unused function 2022-01-18 13:17:50 +03:00
adrew
a0bda8683a Rename method 2022-01-18 13:13:17 +03:00
adrew
6f9b6f8538 Fix psalm issues 2022-01-18 12:53:39 +03:00
adrew
cce1f9a407 Some refactoring and doc for high order function argument handling 2022-01-18 12:44:36 +03:00
adrew
00ce1107d3 Infer partially applied closure arg by previous function arg 2022-01-18 03:02:21 +03:00
Vincent
09fc43a4d8 Add support of docblock method using parent keyword (fix #7411) 2022-01-17 19:26:42 +01:00
Ricardo Boss
26dd4c5b8f
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-01-16 21:33:04 +01:00
orklah
5b82082bbd Merge remote-tracking branch 'upstream/4.x' into upstream-master2 2022-01-15 20:21:00 +01:00
orklah
9a9243e5fe
Merge pull request #7385 from b2pweb/handle-template-on-pseudo-method
Add support of template for docblock methods
2022-01-15 11:26:03 +01:00
orklah
75947c97c6
Merge pull request #7391 from b2pweb/docblock-method-inheritance
Handle inherited docblock method
2022-01-15 11:24:06 +01: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
orklah
4a85fed181 use Reconciler::RECONCILIATION_* 2022-01-14 19:39:18 +01:00
Vincent
a52362465b Handle inherited docblock method (fix #7198) 2022-01-14 10:30:09 +01:00
Vincent Langlet
9f84da4d6f Try another strategy 2022-01-13 23:57:02 +01:00
Vincent
fe7665aaaf Add support of template for docblock methods (fix #7320) 2022-01-13 11:04:37 +01:00
b9e3979c3f
Cs-fix 2022-01-10 10:22:51 +01:00
a35ccfb0cb
Revert misguided changes 2022-01-10 10:19:12 +01:00
b530f23acc
PHP 8.2: seal all properties by default, add configuration key for lower versions 2022-01-10 10:11:28 +01:00
Matthew Brown
72fd3de886 Simplify return type for TypeExpander::expandAtomic 2022-01-09 16:19:04 -05:00
Matthew Brown
a435bc57b9 Rename was_static property to is_static to be more accurate 2022-01-09 14:45:07 -05:00
orklah
c94e25fa7f refactor the TooFewArguments check to start checking with named arguments 2022-01-09 00:37:16 +01:00
orklah
ce2c6cf438 set the is_list flag for the array inferred for hrtime 2022-01-08 22:48:05 +01:00
Bruce Weirdan
1a1b5a9e6a
Merge branch '4.x' into upstream-master 2022-01-08 23:38:29 +02:00
orklah
afc3a76bc0 Seal the array inferred for hrtime 2022-01-08 22:22:21 +01:00
orklah
9d225086e9 replace empty checks on Union with dedicated method 2022-01-07 21:27:45 +01:00
Bruce Weirdan
762ef8dab4
Merge branch '4.x' into upstream-master 2022-01-07 08:44:32 +02:00
Fabien Villepinte
b9d8dd9d3f
Fix analysis when __invoke() exists 2022-01-06 21:22:18 +01:00
Bruce Weirdan
3fb3db3516
Merge branch '4.x' into upstream-master 2022-01-06 10:05:53 +02:00
Bruce Weirdan
b6559dcefb
Merge pull request #7315 from weirdan/rector-ClosureToArrowFunctionRector 2022-01-06 02:04:10 +02:00
orklah
bf4bf92cb2
Merge pull request #7313 from orklah/empty-arrays
replace `array<never, never>` as a way to detect empty arrays by a dedicated method
2022-01-05 23:58:45 +01:00
Bruce Weirdan
8726065d21
Applied ClosureToArrowFunctionRector 2022-01-06 00:48:04 +02:00
orklah
3c468b3eeb replace array<never, never> as a way to detect empty arrays by a dedicated method 2022-01-05 23:14:54 +01:00
orklah
e7bc6f273a don't crash when pushing a template to in_array 2022-01-05 22:33:20 +01:00
Bruce Weirdan
94395f18a4
Applied JsonThrowOnErrorRector 2022-01-05 19:32:43 +02:00
Bruce Weirdan
dd09450092
Applied NullCoalescingOperatorRector 2022-01-05 13:09:37 +02:00
Bruce Weirdan
5758d31161
Apply literal number separator rector
I opted for customary 3-digit groups, except version id, where 2-digit
groups are used to match the version id encoding.
2022-01-05 01:00:05 +02:00
Bruce Weirdan
b924032850
Mark internal classes @internal 2022-01-03 09:33:22 +02:00
Bruce Weirdan
ab60d311c2
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-less 2022-01-03 06:04:42 +02:00
Bruce Weirdan
966b6ae2b2
Merge pull request #6808 from orklah/exitFunctions3 2022-01-03 06:04:01 +02:00
orklah
d912663da4
remove isEmpty 2022-01-03 04:10:41 +02:00
Matthew Brown
2358b96f54
Fix merge errors 2022-01-03 04:10:39 +02:00
orklah
0747b48d06
remove TEmpty 2022-01-03 04:09:59 +02:00
orklah
b658b2738f
remove exitFunctions 2022-01-02 15:20:01 +02:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion 2022-01-02 14:56:18 +02:00
orklah
8d6b781b3e
use consistent way to compare php version 2022-01-02 13:35:43 +02:00
Bruce Weirdan
36d5a2a83c
Merge pull request #7019 from zoonru/no_ksort_list 2022-01-02 07:37:21 +02:00
Bruce Weirdan
697db76dc1
Merge pull request #7252 from AndrolGenhald/feature/allow-assertions-on-mutable-object-properties 2022-01-02 07:29:02 +02:00
Bruce Weirdan
376d2a389e
Merge pull request #7259 from klimick/infer-this-context-for-psalm-if-this-is 2022-01-02 05:31:24 +02:00
orklah
de95fbdbf2 revert #7054 2022-01-01 19:34:17 +01:00
orklah
2a6f12296e
Merge pull request #7260 from orklah/6691
forbid calling impure callable in immutable context
2022-01-01 12:08:07 +01:00
adrew
0f69483cc1 Fix method storage fetching 2022-01-01 13:33:00 +03:00
orklah
8049438408 forbid calling impure callable in immutable context 2022-01-01 11:13:45 +01:00
adrew
79ea094433 Template resolving for psalm-if-this-is 2022-01-01 13:03:17 +03:00
orklah
51ba96c09d
Merge pull request #7253 from orklah/5874
allow calling mutation_free function inside a mutation_free context
2021-12-31 00:24:29 +01:00
AndrolGenhald
dd631c0c85 Skip reference tests, allow assertions on magic properties (fixes #6770). 2021-12-30 16:23:59 -06:00
orklah
392402cf6d allow calling mutation_free function inside a mutation_free context 2021-12-30 22:29:36 +01:00
AndrolGenhald
3ac497c811 Allow assertions on mutable object properties.
All of the functionality is already there, we just have to not prevent it.
2021-12-30 14:07:55 -06:00
adrew
2355f1bcdb Remove unused use 2021-12-30 22:46:18 +03:00
adrew
4a903c71a1 Checking psalm-if-this-is before applying psalm-this-out 2021-12-30 21:48:25 +03:00
7c24d33bb2
cs-fix 2021-12-30 11:36:56 +01:00
915ddcc620
Add new RedundantFunctionCall issues 2021-12-30 11:36:32 +01:00
82e24d5c1d
Disallow ksorting lists 2021-12-30 11:30:33 +01:00
Bruce Weirdan
03b7e94748
Merge pull request #7232 from trowski/issue-7196 2021-12-30 10:03:17 +02:00
orklah
0b3e1299de overwritten properties 2021-12-27 23:46:23 +01:00
orklah
5f6bb39888 if with common parts 2021-12-27 23:08:19 +01:00
orklah
2baf3b560a unnecessary statements 2021-12-27 23:00:40 +01:00
orklah
926a56a97c
Merge pull request #7230 from orklah/cleanup6
code grooming
2021-12-27 22:54:39 +01:00