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

55 Commits

Author SHA1 Message Date
orklah
350df114f3
Transform bad offsets (#5817)
* Transform bad offset access

* fix build
2021-05-23 14:43:30 -04:00
Matt Brown
10ccbdd8be Add tainting for array keys
Fixes #5470
2021-03-24 15:32:56 -04:00
Matt Brown
937e68cc75 Change taint path names to prepare for allowing array key tainting 2021-03-24 15:23:56 -04:00
Matt Brown
15b0542260 Prevent more offset issues 2021-03-22 23:26:03 -04:00
AndrolGenhald
0579c1109b
Fix bugs with array spread operator (fixes #5421) (#5433) 2021-03-19 22:43:58 -04:00
Samuel Mortenson
4aabb411a8
Added event to prevent tainting. (#5398)
* Added event to prevent tainting.

* Remove optional codebase parameter.

* Removed falsy check for codebase.

* Use two separate hooks for adding and removing taints

* Add slashes

* Update add/remove taint test name.

* Cleaned up SafeArrayKeyChecker example plugin.

* Added more AddRemoveTaintsEvent calls to codebase.

* Fix type check error with $added_taints param.

* Added AddRemoveTaintsEvent to remaining classes.

* Fix post-merge error.

* Add comma

* Remove $int_offset that never existed

Co-authored-by: Matt Brown <github@muglug.com>
2021-03-19 22:41:41 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Bruce Weirdan
d296c4bb9a
Add missing dataflow population in array spreads (#5059)
Fixes vimeo/psalm#5057
2021-01-20 17:42:11 -05:00
orklah
7a40443ffb
don't throw InvalidArrayOffset when dealing with templates (#5019) 2021-01-14 16:35:06 -05:00
Matt Brown
6eae582763 Prevent mixed array offset in array creation
Fixes #4846
2020-12-16 08:18:18 -05:00
Matt Brown
c7087c150b Fix #4848 - use better inference when incorrect array keys are passed 2020-12-16 08:07:57 -05:00
Matt Brown
5dd4912a99 Simplify ArrayAnalyzer
Ref #4714
2020-11-27 14:19:55 -05:00
orklah
4bbb72329e
Fix PHPMAXINT offset (#4707) 2020-11-26 09:24:32 -05:00
orklah
58736924dd
fix wrong cast to int when string offset is a number > MAX INT (#4702) 2020-11-25 15:48:53 -05:00
orklah
b6cb9785ac
Prevent illegal array keys (#4660)
* Emit an issue when an array-key is not legal

* tests
2020-11-23 15:20:39 -05:00
Matt Brown
f0ae0e5cb4 Break aparat type combiner 2020-11-21 18:11:29 -05:00
Matt Brown
236292ff05 Fix #4600 - set attributes in a bunch of places 2020-11-18 12:44:59 -05:00
Axel H
271e0d86be
Fix type inference when unpacking typed iterables (#4487)
* Add test for unpacking typed iterables

* Fix type inference when unpacking typed iterables into arrays

* Fix possibly undefined array offset
2020-11-06 17:24:01 -05:00
Matt Brown
724b25b918 Change control_flow_graph to data_flow_graph 2020-10-13 17:28:12 -04:00
Matt Brown
516141a380 Rename ControlFlowGraph to more appropriate DataFlowGraph 2020-10-13 16:49:03 -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
0f6a271858 Improve file-based suppression of taints 2020-09-20 19:37:25 -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
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
Brown
ae7c5b095b Fix #3712 - allow taints to be suppressed with @psalm-suppress 2020-07-01 23:23:45 -04:00
Brown
49f0592794 Improve tracking of array taints 2020-06-18 18:48:19 -04:00
Matthew Brown
187b944680 Add faster taint analysis 2020-05-22 12:33:29 -04:00
Brown
5ee1487a01 Make ExpressionAnalyzer more beautiful 2020-05-18 15:13:27 -04:00
Matthew Brown
bfb919d26a Break out methods into their own classes 2020-03-11 23:04:52 -04:00
Matthew Brown
27fd76649c Prevent more array<mixed, ...> construction 2020-02-22 12:20:03 -05:00
Matthew Brown
5eb2ebc508 Add more type-system protections for bad array args 2020-01-29 23:41:17 -05:00
Matthew Brown
37810b5a44 Fix #2552 - add parse error when encountering empty array values 2020-01-04 16:33:02 -05:00
Matthew Brown
9fa2db1b6c Move Union::getTypes to Union::getAtomicTypes 2020-01-04 12:20:26 -05:00
Matthew Brown
4334ddcaa3 Fix style 2019-11-27 02:11:18 -05:00
Matthew Brown
3f2d57c7a3 Fix #2379 - support spread array RFC 2019-11-27 02:07:17 -05:00
Brown
0bcb7863f3 Use better system for storing inferred types and assertions 2019-11-25 11:44:54 -05:00
Matthew Brown
4478d31593 Taint arrays in creation 2019-10-11 23:28:17 -04:00
Brown
cc9a925e84 Allow list to be coerced to callable 2019-10-10 10:26:13 -04:00
Brown
16c33d1565 Add support for list type
Fixes #2209
2019-10-08 18:44:46 -04:00
Brown
c5ef2516b5 Fix #2150 - add detection for unnecessary @var annotations
And also remove them from codebase
2019-09-19 11:59:43 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Matthew Brown
53506fb879 Fix #1770 - fix notice that should not be 2019-06-12 09:13:59 -04:00
Matthew Brown
c38108f95d Fix byref array assignment
Fixes #1702
2019-06-08 10:32:46 -04:00
Brown
cacd5a1946 Cast null array key to empty string
Fixes #1487
2019-03-22 16:45:17 -04:00
Brown
bbf013bfb8 Fix #1279 - speed up analysis of large arrays 2019-02-04 16:06:14 -05:00
Matthew Brown
a89a201c71 Fix #1180 - array key maths was wrong 2019-01-08 09:56:54 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00