Files
XC_VM/phpstan.dist.neon
T
Divarion-D baf0bc46a2 fix(phpstan): real undefined-var bug + exclude view templates 566→498
- StreamsCronJob: $rBitrate/$rCompatible/$rResolution/$rAudioCodec/$rVideoCodec
  were only set inside `if ($rFFProbeOutput)` (and a nested codecs check) but
  consumed by the UPDATE query that runs whenever the .analyse file exists —
  undefined vars (nulls/warnings) when probing fails or returns no codecs.
  Initialise them to null before the conditional.
- phpstan.dist.neon: exclude src/modules/*/views/* from analysis. These are
  templates included into a controller's scope; their variables are injected by
  the caller, so standalone analysis flags every one as undefined (~60 false
  positives). Symbols are still indexed.
2026-06-23 20:34:44 +03:00

84 lines
3.5 KiB
Plaintext

parameters:
# Start low for a legacy codebase, then raise one step at a time (0 → max).
# Every increment surfaces a new class of issues; fix or baseline, then bump.
level: 5
phpVersion: 80300
# Entry points to analyze. Add/remove dirs as the audit progresses.
paths:
- src/core
- src/domain
- src/infrastructure
- src/streaming
- src/modules
- src/cli
# No Composer + no namespaces. The bootstrap only defines global constants;
# it does NOT run the project autoloader (that would force a live directory
# rescan per class miss and crash the workers). PHPStan resolves every
# symbol statically from `paths` + `scanDirectories` below.
bootstrapFiles:
- tools/phpstan/phpstan-bootstrap.php
# Listed directly (not just require'd from the bootstrap) so PHPStan
# tracks it for result-cache invalidation when constants change.
- tools/phpstan/constants.stub.php
# Indexed for symbol resolution (classes/interfaces/functions defined here
# are findable) but NOT reported on directly. These cover every source dir
# outside `paths` so cross-references always resolve.
scanDirectories:
- src/public
- src/signals
- src/ministra
- src/content
- src/resources
- src/config
- src/migrations
# Root files holding global classes (XC_Bootstrap, XC_Autoloader) referenced
# across the codebase but living outside any scanned directory.
scanFiles:
- src/autoload.php
- src/bootstrap.php
excludePaths:
analyse:
- src/*/tmp/*
- src/tmp/*
- src/backups/*
# Vendored third-party library shipped inside core
- src/core/Parsing/M3uParser/*
# View templates: included into a controller's scope, so their
# variables ($rSettings, $language, ...) are injected by the caller.
# PHPStan analyses files standalone and would flag every such var as
# undefined — not real bugs. (Still indexed via scanDirectories.)
- src/modules/*/views/*
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
# Documented FALSE POSITIVES that static analysis cannot resolve — NOT a
# baseline of real bugs. Each entry is unactionable by design.
ignoreErrors:
# Dynamic require/include built from absolute runtime paths
# (MAIN_HOME = /home/xc_vm/ on a deployed server). The files exist at
# deploy time; PHPStan cannot see them on a dev/CI checkout.
- identifier: requireOnce.fileNotFound
- identifier: include.fileNotFound
- identifier: require.fileNotFound
# Proprietary ioncube-encoded class, shipped only in licensed builds.
# Every call site is guarded with class_exists('XC_VM').
- '#unknown class XC_VM\.#'
# External vendor library (maxmind-db/reader), installed at runtime and
# not part of the source tree.
- '#MaxMind\\Db\\Reader#'
# ext-inotify stub is incomplete: inotify_init() really can return false
# (PHP manual), so the defensive check below is correct, not dead code.
-
message: '#=== between resource and false will always evaluate to false#'
path: src/streaming/AsyncFileOperations.php
# NOTE: no baseline include — the goal here is to FIX errors, not freeze them.
# (Re-add `includes: [phpstan-baseline.neon]` only if a temporary freeze is needed.)