Add SimpleScope PHPStan-free type resolution proof of concept - #8463
Open
TomasVotruba wants to merge 3 commits into
Open
Add SimpleScope PHPStan-free type resolution proof of concept#8463TomasVotruba wants to merge 3 commits into
TomasVotruba wants to merge 3 commits into
Conversation
TomasVotruba
force-pushed
the
simple-scope-tier3-poc
branch
from
September 5, 2026 11:53
623a225 to
25cc6ae
Compare
Introduce a standalone, dependency-free type layer as a first step toward reducing PHPStan coupling: - SimpleTypeInterface + concrete scalar/array/object/null/mixed types - SimpleScope resolves an expression to a SimpleType - SimpleScopeResolver builds a scope from params and local assigns - DemoObjectMethodCallRenameRector shows a Tier-3 name-matcher rule doing its own type resolution with zero PHPStan usage Nothing existing is changed; the island proves the model before any real rule migration.
TomasVotruba
force-pushed
the
simple-scope-tier3-poc
branch
from
September 5, 2026 12:56
a6773d3 to
ede5d41
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.
Why
First concrete step toward reducing PHPStan coupling in the codebase. PHPStan is currently a runtime dependency used across ~545 source files (type system, scope, reflection, phpdoc parser). This PR does not remove any of that - it proves a model for a dependency-free type layer on an isolated island, so we can evaluate the approach before touching real rules.
What
A standalone, PHPStan-free type-resolution layer:
Rector\SimpleType\Contract\SimpleTypeInterface+ concreteStringType,IntegerType,BooleanType,NullType,ArrayType,ObjectType,MixedTypeRector\SimpleScope\SimpleScope- resolves an expression to aSimpleType(literals,new X, local variables)Rector\SimpleScope\SimpleScopeResolver- builds a scope from parameters and local assignments, in source orderDemoObjectMethodCallRenameRector- a Tier-3 name-matcher rule that does its own type resolution with zero PHPStan usage in its logicScope and limits
new, typed params, local vars). Cross-file inference (method return types, property types, flow-sensitive unions) still needs real reflection and is intentionally out of scope - those returnMixedType(safe no-op).Passes
composer complete-checkandcomposer rectorlocally.