mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-26 20:01:57 +02:00
- constants stub: use mt_rand()-based exprs so PHPStan infers GENERAL types,
not literal 0/'' — fixes false division-by-zero (PACKET_SIZE) and
foreach-over-false (str_split with len 0). Load stub via bootstrapFiles so
result-cache invalidates on change.
- return contracts: explicit returns where a path fell through to null and
violated the declared type:
- StreamRepository::getById/getWatchFolder, GroupService::getById,
getStream() → return false (declared array|false).
- ServerRepository::getPublicURL → return '' when server missing (array→string).
- MagService::resetSTB → return query() result (declared bool).
- StreamUtils::getPlaylistSegments → explicit return null.
- NetworkUtils::stopDownload → @return null corrected to @return void.
- PlexController: getPlexToken() called with 5 args but accepts 4 — dropped
the dead 5th argument.
- DropboxClient::getMetaFromHeaders: array_shift() on an array_filter()
expression (not a variable, by-ref error) — assign to a var first.
- WatchdogCommand: wrap numeric-string subtractions (nginx/proc-stat values)
in floatval()/intval().
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* PHPStan bootstrap for XC_VM.
|
|
*
|
|
* The project has no Composer and no PSR-4 namespaces. We deliberately do NOT
|
|
* include src/autoload.php here: registering the runtime class-map autoloader
|
|
* makes PHPStan execute a full live directory rescan on every class miss
|
|
* (the igbinary cache is unavailable on a plain CLI), which exhausts memory
|
|
* and crashes the parallel workers.
|
|
*
|
|
* Instead, PHPStan discovers every class/interface/function on its own by
|
|
* statically scanning the directories listed under `paths` and
|
|
* `scanDirectories` in phpstan.dist.neon — no project code is executed.
|
|
*
|
|
* 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
|
|
// phpstan.dist.neon (so PHPStan tracks it for result-cache invalidation).
|