setExtensions([self::FILE_EXTENSION]); $fileList = $this->isFullScan() ? array_column(Files::init()->getStaticHtmlFiles(), '0') : PHPCodeTest::getWhitelist([self::FILE_EXTENSION], __DIR__, __DIR__); $result = $codeSniffer->run($fileList); $report = file_exists($reportFile) ? file_get_contents($reportFile) : ''; $this->assertEquals( 0, $result, "PHP Code Sniffer detected {$result} violation(s): " . PHP_EOL . $report ); } /** * Returns whether a full scan was requested. * * This can be set in the `phpunit.xml` used to run these test cases, by setting the constant * `TESTCODESTYLE_IS_FULL_SCAN` to `1`, e.g.: * ```xml * * * * * ``` * * @return bool */ private function isFullScan(): bool { return defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1'; } }