Repository navigation
Description
When the configuration TypePHP actually uses matches no project files, a run reports 0 violations with no warning. That reads exactly like a clean codebase.
We hit this three times while running TypePHP in CI on a large application (~38k PHP files):
- Composer under an opcache with
validate_timestamps=0leftautoload_static.phpwithout the TypePHP bootstrap: nothing booted, every run said 0 violations. - Before [Bug]: Project root resolves to TypePHP's own package directory with a custom vendor-dir, so auto-boot: false is ignored #109, the project root was resolved to the package's own directory (custom
vendor-dir), so ourtypephp.phpwas never read. - After upgrading 0.11.3 → 0.11.4, the [Bug]: Project root resolves to TypePHP's own package directory with a custom vendor-dir, so auto-boot: false is ignored #109 fix (thanks, it works) moved the project root from the working directory to the directory of
composer.json. Ourtypephp.phpsat in the working directory, so it was ignored. TypePHP fell back to its defaultinclude(src/**,app/**), which matches nothing in our tree, and the run reported 0 violations.
In all three cases, only a probe of our own caught it: a function with @param int<0,max> called with -1, which must throw.
No playground link: this is about project root and config resolution, not about a code sample. Reproduction for case 3: a project whose composer.json lives in a subdirectory (app/composer.json with "vendor-dir": "app/libs"), a typephp.php in the repository root next to that subdirectory, and the test run from the repository root on 0.11.4.
Proposals
- Warn when the effective
includepatterns match zero files (afterexclude). This alone would have caught all three cases. - Put the resolved context in the report summary: project root, path of the config file used (or "defaults"), and the number of files checked or instrumented. Then
0 violationsover0 filescan be told apart from0 violationsover 2,000 files. - Warn when a
typephp.phpexists in the current working directory but is not the config in use, e.g. "typephp.php found in /cwd but project root is /cwd/app, using /cwd/app/typephp.php (not found, defaults applied)". This is the upgrade path that bit us.
Also worth a line in the 0.11.4 changelog: the root change moves where typephp.php must live for projects with a custom vendor-dir.
Filed by Max (AI dev partner at Digital Process Tools), on behalf of @fdavid.
Activity
rcalicdan commentedon Oct 11, 2026
@fdaviddpt Thank you, this is a nice improvement will be implementing this on next-release
rcalicdan commentedon Oct 11, 2026
@fdaviddpt Hello this feature is implemented and fixed the other hug mention.
rcalicdan commentedon Oct 11, 2026
@fdaviddpt Also I had update the docs https://typephp-php.github.io/docs/core-concepts/violation-reporting