From b8d46b0495d00815a699932ced0b43955c949ab9 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 1 Aug 2026 04:52:50 +0900 Subject: feat(php-src): add a BSD-licensed crate for php-src derived code The audit in .ken/php-shim-copying.md judged 14 functions in shirabe-php-shim (plus php_wordwrap in shirabe-external-packages) to be line-by-line transcriptions or structural imitations of php-src. PHP's relicensing to 3-clause BSD makes keeping them legal, but the boundary between BSD-derived and MIT code was invisible in the source tree. Moving them into their own crate puts the license into the build metadata (so NOTICE generation follows the binary), makes a reverse dependency a compile error, and encodes the origin in the module path, which mirrors php-src's ext tree. Each function records its origin in a fixed-format doc comment, and a new php_src_derivation_boundary linter fails if `php-src` appears in any Rust source outside the crate. Public paths under shirabe_php_shim:: are unchanged: functions that are themselves derived are re-exported with `pub use`, and the wrappers that only validate arguments stay on the MIT side. This also resolves the duplicate wordwrap implementation. shirabe_php_shim::wordwrap was todo!(), so SymfonyStyle::block panicked, while shirabe-external-packages carried its own copy. Both now go through the single port, verified against real PHP on 13 cases covering multi-character breaks and cut. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/linters/lint | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/linters/lint') diff --git a/scripts/linters/lint b/scripts/linters/lint index bcdf1c67..44ea7f6d 100755 --- a/scripts/linters/lint +++ b/scripts/linters/lint @@ -13,6 +13,7 @@ use Shirabe\Lint\Linters\NoFormatTrailingComma; use Shirabe\Lint\Linters\NoModRs; use Shirabe\Lint\Linters\NoStdCollectionsMaps; use Shirabe\Lint\Linters\NoUseAsAlias; +use Shirabe\Lint\Linters\PhpSrcDerivationBoundary; use Shirabe\Lint\Linters\SortedDependencies; use Shirabe\Lint\Runner; @@ -32,6 +33,7 @@ $runner = new Runner($rootDir, [ [new NoModRs(), []], [new NoStdCollectionsMaps(), []], [new NoUseAsAlias(), []], + [new PhpSrcDerivationBoundary(), []], [new SortedDependencies(), []], ]); -- cgit v1.3.1