Repository navigation
Implement PsrAutoloading in blink - #200
Merged
Merged
Conversation
TomasVotruba
enabled auto-merge (squash)
October 10, 2026 16:09
TomasVotruba
force-pushed
the
blink-psr-autoloading
branch
from
October 10, 2026 16:13
55d0bac to
440c4d6
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.
Ports PHP-CS-Fixer's
PsrAutoloadingFixerto blink, the only ECS rule previously unported. It was blocked because blink fixers receive just a token stream, while this rule needs the file path to derive the expected class name.Threading the path
tokens.Streamgains apathfield withSetPath/Path.fixFile, so theFixerinterface stays unchanged and no other rule is affected.The fixer
PsrAutoloadingrenames the single class/interface/trait/enum in a file so its name matches the file basename, and with thediroption corrects namespace casing to the path. It mirrors the upstream logic: skips non-php files, invalid-identifier basenames and stub/fixture paths, bails on more than one namespace or named classy declaration, and ignores anonymous classes and::classconstants.Set membership
It is opt-in only, matching ECS: not part of psr12/common/default, and explicitly excluded from the per-cs set (which otherwise runs every fixer), so parity corpora are unaffected. It resolves by name for
--ecs-config.Tests and counts
::classand anonymous-class cases, and thedirnamespace-casing branch.bin/rule-counts.shnow reports 0 missing rules (blink 210).ecs-rules.txtupdated; its stale "NOT YET IMPLEMENTED" list (every entry was already implemented) is cleared.