0.5.0
Added
- Diagnostics. Unknown classes, unknown members, and unknown functions are flagged with appropriate severity. An opt-in unresolved member access diagnostic is available via
.phpantom.toml. - Find References. Locate every usage of a symbol across the project. Supports classes, methods, properties, constants, functions, and variables. Variable references are scoped to the enclosing function or closure. Member references are scoped to the class hierarchy, so unrelated classes sharing a method name are excluded.
- Rename. Rename variables, classes, methods, properties, functions, and constants across the workspace. Variable renames are scoped to their enclosing function or closure.
- Deprecation support.
@deprecatedtags and#[Deprecated]attributes surface in hover, completion strikethrough, and diagnostics. A quick-fix code action rewrites deprecated calls when areplacementtemplate is available. - Document highlighting. Placing the cursor on a symbol highlights all occurrences in the current file. Variables are scoped to their enclosing function or closure with write vs. read distinction.
- Implement missing methods. Code action that generates method stubs when a class is missing required interface or abstract method implementations.
- Project configuration.
.phpantom.tomlfor per-project settings: PHP version override, diagnostic toggles, and indexing strategy. Runphpantom --initto generate a default config. - Reverse go-to-implementation. Go-to-implementation on a concrete method jumps to the interface or abstract class that declares the prototype, and vice versa.
- Go to Type Definition. Jump from a variable, property, method call, or function call to the class declaration of its resolved type. Union types produce multiple locations.
- Self-generated classmap. PHPantom works without
composer dump-autoload -o. Missing or incomplete classmaps are supplemented by scanning autoload directories. Non-Composer projects are supported by scanning all PHP files. - Monorepo support. Discovers subdirectories that are independent Composer projects and processes each through the full pipeline.
@implementsgeneric resolution.@implements Interface<ConcreteType>substitutes template parameters on the interface's methods and properties. Foreach iteration on generic iterable interfaces resolves value and key types.- Interface template inheritance. Implementing classes inherit
@templateparameters, bindings, conditional return types, and type assertions from their interfaces. - Function-level
@templatewith generic return types. Functions that use@templateparameters inside generic return types now resolve concrete types from call-site arguments. - Generic
@phpstan-assertwithclass-string<T>. Assertion methods that accept aclass-string<T>parameter resolve the narrowed type from the call-site argument. - Property-level narrowing.
if ($this->prop instanceof Foo)narrows$this->propin then/else bodies and after guard clauses. - Inline
&&short-circuit narrowing. The right-hand side of&&now sees the narrowed type from the left-hand side. - Compound negated guard clause narrowing.
if (!$x instanceof A && !$x instanceof B) { return; }narrows$xtoA|Bin the surviving code. - Closure variable scope isolation. Variables outside a closure are no longer offered as completions unless captured via
use(). - Pipe operator (PHP 8.5).
$input |> trim(...) |> createDate(...)resolves through the chain. - AST-based array type inference. Array shape keys, element access, spread elements, and push-style assignments all resolve through an AST walker.
new $classStringVarand$classStringVar::method(). Class-string variables resolve fornewand static member access.- Invoked closure and arrow function return types.
(fn(): Foo => ...)()and(function(): Bar { ... })()resolve to their return type. - Docblock navigation. Go-to-definition and hover work on class names inside callable types, array/object shape value types, and object shape properties.
- GTD from parameter and property variables. Clicking a parameter or property at its definition site jumps to the type hint class.
- PHP version-aware stubs. Detects the target PHP version from
composer.jsonand filters built-in stub signatures accordingly. @param-closure-this.$thisinside a closure resolves to the type declared by@param-closure-thison the receiving parameter.- Non-Composer function and constant discovery. Cross-file function completion, go-to-definition, and constant resolution for projects without
composer.json. - Indexing progress indicator. The editor shows a progress bar during workspace initialization, including per-subproject progress in monorepos.
- Pass-by-reference parameter type inference. After calling a function with a typed
&$varparameter, the variable acquires that type. iterator_to_array()element type. Resolves the element type from the iterator's generic annotation.- Enum case properties.
$case->nameand$case->valueresolve on enum case variables. - Inline
@varon promoted constructor properties. Overrides the native type hint, matching existing@paramsupport. --versionand--helpCLI flags. Contributed by @calebdw in #7.
Changed
- Resolution engine rewritten on AST. Variable type inference, call return types, and go-to-definition all run through the AST walker for better accuracy.
- Hover redesigned. Short names with
namespaceline, actual default values,@linkURLs, precise token highlighting, constructor signatures onnew,@templatedetails, enum case listing, trait member listing, origin indicators, and deprecated explanations. - Signature help enriched. Compact parameter list with native types, per-parameter
@paramdescriptions, default values, and attribute parenthesis support. - Faster resolution and lower memory usage.
- Parallel workspace indexing. File parsing, PSR-4 scanning, and vendor scanning run across all CPU cores.
.gitignorerules are respected. - Two-phase diagnostic publishing. Cheap diagnostics (unused imports, deprecation) publish immediately; expensive diagnostics (unknown classes/members/functions) arrive in a second pass.
- Merged classmap + self-scan pipeline. Composer classmaps and self-scanning work together instead of being mutually exclusive. Stale classmaps are supplemented automatically.
- Automatic stub fetching. The build script downloads phpstorm-stubs automatically when missing. Composer is no longer needed to build PHPantom. Contributed by @calebdw in #16.
- Feature comparison table corrected. Phactor capabilities updated in the README. Contributed by @dantleech in #10.
Fixed
- Cross-file inheritance from global-scope classes imported via
use. - Inherited
@methodand@propertytags across files. - Diagnostics refresh across open files when a class signature changes.
- Variable types resolve through ternary, elvis, null-coalesce, and match assignments.
instanceofnarrowing no longer widens specific types.- Elseif chain narrowing and sequential assert narrowing.
@phpstan-typealiases in foreach,list(), and key types.- False-positive unknown-class warnings on PHPStan type syntax.
- Go-to-implementation no longer produces false positives across namespaces.
__invoke()return type resolution. Works with chaining, foreach, and parenthesized invocations.- Enum
from()andtryFrom()chaining. static/self/$thisin method return types used as iterable expressions.- Mixed
->then::accessor chains. - Inline
(new Foo)->method()chaining. ?->null-safe chain resolution.- Array function resolution for
array_pop,array_filter,array_values,end,array_map. - Inline
@varannotations no longer leak across scopes. - Literal string conditional return types.
- Class constant and enum case assignment resolution.
- Go-to-definition on trait
asalias andinsteadofdeclarations. - Inline array-element function calls resolve correctly in diagnostics.
end($obj->items)->method()no longer produces a false diagnostic. - Double-negated
instanceofnarrowing. - Self-referential array key assignments no longer crash.
New Contributors
- @calebdw made their first contribution in #7
- @dantleech made their first contribution in #10
Full Changelog: 0.4.0...0.5.0