diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/plugin-stub-generator/generate-stubs | 5 | ||||
| -rw-r--r-- | scripts/plugin-stub-generator/src/Generator.php | 7 | ||||
| -rw-r--r-- | scripts/plugin-stub-generator/targets.list | 7 |
3 files changed, 13 insertions, 6 deletions
diff --git a/scripts/plugin-stub-generator/generate-stubs b/scripts/plugin-stub-generator/generate-stubs index 934577f3..5db83a27 100755 --- a/scripts/plugin-stub-generator/generate-stubs +++ b/scripts/plugin-stub-generator/generate-stubs @@ -117,8 +117,9 @@ foreach ($iterator as $entry) { } } -// The Rust side embeds every stub with include_str!; the two lists must not drift apart. -$libRsText = (string) file_get_contents($libRs); +// The Rust side embeds every stub with include_str!; the two lists must not drift apart. The +// whitespace is squeezed out first because rustfmt wraps a long include_str! across lines. +$libRsText = preg_replace('/\s+/', '', (string) file_get_contents($libRs)); foreach ($files as $relative => $_) { if (!str_contains($libRsText, "include_str!(\"../php/stubs/$relative\")")) { $problems[] = "STUB_FILES in $libRs does not embed $relative"; diff --git a/scripts/plugin-stub-generator/src/Generator.php b/scripts/plugin-stub-generator/src/Generator.php index 12967787..dd62da60 100644 --- a/scripts/plugin-stub-generator/src/Generator.php +++ b/scripts/plugin-stub-generator/src/Generator.php @@ -220,12 +220,11 @@ final class Generator } } + // Constants are compile-time data with no entity behind them, so the declaration is + // copied verbatim, visibility included: a local copy cannot diverge from the entity, + // and nothing that was unreadable in the real class becomes readable here. $constants = []; foreach ($class->getConstants() as $constant) { - if (!$constant->isPublic()) { - $this->errors[] = "$fqcn declares a non-public constant; materializing it is not supported"; - continue; - } $constants[] = $file->verbatim($constant->getStartLine(), $constant->getEndLine()); } diff --git a/scripts/plugin-stub-generator/targets.list b/scripts/plugin-stub-generator/targets.list index 347680d2..411b9e3b 100644 --- a/scripts/plugin-stub-generator/targets.list +++ b/scripts/plugin-stub-generator/targets.list @@ -26,3 +26,10 @@ Composer\Repository\FilesystemRepository Composer\Repository\InstalledFilesystemRepository Composer\Repository\RepositoryManager Composer\Installer\InstallationManager +Composer\Installer\PackageEvent +Composer\DependencyResolver\Operation\SolverOperation +Composer\DependencyResolver\Operation\InstallOperation +Composer\DependencyResolver\Operation\UpdateOperation +Composer\DependencyResolver\Operation\UninstallOperation +Composer\DependencyResolver\Operation\MarkAliasInstalledOperation +Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation |
