Repository navigation
Commit 3dd2526
committed
Read regex shapes with PHPRegex instead of the generated parser
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 generated parser, its
grammar, its build script and the phplrt runtime 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 035c883 commit 3dd2526
65 files changed
Lines changed: 2584 additions & 5421 deletions
File tree
- build
- regex-parser
- conf
- src
- Analyser/ResultCache
- Command
- DependencyInjection
- Php
- Rules/Regexp
- Type
- Php
- Regex
- Parser
- tests/PHPStan
- Analyser/nsrt
- Command
- 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 | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 180 | | |
189 | 181 | | |
190 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 42 | | |
46 | 43 | | |
47 | 44 | | |
| |||
This file was deleted.
0 commit comments