1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-10 15:09:04 +01:00
Commit Graph

61 Commits

Author SHA1 Message Date
3abd0b961f Immutable Unions 2022-10-03 10:45:36 +02:00
Bruce Weirdan
58e87fa5e0
Applied ArraySpreadInsteadOfArrayMergeRector (take 2) 2022-07-29 18:17:21 -04:00
AndrolGenhald
285740a753 Merge branch '4.x' 2022-07-07 15:01:38 -05:00
AndrolGenhald
2559222f67 More interpolation and concatenation improvements. 2022-06-24 19:22:59 -05:00
Bruce Weirdan
e0acf22e40
Merge branch '4.x' into update-master 2022-05-28 14:49:12 -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
AndrolGenhald
525a86e19d Improve bool to int casting. 2022-02-18 13:22:17 -06:00
Bruce Weirdan
11e60fa261
Merge branch '4.x' into upstream-master 2022-02-11 03:51:48 +02:00
orklah
1c2ffc81c2 tweaks 2022-02-01 22:49:20 +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
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
orklah
0747b48d06
remove TEmpty 2022-01-03 04:09:59 +02:00
orklah
8d6b781b3e
use consistent way to compare php version 2022-01-02 13:35:43 +02:00
orklah
ca25b0f815 always unflag before leaving a analyzer 2021-12-21 18:30:29 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
rarila
1c298c4605 Conversion of Psalm\Type 2021-12-14 02:31:22 +01:00
ralila
e32af3c05a Conversion of Psalm\Type\Atomic 2021-12-14 02:26:28 +01:00
orklah
50cc629a43 fix cs 2021-12-11 23:03:10 +01:00
orklah
a1268d94d5 fix some more expressions that can be replaced by getSingleAtomic 2021-12-11 22:37:44 +01:00
rarila
39402c233d
Return type hints (#7065)
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
2a956498bf Import instead of using fqn functions 2021-12-03 21:07:25 +01:00
ralila
245920e53c Import instead of using fqn 2021-12-03 20:11:20 +01:00
Matthew Brown
175ba83332
Migrate most IssueBuffer::accepts calls to IssueBuffer::maybeAdd (#7020) 2021-11-29 14:54:17 -05:00
orklah
24137bdbad Array cast pass taints 2021-11-04 00:29:36 +01:00
orklah
ae193ca4da replace elvis operator by coalesce operator when applicable 2021-10-13 20:16:06 +02:00
orklah
72eab30a3a coalesce operator 2021-09-26 23:34:31 +02:00
orklah
c11b32d414 redundant variable check 2021-09-26 22:37:17 +02:00
Matt Brown
67d68a5dc0 Use more accurate variable name 2021-06-25 09:54:39 -04:00
orklah
872f1c232c
allow Psalter to fix RedundantCast (#5948)
* allow Psalter to fix RedundantCast

* fix test
2021-06-17 18:15:45 -04:00
Matt Brown
9dde8eed9d Add support for literal-int annotations as well 2021-06-14 23:24:09 -04:00
Matt Brown
c3fdfc5795 Support literal ints in encapsed strings 2021-06-14 16:30:45 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Matt Brown
ccd50fdb34 Fix ##5795 - array casts should always be lists 2021-05-19 15:17:50 -04:00
orklah
6501ca7b95
Redundant cast to Int preserve type (#5773)
* Redundant cast to Int preserve type

* add test
2021-05-15 07:19:18 -04:00
Bruce Weirdan
8be77aaa2e
Track variable usage in bool to int casts (#5349)
Fixes vimeo/psalm#4956
2021-03-11 00:08:32 -05:00
Matt Brown
0f2a07a9a3 Fix #5137 – support @psalm-flow in methods 2021-01-31 22:40:48 -05:00
orklah
62d5ea83a1
Allow int casts if the type comes from calculation (#4768) 2020-12-03 23:15:07 -05:00
Matt Brown
2f00500c91 Improve message 2020-12-02 22:08:14 -05:00
Matt Brown
e7f9ce6da0 Break out RedundantCast issues 2020-12-01 17:25:45 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Matt Brown
f0ae0e5cb4 Break aparat type combiner 2020-11-21 18:11:29 -05:00
Matt Brown
5c784dc7cb Fix #4435 - ensure casts are always flow-sensitive 2020-10-28 14:06:05 -04:00
Matt Brown
724b25b918 Change control_flow_graph to data_flow_graph 2020-10-13 17:28:12 -04:00
Matt Brown
127e66df65 Elevate trait mismatch issues in PHP 8.0 2020-10-03 22:59:43 -04:00
Matt Brown
14efde286f 4.x - refactor unused variable detection
This turns unused variable detection into an explicit control-flow problem, where before we had a more simplistic mark-and-sweep algorithm
2020-09-30 12:28:13 -04:00
Brown
19f88a2e31 Add improvements from unused variable checks 2020-09-28 00:45:02 -04:00
Brown
56cddd16bf Rename TaintGraph to ControlFlowGraph because it’s about to do more 2020-09-20 23:59:52 -04:00
Brown
2968b3b065 Add to StatementsAnalyzer taint object instead of Context 2020-09-20 18:42:21 -04:00
Brown
abb9502921 Rename Taint object to TaintGraph 2020-09-20 18:27:02 -04:00