Modernize legacy code for PHP 8.1 and repo conventions - #1028
Merged
Conversation
mglaman
force-pushed
the
audit/3-modernization
branch
from
August 5, 2026 16:20
fe2c0b6 to
868eafb
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
from
August 5, 2026 16:44
868eafb to
828bd42
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
from
August 5, 2026 17:15
828bd42 to
13ff201
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
from
August 5, 2026 19:13
13ff201 to
3bdc910
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
from
August 5, 2026 19:33
3bdc910 to
1035692
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
2 times, most recently
from
September 8, 2026 18:14
f746a98 to
6a8b779
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
2 times, most recently
from
September 8, 2026 18:27
c6250b0 to
41a184f
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
from
September 8, 2026 18:59
41a184f to
31c1261
Compare
mglaman
force-pushed
the
audit/3-modernization
branch
2 times, most recently
from
September 8, 2026 19:47
66b9bad to
447d228
Compare
- declare(strict_types=1) in the remaining src/ files (Reflection classes, RecursiveExtensionFilterIterator, DeprecatedHookImplementation). - Mark the four bundled Drupal-core forks in src/Drupal/ as @internal. - final on the six audited concrete rules, matching newer rules. - Promoted readonly constructors and typed properties in the audited rules, reflections, Extension, DrupalServiceDefinition, and DrupalAutoloader; drop the dead splFileInfo property. - Class constants for the per-node rebuilt arrays in DiscouragedFunctionsRule and GlobalDrupalDependencyInjectionRule. - ::class instead of string FQCNs where the class is imported. - str_contains/str_starts_with/str_ends_with over strpos/substr. - Replace the RecursiveFilterIterator __call shim (@method isDir) with an explicit $this->current()->isDir() call. - Validate Yaml::parse() output in Extension::parseInfo(). - phpcs.xml: raise php_version from 7.4 to 8.1 so PHPCS checks against the actual composer platform requirement. - Drop the self-namespace use in ExtensionDiscovery and fix the dcorating_service_id typo in ServiceMap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mglaman
force-pushed
the
audit/3-modernization
branch
from
September 9, 2026 01:07
447d228 to
73c6aaf
Compare
mglaman
marked this pull request as ready for review
September 9, 2026 14:17
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.
Part 7 of 9 in the legacy-code audit stack. Mechanical modernization with no behavior change.
What changed
declare(strict_types=1)in the remainingsrc/files (the Reflection classes,RecursiveExtensionFilterIterator,DeprecatedHookImplementation).src/Drupal/are marked@internal— they are bootstrap implementation details, not extension points.final, matching the newer rules.readonlyconstructors and typed properties across the audited classes; the deadsplFileInfoproperty is gone.DiscouragedFunctionsRuleandGlobalDrupalDependencyInjectionRuleare class constants now.::classover string FQCNs,str_contains/str_starts_with/str_ends_withoverstrpos/substr, and the@method isDir()docblock shim replaced with an explicit$this->current()->isDir().Extension::parseInfo()validates thatYaml::parse()returned an array.phpcs.xmlraisesphp_versionfrom 7.4 to 8.1 to matchcomposer.json, so PHPCS actually checks against the supported platform.Upgrade note
Six rule classes are now
final:DiscouragedFunctionsRule,GlobalDrupalDependencyInjectionRule,LoadIncludes,ModuleLoadInclude,PluginManagerInspectionRule, andPluginManagerSetsCacheBackendRule. The rules never carried an API promise, but a project that subclassed one of them will need to copy the rule instead.Testing
Full suite, self-analysis, and phpcs (with the raised php_version) are green.
🤖 Generated with Claude Code