} $checker = new CodeChecker(); foreach ($options['--ignore'] as $ignore) { $checker->ignore[] = $ignore; } $checker->readOnly = !isset($options['--fix']); // control characters checker $checker->tasks[] = function (CodeChecker $checker, $s) { if (!Strings::match($s, '#^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]*+$#')) { $checker->error('Contains control characters'); } }; // BOM remover $checker->tasks[] = function (CodeChecker $checker, $s) { if (substr($s, 0, 3) === "") { $checker->fix('contains BOM'); return substr($s, 3); } }; // UTF-8 checker $checker->tasks[] = function (CodeChecker $checker, $s) { if (!Strings::checkEncoding($s)) { $checker->error('Is not valid UTF-8 file'); } }; // invalid phpDoc checker $checker->tasks[] = function (CodeChecker $checker, $s) { if ($checker->is('php,phpt')) { foreach (token_get_all($s) as $token) { if ($token[0] === T_COMMENT && Strings::match($token[1], '#/\\*\\s.*@[a-z]#isA')) { $checker->warning('Missing /** in phpDoc comment', $token[2]);