PHP detector
The detector’s supported declarations, what it reports, what it intentionally does not judge, and the false-positive boundaries. The matrix and policy it belongs to are on Compatibility.
PHP detector
The php detector is supported: its level is recorded as stable in benchmarks/thresholds.json. 108 public repositories in Validation cover it. Its lifecycle rules are in registry/php.json and ship in the data bundle.
Supported files and declarations
| File | Declaration read | Notes |
|---|---|---|
.php-version |
One pinned version on a line by itself, such as 7.4.33, 7.4, or php-7.4.33 |
Blank lines and # comments are ignored. A file with more than one version, or any other line, produces nothing. The php- prefix is stripped before matching. |
.tool-versions |
A php line with one or more pinned versions |
Every version on the line is reported. Other tools are ignored. A line with any unsupported token produces nothing. |
composer.json |
require.php, config.platform.php, and direct packages in require / require-dev (vendor/name with a literal constraint) |
Extensions (ext-*), floating *, dynamic ${…} values, extra.php, and other config.platform.* keys are ignored. |
composer.lock |
platform.php, and each resolved package in packages / packages-dev (name and version) |
Every resolved package is checked, including transitive and require-dev packages. platform-dev, plugin-api-version, and non-php platform keys are not read. An abandoned flag is parsed and is not a finding by itself. |
Files are found by walking the repository up to eight directories deep, to at most 500 files. Symbolic links are not followed, and .git, node_modules, vendor, dist, build, target, .venv, venv, fixtures, __fixtures__, and testdata are skipped. PHP, phpenv, asdf, and Composer are never run, and nothing is fetched.
What it reports
- A pinned PHP release line that is past end of life, in the
.php-version,.tool-versions,composer.jsonconfig.platform.php, orcomposer.lockplatform.phpline that pins it, an exactrequire.phpversion that matches a rule, or arequire.php/config.platform.phpconstraint that allows only end-of-life lines (^7.3,~7.2,7.4.*,>=7.0 <7.3). The bundled rules cover PHP 8.1, 8.0, and 7.4, citing the PHP unsupported branches page. A range that also allows a supported or unlisted release, such as>=7.4or^7.4 || ^8.2, produces no runtime finding. - A
composer.jsonpackage line only when a rule covers every version of that package (vers:composer/*). The bundled abandoned-package rules coverswiftmailer/swiftmailerandzendframework/zend-stdlib, citing Packagist and the Symfony / Laminas announcements. - A resolved package in
composer.lockwhen a rule’sverscontains that version. Abandoned-package rules match any resolved version of the named package.
Each finding names the file and line, and carries its rule’s source, replacement, deadline, migration guidance, and verification commands. A package finding whose rule lists usage matchers also lists the .php files that require / include (and _once) that package, and the qualified calls those matchers name (Class::method and new Class). The finding’s impact counts those usages, and a migration packet lists the files. A runtime finding points at the pin only.
What it intentionally does not judge
- PHP releases and Composer packages with no rule in
registry/php.json. A missing finding is not evidence that a version is current. - A
.php-versionor.tool-versionsvalue ofsystemorlatest, a template, or a value that interpolates at runtime. - Composer
require.phpconstraints that allow a supported or unlisted release (>=7.4,^8.2,^7.4 || ^8.2). - Extensions (
ext-*), floating*package constraints,git/pathrepositories, and dynamic${…}values incomposer.json. - An
abandonedflag incomposer.lockwithout a matching lifecycle rule. Composer may mark a package abandoned; Evergreen reports it only when a reviewed rule names that package. - Vulnerability advisories and license policy.
Known limits and false-positive boundaries
- A runtime pin is reported whatever the project actually runs. A stale
.tool-versionsorconfig.platform.phpthat a project no longer uses still produces a finding. composer.lockfindings include transitive packages, because the lockfile resolves them. A package can be reported even though the project never imports it.- Package names are matched exactly as written in the file, and a rule matches only the versions its
versrange names. - Malformed input produces no declarations from the affected unit, never a partial result, and no error is raised. For
.php-version,composer.json, andcomposer.lockthat unit is the whole file. For.tool-versionsit is the one malformed line. A file over 1 MiB yields nothing, and a single line over 4,096 characters is skipped. - The eight-level and 500-file limits are silent. Files beyond them, and any under
vendoror a skipped directory, are not scanned. - Source usage reads
.phpfiles. Quotedrequire/include(and_once) paths match a rule whose module is that path (a trailing.phpis stripped). A call matches when the rule names the qualified form, such asSwift_Mailer::newInstanceornew Zend\Stdlib\Parameters. Usage is not a PHP AST: it is regex-based matching, so unusual formatting can miss a call or require. - A
requireorincludewhose argument is not a string literal (a variable, concatenation, or a method call on the string) is listed as unclassified, with its file and line. Evergreen does not guess which package it loads.new $classand$class::method()are unclassified for the same reason. - Usage is not read under
vendor,fixtures,__fixtures__, ortestdata. Comments and ordinary strings are not usages. A single source line over 4,096 characters is skipped for usage scanning, matching the declaration parsers.