Modernize legacy code for PHP 8.1 and repo conventions - #1028
Draft
mglaman wants to merge 1 commit into
Draft
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
- 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
August 5, 2026 19:33
3bdc910 to
1035692
Compare
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 (on top of #1027). 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.Testing
Full suite, self-analysis, and phpcs (with the raised php_version) are green.
🤖 Generated with Claude Code