diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-17 03:23:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-17 03:23:52 +0900 |
| commit | abffae07ed350ebb1de98edd2ae246ccddfa6085 (patch) | |
| tree | 6c917cc08e39ad95078505951bdea4b9ae538630 /scripts/linters/src/Linters/NoExceptionDowncast.php | |
| parent | 8b57e90f5c563bbc1a6060d9f5e94b5d3cd91324 (diff) | |
| download | php-shirabe-abffae07ed350ebb1de98edd2ae246ccddfa6085.tar.gz php-shirabe-abffae07ed350ebb1de98edd2ae246ccddfa6085.tar.zst php-shirabe-abffae07ed350ebb1de98edd2ae246ccddfa6085.zip | |
refactor(preg): merge preg_match_all_offset_capture2() into its sibling
The two functions ran the same search and differed only in how they
reported a non-participating group: one as ("", 0) in a bespoke struct,
the other as (null, -1) in a capture-key map. Neither shape covered both
callers, because PHP reaches preg_match_all() with different flags from
each: Preg::matchAllWithOffsets() always ORs in PREG_UNMATCHED_AS_NULL,
while OutputFormatter::formatAndWrap() passes PREG_OFFSET_CAPTURE alone.
Keep the capture-key map, which also exposes named groups, and take the
flags that decide between null and "" for an unmatched group. The offset
is -1 either way, so the ("", 0) approximation is gone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'scripts/linters/src/Linters/NoExceptionDowncast.php')
0 files changed, 0 insertions, 0 deletions
