Added
- Blade template support. Completion, hover, go-to-definition, diagnostics, semantic tokens, and inlay hints work inside
.blade.phpfiles. Contributed by @MingJen in #100. - Blade keyword highlighting. Blade directives, echo delimiters, PHP keywords, cast types, comments, and PHPDoc tags inside
.blade.phpfiles now receive semantic tokens for proper syntax coloring. - Blade view directive navigation. Go-to-definition works on view names inside Blade directives (
@include,@extends,@includeIf,@includeWhen,@includeUnless,@includeFirst,@component,@each), jumping to the referenced template file. - Replace FQCN with import. A refactoring code action on any fully-qualified class name (
\Foo\Bar) inserts ausestatement and replaces all occurrences of the same FQCN throughout the file with the short name. Detects existing imports and short-name conflicts. A separate "Replace all FQCNs with imports" action appears when the file contains multiple distinct FQCNs, replacing all of them at once (skipping those with import conflicts). - Broader type narrowing.
instanceof, type-guard functions,in_array()strict mode,assert(),@phpstan-assert-if-true/-if-false, and compound&&/||conditions now narrow types in if/else branches, guard clauses, while-loop bodies, ternary expressions, andmatch(true)arms. - Argument type mismatch diagnostics. Flags function and method calls where an argument's resolved type is incompatible with the declared parameter type.
- Invalid class-like kind diagnostics. Flags class-like names used in positions where their kind is guaranteed to fail at runtime:
newon abstract classes, interfaces, traits, or enums;extendson a final class, interface, or trait;implementswith a non-interface; traitusewith a non-trait;instanceofwith a trait;catchwith a non-Throwable type; and traits in type-hint positions. - Unused variable diagnostics. Variables assigned but never read are flagged with hint severity and rendered as dimmed text. Variables named
$_or prefixed with$_are exempt. - Mago diagnostic proxy. Mago lint and analyze diagnostics are surfaced as LSP diagnostics with quick-fix code actions. Configurable under
[mago]in.phpantom.toml. - Laravel Pint formatting. Projects with
laravel/pintinrequire-devautomatically use Pint for formatting via stdin. Configurable under[formatting]in.phpantom.tomlwithpint = "path"orpint = ""to disable. - PHPCS diagnostic proxy. PHP_CodeSniffer violations are surfaced as LSP diagnostics with severity mapping. Configurable under
[phpcs]in.phpantom.toml. - Return type inference from method bodies. Methods without a declared return type or
@returndocblock now have their return type inferred fromreturnstatements, improving completion, hover, and diagnostics for untyped code. - Closure and arrow function parameter inference. Untyped closure parameters are inferred from the enclosing call's callable signature, including through method chains that return
static. Generic type substitution flows through to inferred parameters. - Closure and arrow function inlay hints. When a closure or arrow function is passed to a callable-typed parameter, inlay hints show inferred parameter types and the return type derived from the enclosing callable signature.
- Generics.
@mixintags referencing a template parameter now resolve through the template bound.new $var()where$varisclass-string<T>resolves toT. SPL collection classes now carry@templateparameters so iteration methods resolve to concrete type arguments. - Namespace renaming. Renaming a namespace segment updates all declarations, use statements, and fully-qualified references across the workspace. When a PSR-4 autoload mapping exists, the corresponding directory is moved automatically.
- Linked editing ranges. Place the cursor on a variable and all occurrences within its scope enter linked editing mode, updating every occurrence as you type.
- Import all missing classes. A bulk code action that imports every unresolved class name in the file at once. Ambiguous names are left for manual resolution.
- Context-aware import candidate filtering. Import class actions now filter candidates by syntactic context (only interfaces after
implements, only traits afteruse, etc.). - Convert to instance variable. A code action that promotes a local variable inside a method to a class property, rewriting all references to
$this->prop(orself::$propin static methods). - Laravel view, route, and translation key navigation. Go to Definition works for Blade view names (
view('...')), route names (route('...')), and translation keys (__('...'),trans(...),Lang::get(...)). Contributed by @MingJen in #101. - Laravel config and env key navigation. Go to Definition and Find All References work for config keys and env variables (
config('app.name'),env('APP_KEY')). Contributed by @MingJen in #93. - Untyped property type inference from constructor. Properties without type declarations are resolved by inspecting the constructor body for assignments and promoted parameter defaults. Contributed by @lucasacoutinho in #81.
- Binary expression type inference. Hover and variable resolution now show result types for all binary operators (
int + int→int,int + float→float,int / int→int|float). Compound assignments update the variable's type accordingly. - Nested array shape inference from multi-level key assignments. Assignments like
$b['a']['b'] = 'x'now produce a nested array shape type (array{a: array{b: string}}), enabling array key completion for incrementally built arrays. - Loop type propagation. Variables assigned late in loop bodies are now visible from the start on subsequent iterations.
globalkeyword variable resolution. Variables imported withglobal $varnow resolve to their top-level type, enabling completion, hover, and go-to-definition.array_reduce,array_sum, andarray_productreturn type inference.array_reduce()resolves to the type of its initial value argument.array_sum()andarray_product()resolve toint|float.- Machine-readable CLI output. Both
analyzeandfixaccept a--formatflag withtable,github, andjsonoptions. WhenGITHUB_ACTIONSis set, table output automatically includes GitHub annotations. - Magic property diagnostics. New
report-magic-propertiesoption under[diagnostics]in.phpantom.toml. When enabled, classes with__getthat also have virtual properties (from@propertydocblock tags, Laravel Eloquent column inference, or other providers) will flag unknown property access instead of silently allowing it. - Inline diagnostic suppression.
// @phpantom-ignore codeon the same line or the line above suppresses the specified diagnostic. Multiple codes can be comma-separated. A bare// @phpantom-ignoresuppresses all diagnostics on the target line. - Find references and rename for PHPDoc virtual members.
@property,@property-read,@property-write, and@methoddeclarations in docblocks are now included in find-references and rename results alongside their runtime usages, including when the subject has a nullable or union type (e.g.Foo|nullfrom->first()). Contributed by @AbyssWaIker in #115.
Changed
- Find References performance and freshness. Project-wide Find References now avoids more unnecessary file work while still returning references through aliased class and function imports, and it refreshes newly added workspace PHP files on later searches. Contributed by @MingJen in #116.
- Incremental text sync. The server now uses incremental document sync, receiving only changed ranges from the editor instead of the full file content on every keystroke.
- LSP responsiveness. Hover, go-to-definition, signature help, code actions, rename, and other handlers now run on background threads. Slow requests no longer block other requests or cancellations.
- Faster analysis. Analysis time cut significantly on large projects.
- Reduced redundant file parsing. Concurrent threads resolving the same vendor class no longer parse the file in parallel; the second thread waits for the first to finish.
- Unified first-class callable resolution. First-class callable return type inference (
$fn = $obj->method(...)) now uses the shared call return type pipeline, improving accuracy for chained calls and generic substitutions. - Editing responsiveness. Classes evicted from the cache after a file edit are now eagerly re-populated in dependency order.
- Diagnostic delivery model. Editors that support pull diagnostics now get diagnostics on first file open without waiting for a debounce timer. Updates from external tools no longer re-run the entire native diagnostic pipeline.
- Virtual member resolution. Mixins and virtual accessors are now resolved completely on every class, eliminating cases where they were missing after edits.
- Diagnostic code identifiers. All diagnostic codes now use a consistent
snake_casenoun-phrase scheme:unknown_variable,type_mismatch_argument,argument_count_mismatch,deprecated_usage,missing_implementation. Users with editor filters matching on these codes will need to update them. - Lower memory usage for lazily-loaded files. Vendor and stub files no longer store per-file import tables and namespace maps after parsing, and go-to-implementation uses a dedicated reverse-inheritance index instead of scanning all parsed files.
- Lower memory usage for variable type tracking.
- Faster variable name completion. Variable name suggestions now use the precomputed symbol map instead of re-parsing the file. Foreach iteration variables correctly persist after the loop (matching PHP semantics),
@vardocblock variable names are included, andunset()removes variables from suggestions. - Faster go-to-definition for variables. Variable definition lookup no longer re-parses the file as a fallback; the precomputed symbol map handles all cases.
- Updated embedded phpstorm-stubs.
Fixed
throw newcompletion missing vendor classes. Classes whose Throwable ancestry could not be immediately verified (e.g. vendor classes not yet parsed) were silently excluded fromthrow newandcatchcompletion, even though later heuristic-based sections should have included them.- Stale mixin members after editing. Mixin class resolution (e.g.
@mixin Builder) is now invalidated when any file changes, so newly added or removed methods on mixin targets appear immediately without restarting the server. - Version-gated stub constants now filtered. Constants with
@removedtags (e.g.MCRYPT_ENCRYPT, removed in PHP 7.2) are now excluded from completion and resolution when the project targets a newer PHP version. Previously only classes and functions were filtered. - Go-to-definition. Fixed a potential deadlock when navigating to a vendor class that hadn't been parsed yet.
- LSP no longer freezes under heavy editor activity. Server-to-client requests (diagnostic refresh, progress token creation) could deadlock the service loop when the editor was simultaneously sending bursts of open/close/hover messages. All server-to-client requests are now either fire-and-forget or time-bounded, long-running handlers are cancellation-safe, and the process exits cleanly if the service loop ever terminates unexpectedly.
- Rename class preserves
self,static, andparentkeywords. Renaming a class no longer replaces occurrences ofself::,static::, orparent::with the new class name. - Rename propagates into closures and arrow functions. Renaming a variable now follows explicit
use ($var)captures into closure bodies and implicit captures into arrow function bodies, instead of leaving those occurrences unchanged. - Spurious function auto-imports. Import statements like
use function is_array;were misidentified as function declarations, polluting the completion list with phantom entries that inserted incorrect imports. - Duplicate
use functioninsertion. Accepting a function completion no longer inserts ause functionstatement when the exact import already exists in the file. - Function import conflict handling. When a different function with the same short name is already imported, completing a namespaced function now inserts the fully-qualified name instead of the ambiguous short name.
- False-positive unused variable diagnostics. Variables passed to
compact(), by-reference out-parameters (e.g.preg_match($p, $s, $matches)), and variables used only viaglobalare no longer incorrectly flagged. - False-positive type mismatch diagnostics. Bare
arrayreturn values passed to typed array parameters, properties narrowed viainstanceof, type alias parameters, and use-map shadowing no longer trigger incorrect type errors. - Functions inside
if (!function_exists(...))guards. Function bodies nested inside conditional blocks no longer produce false-positive unresolved-member-access errors. - Standalone
@varcompletion. Variables typed only via a standalone/** @var Type $var */docblock now resolve for member completion and go-to-definition. @vardocblocks with additional tags. Extra tags like@psalm-suppressin the same docblock no longer corrupt the type string.- Foreach
@varannotations for key and value variables. Multi-line docblocks with multiple@vartags before aforeachnow correctly override both key and value types. - Foreach element type from untyped arrays. Variables in a
foreachover barearraynow resolve tomixedinstead of empty. - Foreach narrowing with break in else. The variable state from break paths is now included in the post-loop type.
- Foreach target type after non-empty literal array. The pre-loop sentinel value no longer survives as a possible post-loop type.
- Foreach over
::classliteral arrays resolves static access.$className::CONSTand$className::method()no longer produce unresolved-member diagnostics. - Hover on reassigned variable shows post-assignment type. Hovering on the left-hand side of a reassignment now shows the type produced by the assignment.
- Multi-namespace class resolution. Short class names now resolve against the correct namespace for the current scope.
- Multi-namespace variable isolation. Variable resolution now only considers the namespace block containing the cursor.
- Multi-namespace function return type resolution. Function return types are now resolved against the function's own namespace.
- Multi-namespace static call class resolution.
ClassName::method()now resolves against the correct namespace block. - Short class name resolution in type hints. The resolver now prefers the class in the same namespace as the owning type before falling back to first-match.
- Class loader global fallback. Unqualified class names in namespaced code now fall back to global scope lookup when the namespace-qualified name doesn't exist.
- Template inference through stub interfaces.
@template-implementson stub-loaded interfaces now correctly propagates substituted return types to child methods. - Generic method return types from
@varannotations. Method calls on variables annotated with a generic type now correctly substitute class-level template parameters into the return type. - Template union inference from multiple arguments. When multiple arguments bind to the same
@template T, the resolved type is now the union of all inferred types instead of only the first. - Template param inference from type bounds. Nested template params are now inferred from concrete generic arguments when a template parameter has a generic bound.
- Method-level
@templatewithkey-ofbound. Passing a string literal to a method with@template K as key-of<TData>now resolves the return type to the specific array shape value type. __getmagic method template resolution. Property access on a class whose__getuseskey-of<T>bounds now infers the concrete type from the property name.- Magic
__getproperty access. Accessing undefined properties on objects with a__getmethod now resolves to the method's declared return type. - Magic
__callmethod return type. Calling undefined methods on objects with a__callmethod now resolves to__call's declared return type. - SoapClient arbitrary methods. Calling any method on
SoapClientno longer produces false-positive "unknown member" diagnostics. - Literal
true/falsepreserved in template inference. Passingtrueorfalseto a generic constructor now keeps the precise type instead of widening tobool. @psalm-methodoverrides@method. The vendor-prefixed tag now takes priority when both are present.@psalm-param/@phpstan-parampriority over@param.@phpstan-paramtakes precedence over@psalm-param, which takes precedence over@param, matching PHPStan and Psalm behaviour.@psalm-if-this-istemplate inference. Method-level template parameters are now inferred by matching the receiver's concrete type against the annotation's type pattern.self::classandstatic::classin template arguments. Passing these to aclass-string<T>parameter now correctly resolves T to the enclosing class.staticreturn type through first-class callables.self::method(...)()and similar patterns now preservestaticin the return type.- Interface method return type inheritance. Template-substituted return types from interfaces are now propagated to overriding methods without a return type.
- Property
self/statictype resolution. Properties with@var self|nullorstaticnow resolve to the owning class name in hover. - Trait
selfreturn type resolution through inheritance. Trait methods with return typeselfnow resolve to the declaring class, not the calling subclass. - Conditional return type resolution for scalar arguments.
$param is stringconditions in@returnannotations now resolve correctly for literal values. - SPL iterator generic type propagation. Decorator iterators like
CachingIteratorandLimitIteratornow propagate the wrapped iterator's generic type parameters. ArrayIteratorconstructor generic inference.new ArrayIterator($typedArray)now infers key and value types from the array argument.range()return type inference.range()now returnslist<string>for string arguments andlist<int|float>otherwise, instead of barearray.(object)cast type inference. Casting now resolves to an object shape matching the operand's structure instead of barestdClass.- ArrayAccess array-access assignment.
$obj[$key] = $valonArrayAccessobjects no longer overwrites the variable's generic type with an array type. - Static method calls on class-string unions.
$variable::method()where$variableholds a union of class-strings now resolves through all possible classes. - Array shape keys with special characters. Keys containing backslashes or newlines are now properly quoted and escaped in type display.
- Implement methods: no invalid generic return type hints. The "Implement missing methods" code action no longer emits generic docblock syntax as a native PHP return type hint.
- Composer
filesautoload packages now indexed. Vendor packages using"autoload": {"files": [...]}now have their classes discovered correctly. - Classmap collision resolution. When two files declare the same class name, the file matching PSR-4 naming convention is now preferred.
- Eloquent
$datesandwhere{Property}go-to-definition. Go-to-definition now works for properties backed by the$datesarray and dynamicwhere{Property}()methods. - Type hierarchy registration. Dynamic registration is now gated on client capability, preventing errors in unsupported editors.
- False-positive diagnostics on startup. Files opened while the project was still indexing could produce spurious "class not found" errors. Diagnostics are now deferred until initialization completes.
- Analyzer and LSP no longer hang on files with deeply nested loops.
- Infinite loop on array key reassignment patterns. Files containing
$arr['key'] = f($arr['key'])no longer hang the analyzer. - Chained calls with complex arguments resolve the correct return type. Calling
redirect($string . $var)->with(...)now resolves toRedirectResponseas expected. Complex argument expressions (concatenation, method calls, etc.) were previously serialized as empty, causing conditional return types to take the wrong branch. - Stack overflow on large codebases and large files. The
analyzecommand no longer crashes with stack overflows on large files. - Non-deterministic diagnostic counts eliminated. Projects with heavy use of generics no longer see false positives that vary between runs.
- Pull-diagnostic reliability. Editors that support pull diagnostics no longer show duplicate or stale diagnostics.
- Hover scales linearly on large files. Hover requests no longer take O(n²) time on files with many method calls.
analyzeandfixcommands run at consistent speed regardless of invocation style.- Type narrowing. Comprehensive fixes:
is_*()guards correctly narrow multi-member unions;instanceofonmixedorobjectnarrows to the checked type;=== nulland== nullnarrow correctly;assert()narrowing persists through subsequent branches;isset()/empty()stripnullfrom nullable types; property access expressions are narrowed through conditionals; array shape keys are narrowed through guard clauses; OR'dinstanceofchecks resolve to the union of all branches; post-loop narrowing applies the loop condition's inverse; branch merging preserves nullable information correctly. - Generics. Constructor generic inference works through inherited constructors with correct remapping through multi-level
@extendschains. Function-level templates are inferred from arguments extending wrapper classes. Class-level template parameters are preserved through chained method calls. Template parameters fall back to their declared bound when subclasses omit annotations. Method calls on unions of generic types resolve to the union of each branch's return type.key-of<T>,value-of<T>, and indexed access types evaluate to concrete types after template substitution. Array literal arguments infer key and value types separately. - Mixin resolution. Static method calls on instances with
@mixinnow resolve through the mixin.@methodand@propertytags on mixin classes are propagated to the consumer.$thisreturn types on mixin methods resolve to the consumer class. @methodtag resolution. Colon return type syntax, parenthesised return types, and the ambiguous single-staticpattern are now parsed correctly. Template parameters in@methodreturn types are substituted through@extendsand@implementsannotations.- First-class callable invocation return types. Immediately invoking a first-class callable (
Foo::method(...)()) now resolves to the underlying function's return type. - Chained instantiation preserves constructor-inferred generics. Expressions like
(new Box(new Product()))->get()now propagate template arguments to subsequent method calls. @return numericpseudo-type. Functions annotated with@return numericnow resolve correctly instead of falling back tostring.parent::__construct()with@extendsgenerics. No longer produces false-positive type errors for substituted parameter types.- Array access on bare
arrayandmixedtypes. Accessing a key on plainarraynow resolves tomixedinstead of an empty type. - Vendor functions and constants. Functions and constants defined in vendor packages are now indexed at startup, eliminating false-positive diagnostics.
- Use-imported classes no longer shadowed by global-namespace stubs. Fixes Laravel Facade static method resolution.
- Same-name class in a different namespace no longer shadows inherited members.
- Short-name collisions eliminated project-wide. Two unrelated classes sharing a short name are no longer treated as identical.
- Transitive interface inheritance. A class implementing an interface that extends another interface is now correctly recognized as a subtype of the parent interface.
- Conditional return types. Methods with conditional return types now check whether the argument class implements the bound interface, and class names in conditional annotations are resolved through the defining file's use statements.
- Promoted properties. Inline
/** @var */annotations on promoted constructor properties now resolve inside the constructor body. - Backed enums. Accessing
->valueresolves to the specific backing type.@implementsgenerics on enums are resolved correctly. - Class constants. Inherited constants accessed via
self::CONSTorChildClass::CONSTresolve through multi-level inheritance. - Hover / type display.
T[]displays asarray<T>,mixed[]asarray. PHPDoc type aliases are normalized. Methods returningparentresolve to the actual parent class name. - Chain assignments.
$a = $b = new Foo()resolves all variables in the chain. - Destructuring. Array destructuring (
[$a, $b] = $expr,list(), keyed shapes, nested patterns) and foreach destructuring now resolve types correctly. - Variable type resolution. Short class names from
@var,@param, andnew ClassName()are resolved to FQN before entering the type pipeline. - Closure inlay hints. Template parameters in callable signatures are substituted with concrete types inferred from sibling arguments.
- Laravel scopes. Public methods with the
#[Scope]attribute are no longer treated as scopes. - Static methods.
$thisno longer resolves inside static methods. - Hover cache invalidation. Editing a cross-file class's docblock now immediately reflects updated content on hover.
- Foreach type resolution. Nested generic array access, static property iterables, type alias expansion, and by-reference bindings all resolve element types correctly. Loop prescan no longer leaks types into the same-statement RHS.
- Completion in loops and branches. Array shape keys added inside
ifblocks, variables assigned later in loop bodies, and variables on the RHS of reassignments all resolve correctly. - Scope leakage after closures in chained method calls. Variables from the enclosing method are no longer invisible after a closure argument.
- Docblock
@paramannotations no longer leak across sibling methods or closures. class-string<T>parameter completion. Parameters typed asclass-string<T>resolve to the bound class for member access.- Inherited parameter types propagate to child methods.
- False positive type error for closures passed to callable parameters.
\Closureis now recognised as a subtype ofcallable. - Union-typed method calls no longer lose resolution on second occurrence.
- Fluent method chains in namespaced classes. Methods returning
staticorselfresolve correctly across namespaces. - False-positive undefined variable diagnostics. By-reference parameters, nested array access assignments, and
$this-prefixed variable names no longer produce false positives. - Auto-import formatting. Missing blank line before first import and bulk "remove unused imports" in braced namespaces are fixed.
- Exception types in
catchclauses matched correctly across namespaces. - Nested
match(true)expressions no longer produce incorrect diagnostics. - Lowercase built-in class names recognized as subtypes of
object. - False "class not found" for global-namespace classes loaded via Composer's
filesautoloading. - False-positive type errors on generic class methods. Template parameters are now substituted into method parameter types before checking argument compatibility.
New Contributors
- @HeySora made their first contribution in #80
- @MingJen made their first contribution in #93
- @adalessa made their first contribution in #97
- @AbyssWaIker made their first contribution in #115
Full Changelog: 0.7.0...0.8.0