Repository navigation
Commit 6fa8c53
committed
Read regex shapes with PHPRegex instead of the Hoa grammar
The shapes of preg_match(), preg_match_all() and preg_replace_callback()
are read from the AST and the capture shape analysis of PHPRegex, a
PCRE2 pattern parser that runs on PHP 7.4. The Hoa packages, their
patches, the grammar file and the scoper and autoload workarounds for
them are removed, and ignoreErrors patterns are validated with the same
parser.
Patterns are read for the analysed PHP version and the PCRE2 version it
bundles; a pcreVersion parameter, or config.platform.lib-pcre in
composer.json, can set that version. With bleeding edge,
RegularExpressionPatternRule also reports a pattern the running PHP
compiles but the analysed PHP does not.
A new test matches every constant pattern of the preg_* fixtures with
the engine, on generated subjects and with every flag combination, and
checks that the inferred type accepts what the engine writes.1 parent 74c549b commit 6fa8c53
73 files changed
Lines changed: 2585 additions & 2865 deletions
File tree
- bin
- build
- compiler/build
- conf
- patches
- resources
- src
- Analyser/ResultCache
- Command
- DependencyInjection
- Php
- Rules/Regexp
- Type
- Php
- Regex
- tests/PHPStan
- Analyser/nsrt
- Command
- Composer
- Rules/Regexp
- data
- Type
- Php
- Regex
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 55 | | |
63 | 56 | | |
64 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 108 | | |
114 | 109 | | |
115 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
| |||
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
| 37 | + | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 103 | | |
136 | 104 | | |
137 | 105 | | |
| |||
174 | 142 | | |
175 | 143 | | |
176 | 144 | | |
177 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
178 | 151 | | |
0 commit comments