Attempt to resolve the PHPCS binary from configuration and the workspace environment. Resolution rules: - Config value `Some("")` (empty string) → disabled (`None`). - Config value `Some(cmd)` → use `cmd` as-is (user override). - Config value `None` → auto-detect: try ` /phpcs` under the workspace root, then search `$PATH`.
(
workspace_root: Option<&Path>,
config: &PhpcsConfig,
bin_dir: Option<&str>,
)
| 69 | /// - Config value `None` → auto-detect: try `<bin_dir>/phpcs` under |
| 70 | /// the workspace root, then search `$PATH`. |
| 71 | pub(crate) fn resolve_phpcs( |
| 72 | workspace_root: Option<&Path>, |
| 73 | config: &PhpcsConfig, |
| 74 | bin_dir: Option<&str>, |
| 75 | ) -> Option<ResolvedPhpcs> { |
| 76 | match config.command.as_deref() { |
| 77 | // Explicitly disabled. |
| 78 | Some("") => None, |
| 79 | // User-provided command. |
| 80 | Some(cmd) => Some(ResolvedPhpcs { |
| 81 | path: PathBuf::from(cmd), |
| 82 | }), |
| 83 | // Auto-detect. |
| 84 | None => auto_detect(workspace_root, bin_dir), |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /// Auto-detect PHPCS by checking `<bin_dir>/phpcs` then `$PATH`. |
| 89 | fn auto_detect(workspace_root: Option<&Path>, bin_dir: Option<&str>) -> Option<ResolvedPhpcs> { |