Skip to content

Commit b191bdc

Browse files
committed
Update readme
1 parent dc2365a commit b191bdc

1 file changed

Lines changed: 19 additions & 37 deletions

File tree

README.md

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHPantomLSP
22

3-
A fast, lightweight PHP language server that stays out of your way. Using only a few MB of RAM regardless of project size, fully usable in milliseconds, without requiring high-end hardware.
3+
A fast, lightweight PHP language server that stays out of your way. Using only a few MB of RAM regardless of project size and fully usable in milliseconds without requiring high-end hardware.
44

55
> **Note:** This project is in active development.
66
@@ -10,20 +10,22 @@ A fast, lightweight PHP language server that stays out of your way. Using only a
1010

1111
- Full text document sync (open, change, close)
1212

13-
### Type Resolution
13+
### PHP Analysis & Type Resolution
1414

15-
Both completion and go-to-definition draw from a shared type resolution engine:
15+
PHPantom uses a shared analysis engine built on [Mago](https://github.com/carthage-software/mago)'s PHP parser for parsing and type resolution, powering both completion and go-to-definition.
1616

17-
- `$this`, `self`, `static`, and `parent` keyword resolution
18-
- Variable type inference from assignments (`$var = new Foo()`) and parameter type hints
19-
- Property chain and method call chaining (e.g. `$this->getService()->doSomething()`)
20-
- Function and static method call return type resolution (e.g. `app()->`, `Class::make()->`)
21-
- Inheritance-aware: walks the class hierarchy including traits
22-
- Enum case resolution
23-
- Union types: `A|B` in return types, property types, and parameter hints are split into individual candidates
24-
- Ambiguous variables: when a variable is assigned different types in conditional branches, all possible types are tried
25-
- PHPDoc support: `@return`, `@property`, `@method`, `@mixin`
26-
- PHPStan conditional return types: annotations like `@return ($abstract is class-string<TClass> ? TClass : mixed)` are resolved based on call-site arguments
17+
- Extracts classes, interfaces, traits, enums, and standalone functions
18+
- Parses methods, properties, constants, and constructor-promoted properties with visibility, static modifiers, and type hints
19+
- Parses `use` statements and namespace declarations
20+
- PHPDoc annotations including:
21+
- `@return`, `@var`, `@property`, `@method`, `@mixin`
22+
- PHPStan-style conditional return types
23+
- Resolves `$this`, `self`, `static`, and `parent` keywords
24+
- Infers variable types from assignments and parameter type hints
25+
- Supports property chains and method call chaining (e.g., `$this->getService()->doSomething()`)
26+
- Resolves function and static method return types (e.g., `app()->`, `Class::make()->`)
27+
- Inheritance-aware resolution including traits cases
28+
- Handles union types (`A|B`) and ambiguous variables across conditional branches
2729

2830
### Completion
2931

@@ -42,31 +44,11 @@ Both completion and go-to-definition draw from a shared type resolution engine:
4244
- Same-file and cross-file definition lookup
4345
- Fully-qualified, partially-qualified, and unqualified name resolution via `use` statements and the current namespace
4446

45-
### PHP Parsing
46-
47-
- Extracts classes, interfaces, traits, and enums
48-
- Parses methods, properties, and constants with visibility, static modifiers, and type hints
49-
- Extracts standalone function definitions (global and namespaced)
50-
- Supports constructor-promoted properties
51-
- Parses `use` statements and namespace declarations
52-
53-
#### PHPDoc Parsing
54-
55-
Built on [Mago](https://github.com/carthage-software/mago)'s PHP parser.
56-
57-
- `@return` type extraction with compatibility checks against native type hints
58-
- `@var` type annotations
59-
- `@property` virtual property declarations
60-
- `@method` virtual method declarations
61-
- `@mixin` class delegation tags
62-
- PHPStan style conditional return type expressions (recursive/nested conditionals)
63-
64-
### Composer / PSR-4 Integration
47+
### Composer Integration
6548

66-
- Parses `composer.json` for PSR-4 autoload mappings (`autoload` and `autoload-dev`)
67-
- Parses vendor autoload mappings from `vendor/composer/autoload_psr4.php`
68-
- On-demand class loading from disk via PSR-4 resolution
69-
- Caches parsed files to avoid redundant parsing
49+
- Parses `composer.json` for PSR-4 class mapping
50+
- Parses vendor autoload file and PSR-4 loading
51+
- Caches parsed files in memory to avoid redundant loading
7052

7153
## Building
7254

0 commit comments

Comments
 (0)