aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/preg.rs
AgeCommit message (Collapse)Author
2026-07-05perf(pcre): cache compiled regex patterns across preg_* callsnsfisis
Composer's classmap generator re-issues the same PHP-derived pattern string for every scanned file (and every token within it), relying on PCRE's built-in compiled-pattern cache to make that free. shirabe had no equivalent, so every Preg::* call recompiled the pattern from scratch via regex::Regex::new(), making `composer create-project` autoload generation ~130x slower than Composer on a fresh laravel/laravel install (130s vs ~1s). Memoizing compiled patterns by their raw string in compile_php_pattern closes that gap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-06-27refactor: fix compiler warnings and clippy warningsnsfisis
2026-06-26test: port 59 autoload/vcs/installer/util/command tests; fix output capturensfisis
Port autoload_generator (24), bitbucket (14), suggested_packages (11), git_driver (6), archive_manager (3), and a bump command test. Fix the ApplicationTester output-capture root cause (php://memory streams must be readable regardless of fopen mode). Implement posix_getuid/geteuid, the PCRE 'A' anchored modifier, php_strip_whitespace, stream_get_wrappers, is_callable scalars; fix preg_quote angle-bracket escaping and class-map parser regexes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25fix(preg): treat escaped \$ in replacement as a literal dollar signnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20refactor(clippy): resolve idiomatic lint warningsnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20refactor: auto-fix clippy warningsnsfisis
2026-06-14feat(php-shim): implement more shim functionsnsfisis
2026-06-14refactor: auto-fix clippy warningsnsfisis
2026-06-14refactor(pcre): take &mut matches in preg_*2 shim helpersnsfisis
The optional matches output was always passed Some(&mut ...) at every call site, so the Option wrapper added no value. Take &mut directly and inline the former internal helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): return bool/usize from preg_*2 shim helpersnsfisis
preg_match2 returns bool and the preg_match_all* helpers return usize (the match count is never negative), matching how callers use them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): return bool from preg_match shimnsfisis
preg_match can only return 1 or 0 now that compile failure panics, so return bool and update all call sites accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): treat regex compile failure as fatal in shimnsfisis
The preg_* shim helpers wrapped their results in Option/Result solely to signal a regex that failed to compile. Composer never feeds a pattern that fails at runtime, so such a failure is a programming error: panic instead and drop the Option/Result wrappers, updating all callers. preg_replace_callback keeps its Result return type since the callback itself is fallible. preg_match_groups is removed in favor of preg_match at its sole call site. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): consolidate duplicate preg_* shim helpersnsfisis
The preg.rs shim had several near-duplicate functions: simple helpers re-implementing logic already covered by their full-featured `2` variants. Delegate or remove the redundant ones while preserving behavior, and migrate the affected callers: - preg_replace / preg_split now delegate to preg_replace2 / preg_split2 - preg_match_all_simple removed; its caller uses preg_match_all - preg_split_chars removed; its caller uses a char-boundary iterator - preg_match_offset removed; its callers use preg_match2 directly Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14refactor(pcre): move preg_* free functions into php-shimnsfisis
The free preg_* functions, the CaptureKey type, and the PREG_* constants move from the pcre crate into shirabe-php-shim, where the rest of the PHP standard-library shims live. Colliding names take a 2 suffix (preg_match2, preg_split2, etc.) since the shim already exposes differently-shaped variants. Preg keeps its public API and delegates to the relocated functions; CaptureKey is re-exported from composer::pcre so consumers are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>