From dffe77ad613fbb5b17ce04607a1f7ff006d40a6b Mon Sep 17 00:00:00 2001 From: John Michael Manlupig Date: Wed, 2 Dec 2026 23:35:00 +0800 Subject: [PATCH 1/3] fix(lang-php): scope Composer PSR-4 to the importing application Bind PSR-4 rules to the closest Composer manifest and reachable local path dependencies. Closes #762 --- .../cli/tests/integration/invalid_manifest.rs | 20 ++ crates/cli/tests/integration/trace.rs | 123 ++++++++++++ docs/guide/languages.md | 1 + docs/reference.md | 2 + docs/verification/features/trace.md | 9 + plugins/languages/php/HOW-TO.md | 6 +- plugins/languages/php/src/resolution.rs | 151 +++++---------- .../languages/php/src/resolution/composer.rs | 175 ++++++++++++++++++ plugins/languages/php/src/workspaces.rs | 57 ++++-- 9 files changed, 424 insertions(+), 120 deletions(-) create mode 100644 plugins/languages/php/src/resolution/composer.rs diff --git a/crates/cli/tests/integration/invalid_manifest.rs b/crates/cli/tests/integration/invalid_manifest.rs index 20c3bb54..35acaca4 100644 --- a/crates/cli/tests/integration/invalid_manifest.rs +++ b/crates/cli/tests/integration/invalid_manifest.rs @@ -83,6 +83,26 @@ fn warnings_under(report: &Value, key: &str) -> Vec { .unwrap_or_default() } +#[test] +fn check_reports_invalid_nested_composer_path_repository() { + let repo = init_git_repo(&[ + ( + "app/composer.json", + r#"{"repositories":[{"type":"path","url":"../packages/["}]}"#, + ), + ("app/main.php", " b/src/Service.php", + "No runtime import path from b/main.php to a/src/Service.php", + ], + ); +} + +const COMPOSER_SERVICE_MANIFEST: &str = r#"{"name":"demo/lib","require":{"demo/shared":"*"},"autoload":{"psr-4":{"Demo\\Lib\\":"src/"}},"autoload-dev":{"psr-4":{"Demo\\Tests\\":"tests/"}}}"#; +const PHP_SERVICE: &str = r" Generated; POSIX `sh`, Bash, or Zsh from the shebang or extension; 10 Hazard line rules; see [Shell](./shell.md) | Core rules also classify files under `vendor/` or `third_party/` as `vendored` and files with generated-file header comments (`@generated`, `GENERATED CODE`, `DO NOT EDIT`) as `generated`. +See [`codeint trace`](../reference.md#codeint-trace) for how codeint resolves PHP PSR-4 imports across Composer packages. See [Go](./go.md) for Go terminology mapping, multi-file Go package imports, entry points, Flagged line rules, and `go.mod` Dependency hygiene. See [SQL](./sql.md) for generic SQL measurement, Dialects, templated SQL and rejected statements, automatic SQL schemas, and [Hazards](./hazards.md) for the Hazards Metric. See [Shell](./shell.md) for shell flavor detection, top-level `