mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-06 04:02:36 +02:00
fix(phpstan): fix real bugs (return contracts, arg/byref, stub types) 599→585
- 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().
This commit is contained in:
@@ -25,6 +25,5 @@ if (!defined('MAIN_HOME')) {
|
||||
define('MAIN_HOME', $srcRoot . '/');
|
||||
}
|
||||
|
||||
// Declare constants the app defines at runtime (inside methods) so PHPStan can
|
||||
// resolve them. Auto-generated — regenerate with gen-constants-stub.php.
|
||||
require __DIR__ . '/constants.stub.php';
|
||||
// NOTE: constants.stub.php is loaded via its own bootstrapFiles entry in
|
||||
// phpstan.dist.neon (so PHPStan tracks it for result-cache invalidation).
|
||||
|
||||
Reference in New Issue
Block a user