Files
XC_VM/tools/phpstan/phpstan-bootstrap.php
T
Divarion_D 7f3812e165 chore(build): move phpstan / php-cs-fixer config out of the repo root
Relocate the dev-tooling config into build/ so the project root only holds
source and first-class project files:
- phpstan.dist.neon        -> build/phpstan.dist.neon
- phpstan-baseline.neon    -> build/phpstan-baseline.neon
- .php-cs-fixer.dist.php    -> build/.php-cs-fixer.dist.php
- .php-cs-fixer.cache       -> build/ (regenerated there; gitignored)

Because neon/CS-Fixer resolve relative paths against the config file's own
directory, the internal references are re-anchored one level up (src/ ->
../src/, tools/ -> ../tools/, Finder in(__DIR__.'/../src'); the baseline's
path: entries likewise). The Makefile now points PHPStan at the config with
-c build/phpstan.dist.neon (it previously relied on root auto-discovery),
generates the baseline into build/, and passes --config=build/... to CS-Fixer;
the CS-Fixer cache is pinned to build/ via setCacheFile and re-gitignored.

No behaviour change. Verified: make phpstan (No errors), make cs (0 fixable),
make gates. CI runs through these make targets, so it is covered.
2026-08-09 19:37:11 +03:00

27 lines
899 B
PHP

<?php
/**
* PHPStan bootstrap for XC_VM.
*
* The project uses Composer PSR-4, but this bootstrap deliberately does NOT wire
* a project autoloader. PHPStan discovers every class/interface/function itself
* by statically scanning the directories listed under `paths` and
* `scanDirectories` in build/phpstan.dist.neon — no project code is executed. (The
* Composer-installed phpstan binary loads src/vendor/autoload.php for its own
* dependencies.)
*
* This file only defines the global constants the codebase references so that
* analysis of constant-dependent expressions stays accurate.
*
* @package XC_VM
*/
$srcRoot = dirname(__DIR__, 2) . '/src';
if (!defined('MAIN_HOME')) {
define('MAIN_HOME', $srcRoot . '/');
}
// NOTE: constants.stub.php is loaded via its own bootstrapFiles entry in
// build/phpstan.dist.neon (so PHPStan tracks it for result-cache invalidation).