Scope all PSR libraries and remove PSR Log compatibility layers#1664
Draft
jakejackson1 wants to merge 1 commit into
Draft
Scope all PSR libraries and remove PSR Log compatibility layers#1664jakejackson1 wants to merge 1 commit into
jakejackson1 wants to merge 1 commit into
Conversation
Prefix every PSR library under GFPDF_Vendor via php-scoper so the plugin is fully self-contained and can no longer collide with other plugins that ship psr/log v2 or v3. - php-scoper: drop the `Psr\*` whitelist from the Monolog config so its PSR references get prefixed, and remove the mpdf patcher that stripped the prefix back off LoggerInterface in the logger-aware traits. - Remove the runtime PSR Log 1/2/3 compatibility layer: delete the MonoLoggerPsrLog2And3 proxy and Logger::get_monolog()'s version probe and class_alias bridging; setup_logger() now instantiates Monolog directly. - Update all type hints to the prefixed GFPDF_Vendor\Psr\Log\LoggerInterface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prefixes every PSR library under
GFPDF_Vendorvia php-scoper so the plugin is fully self-contained and can no longer collide with other plugins that shippsr/logv2 or v3. This lets us delete the runtime PSR Log 1/2/3 compatibility layer entirely.Changes
'Psr\*'whitelist fromtools/php-scoper/config/monolog.phpso Monolog's PSR references get prefixed toGFPDF_Vendor\Psr\*.tools/php-scoper/config/mpdf.phppatcher that stripped the prefix back offLoggerInterfacein the mPDF logger-aware traits.src/Helper/Log/MonoLoggerPsrLog2And3.php(the v2/v3 proxy).Logger::get_monolog()'s runtime version probe andclass_aliasbridging;setup_logger()now instantiates Monolog directly.Test_MonoLoggerPsrLog2And3.phpand updatedTest_Logger.php.use Psr\Log\LoggerInterface;statements insrc/now useuse GFPDF_Vendor\Psr\Log\LoggerInterface;.Verification
vendor_prefixed/viacomposer install+composer prefix; confirmed Monolog and the mPDF traits consistently referenceGFPDF_Vendor\Psr\Log\*and the autoloader maps the prefixed classes.setLogger← the prefixed logger) passes.Dependent add-on PRs
Removing the unprefixed
\Psr\Logshim means add-ons that type-hinted the logger against the plain interface now receive a scoped logger that no longer satisfies that hint. These companion PRs decouple each add-on's logger boundary so they work against both this (scoped) core and older (unprefixed) releases. They should land alongside this PR:$loginSessionId/ZipPath$loginPdfEmail$loginDoesTemplateHaveGroup+ test loggerGPDFAPI::get_log_class()Monolog\LoggerimportsAn org-wide audit of the remaining ~30 dependent repos found no other add-on type-hinting the logger boundary (most consume it only via
Helper_Trait_Logger+ duck-typed calls, which is unaffected).Notes
psr/containeris only a dev-time transitive dependency of php-scoper's own Symfony components and isn't referenced by any production package, so it's intentionally left out of scoping (it won't ship in the--no-devrelease build).🤖 Generated with Claude Code