You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -346,14 +346,15 @@ PHPantom bundles the [JetBrains phpstorm-stubs](https://github.com/JetBrains/php
346
346
347
347
The `build.rs` script:
348
348
349
-
1. Reads `stubs/jetbrains/phpstorm-stubs/PhpStormStubsMap.php` — a generated index mapping symbol names to file paths.
350
-
2. Emits `stub_map_generated.rs` containing:
349
+
1. If `stubs/jetbrains/phpstorm-stubs/` does not exist, fetches the latest release tarball from the JetBrains/phpstorm-stubs GitHub repository and extracts it. This makes `cargo install` and `cargo build` work without any prior setup.
350
+
2. Reads `stubs/jetbrains/phpstorm-stubs/PhpStormStubsMap.php` — a generated index mapping symbol names to file paths.
351
+
3. Emits `stub_map_generated.rs` containing:
351
352
-`STUB_FILES`: an array of `include_str!(...)` calls embedding every referenced PHP file (~502 files, ~8.5MB of source).
352
353
-`STUB_CLASS_MAP`: maps class/interface/trait names → index into `STUB_FILES`.
353
354
-`STUB_FUNCTION_MAP`: maps function names → index into `STUB_FILES`.
354
355
-`STUB_CONSTANT_MAP`: maps constant names → index into `STUB_FILES`.
355
356
356
-
The build script watches `composer.lock` for changes, so running `composer update` followed by `cargo build` automatically picks up new stub versions.
357
+
The stubs are cached in the `stubs/` directory (gitignored). To update to the latest version, delete `stubs/` and rebuild.
357
358
358
359
### Runtime Lookup — Classes
359
360
@@ -464,7 +465,7 @@ User code is never filtered. The `php_version` field in `DocblockCtx` is `None`
464
465
465
466
### Graceful Degradation
466
467
467
-
If the stubs aren't installed (e.g. `composer install` hasn't been run), `build.rs` generates empty arrays and the build succeeds. The LSP just won't know about built-in PHP symbols.
468
+
If the stubs can't be fetched (e.g. no network access during the build), `build.rs` generates empty arrays and the build succeeds. The LSP just won't know about built-in PHP symbols.
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
53
53
-**Concurrent read access to shared state.** All read-heavy maps now use `parking_lot::RwLock` instead of `std::sync::Mutex`, allowing multiple requests to read in parallel.
54
54
-**Parallel workspace indexing.** Find References and other workspace-wide operations now parse files across multiple CPU cores. The workspace walk respects `.gitignore` rules instead of hardcoding directory names to skip. Self-scan classmap building, PSR-4 directory scanning, and vendor package scanning now read and scan files in parallel across all CPU cores. The byte-level PHP scanner uses `memchr` SIMD acceleration to skip comments, strings, and heredocs instead of scanning byte-by-byte. Redundant `composer.json` reads during initialization have been eliminated.
55
55
-**Merged classmap + self-scan pipeline.** The Composer classmap and the self-scanner are no longer mutually exclusive. PHPantom always loads the Composer classmap (when present) and then self-scans all PSR-4 and vendor directories, skipping files the classmap already covers. Stale or incomplete classmaps are no longer a problem: whatever Composer already knew about is a free performance win, and whatever it missed is discovered automatically. The fragile completeness heuristic that decided whether to trust the classmap has been removed. Monorepo subprojects use the same merged pipeline.
56
+
-**Automatic stub fetching.** The build script now downloads phpstorm-stubs from GitHub automatically when the `stubs/` directory is missing. `cargo install` and `cargo build` work without any prior setup. Composer is no longer required to build PHPantom.
0 commit comments