Skip to content

Commit 713f4b9

Browse files
committed
chore: remove dependency on composer install
1 parent e116d86 commit 713f4b9

5 files changed

Lines changed: 9 additions & 88 deletions

File tree

build.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//!
1414
//! If the stubs directory doesn't exist, the build script will automatically
1515
//! fetch the latest release of phpstorm-stubs from GitHub. This allows
16-
//! `cargo install` to work without requiring `composer install` first.
16+
//! `cargo install` to work without any additional setup.
1717
//!
1818
//! ## Re-run strategy
1919
//!
@@ -24,7 +24,7 @@
2424
//!
2525
//! Instead we watch the project root directory (`.`). Its mtime changes
2626
//! whenever a direct child like `stubs/` is created or removed. We also
27-
//! watch `build.rs` and `composer.lock` for targeted rebuilds.
27+
//! watch `build.rs` for targeted rebuilds.
2828
//!
2929
//! To avoid unnecessary recompilation of the main crate we compare the
3030
//! newly generated content against the existing output file and only write
@@ -66,7 +66,6 @@ fn main() {
6666
// reliably trigger when they first appear.
6767
println!("cargo:rerun-if-changed=.");
6868
println!("cargo:rerun-if-changed=build.rs");
69-
println!("cargo:rerun-if-changed=composer.lock");
7069

7170
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
7271
let stubs_path = Path::new(&manifest_dir).join(STUBS_DIR);
@@ -76,9 +75,7 @@ fn main() {
7675
eprintln!("cargo:warning=Stubs not found, fetching from GitHub...");
7776
if let Err(e) = fetch_stubs(&manifest_dir) {
7877
eprintln!("cargo:warning=Failed to fetch stubs from GitHub: {}", e);
79-
eprintln!(
80-
"cargo:warning=Building without stubs. Run `composer install` for full stub support."
81-
);
78+
eprintln!("cargo:warning=Building without stubs (network may be unavailable).");
8279
write_empty_stubs();
8380
return;
8481
}

composer.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

composer.lock

Lines changed: 0 additions & 63 deletions
This file was deleted.

docs/BUILDING.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,18 @@
33
## Quick Start
44

55
```bash
6-
composer install # fetch PHP stubs (requires Composer)
76
cargo build --release # build the binary
87
```
98

109
## Prerequisites
1110

1211
- [Rust](https://rustup.rs/) (stable toolchain)
13-
- [Composer](https://getcomposer.org/) (for PHP standard library stubs)
1412

1513
## Build
1614

17-
The PHP stubs are managed as a Composer dependency in `stubs/`. The `build.rs` script embeds the [JetBrains phpstorm-stubs](https://github.com/JetBrains/phpstorm-stubs) directly into the binary, giving the LSP full knowledge of built-in PHP classes, functions, and constants with no runtime dependencies.
15+
The `build.rs` script automatically fetches the latest [JetBrains phpstorm-stubs](https://github.com/JetBrains/phpstorm-stubs) from GitHub and embeds them directly into the binary. This gives the LSP full knowledge of built-in PHP classes, functions, and constants with no runtime dependencies.
1816

19-
> [!NOTE]
20-
> The build will succeed without `composer install`, but the resulting binary won't know about built-in PHP symbols like `Iterator`, `Countable`, `UnitEnum`, etc. Always run `composer install` first for a fully functional build.
21-
22-
After updating stubs (`composer update`), just rebuild. `build.rs` watches `composer.lock` and re-embeds everything automatically.
17+
The stubs are downloaded on first build and cached in `stubs/`. To update to the latest stubs, delete the `stubs/` directory and rebuild.
2318

2419
For details on how symbol resolution and stub loading work, see [ARCHITECTURE.md](ARCHITECTURE.md).
2520

@@ -65,4 +60,4 @@ RUST_LOG=debug cargo run 2>phpantom.log
6560

6661
Logs are written to stderr, so redirect as needed.
6762

68-
For editor setup instructions, see [SETUP.md](SETUP.md).
63+
For editor setup instructions, see [SETUP.md](SETUP.md).

src/stubs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
///
2929
/// ## Updating stubs
3030
///
31-
/// Run `composer update jetbrains/phpstorm-stubs` in the project root
32-
/// (with `stubs/` as the vendor directory) and rebuild. The `build.rs`
33-
/// script re-reads the map file and re-embeds everything automatically.
31+
/// Delete the `stubs/` directory and rebuild. The `build.rs` script will
32+
/// automatically fetch the latest release from GitHub, re-read the map
33+
/// file and re-embed everything.
3434
use std::collections::HashMap;
3535

3636
// Pull in the generated static arrays.

0 commit comments

Comments
 (0)