Add PHP 8.4 and 8.5 compatibility#11
Merged
Merged
Conversation
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
Adds PHP 8.4 and 8.5 compatibility to the module. Changes are fully backward compatible with PHP 8.2 and 8.3.
Changes
Plugin/ThemeAdminhtmlSwitcherPlugin.php: added explicit nullable types (?string $area = null) to comply with PHP 8.4 deprecation of implicit nullable parameters; added: arrayreturn type; promoted property visibility toprotected; extracted config path to a class constant.Model/Config/Source/AdminThemeList.php: promoted$themeListproperty visibility toprotected; extracted magic stringMagento/backendto a class constant; simplified title computation with a ternary; trimmed redundant PHPDoc descriptions.composer.json: added explicit PHP constraint~8.2.0||~8.3.0||~8.4.0||~8.5.0.CHANGELOG.md: new1.2.1entry dated 2026-04-21.PHP 8.4 rationale
PHP 8.4 deprecates implicit nullable parameter types — any parameter with a non-null type hint and a
nulldefault must be declared explicitly nullable (?Type). The upstreamMagento\Theme\Model\View\Design::setDesignTheme($theme, $area = null)is not typed, but$areain the plugin'sbeforeSetDesignThemeis a string-or-null, so an explicit?stringis the safe and future-proof signature.$themeIdis kept asmixedbecause the underlying method accepts both string theme paths andThemeInterfaceobjects.PHP 8.5
No code changes were required specifically for 8.5 — the same typed signatures are forward compatible.
Suggested release
I'd suggest tagging this as
1.2.1(patch — compatibility fix, no functional changes).Test plan
composer installon a Magento 2 / Mage-OS instance running PHP 8.4composer installon a Magento 2 / Mage-OS instance running PHP 8.5 (when available)Stores > Configuration > Advanced > Admin > Admin Designlists all installed admin themescc @rhoerr for review.