%PDF- %PDF-
Direktori : /home/vacivi36/vacivitta.com.br/vendor/rector/rector/vendor/nette/neon/bin/ |
Current File : /home/vacivi36/vacivitta.com.br/vendor/rector/rector/vendor/nette/neon/bin/neon-lint |
#!/usr/bin/env php <?php declare (strict_types=1); namespace RectorPrefix20211231; if (!(\is_file($file = __DIR__ . '/../vendor/autoload.php') && (include $file)) && !(\is_file($file = __DIR__ . '/../../../autoload.php') && (include $file))) { \fwrite(\STDERR, "Install packages using Composer.\n"); exit(1); } if (\function_exists('pcntl_signal')) { \pcntl_signal(\SIGINT, function () : void { \pcntl_signal(\SIGINT, \SIG_DFL); echo "Terminated\n"; exit(1); }); } elseif (\function_exists('sapi_windows_set_ctrl_handler')) { \sapi_windows_set_ctrl_handler(function () { echo "Terminated\n"; exit(1); }); } \set_time_limit(0); echo ' NEON linter ----------- '; if ($argc < 2) { echo "Usage: neon-lint <path>\n"; exit(1); } $ok = \RectorPrefix20211231\scanPath($argv[1]); exit($ok ? 0 : 1); function scanPath(string $path) : bool { echo "Scanning {$path}\n"; $it = new \RecursiveDirectoryIterator($path); $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY); $it = new \RegexIterator($it, '~\\.neon$~'); $counter = 0; $success = \true; foreach ($it as $file) { echo \str_pad(\str_repeat('.', $counter++ % 40), 40), "\r"; $success = \RectorPrefix20211231\lintFile((string) $file) && $success; } echo \str_pad('', 40), "\r"; echo "Done.\n"; return $success; } function lintFile(string $file) : bool { \set_error_handler(function (int $severity, string $message) use($file) { if ($severity === \E_USER_DEPRECATED) { \fwrite(\STDERR, "[DEPRECATED] {$file} {$message}\n"); return null; } return \false; }); $s = \file_get_contents($file); if (\substr($s, 0, 3) === "") { \fwrite(\STDERR, "[WARNING] {$file} contains BOM\n"); $contents = \substr($s, 3); } try { \RectorPrefix20211231\Nette\Neon\Neon::decode($s); return \true; } catch (\RectorPrefix20211231\Nette\Neon\Exception $e) { \fwrite(\STDERR, "[ERROR] {$file} {$e->getMessage()}\n"); } finally { \restore_error_handler(); } return \false; }