1919 */
2020
2121if (PHP_VERSION_ID < 70000 ) {
22- $ error = 'ERROR: This script requires PHP version 7.0.0 or greater. ' . PHP_EOL ;
22+ $ error = 'ERROR: This script requires PHP version 7.0.0 or greater. ' . PHP_EOL ;
2323 fwrite (STDERR , $ error );
2424 exit (1 );
2525}
2626
27- /**
28- * Helper function to require the correct autoload file given a list of possible file locations.
29- *
30- * @param array $files An array of possible file paths.
31- *
32- * @return void
33- */
34- function requireCorrectAutoloadFile (array $ files ) {
35- foreach ($ files as $ file ) {
36- $ file = realpath ($ file );
37- if ($ file !== false && is_file ($ file ) === true ) {
38- require_once ($ file );
39- return ;
40- }
41- }
42- }
27+ require_once __DIR__ . '/../Scripts/DocCodeExamples/Functions.php ' ;
4328
4429$ devToolsAutoloadLocations = [
4530 __DIR__ . '/../devtools-autoload.php ' , // Git clone or direct run from within vendor package directory.
@@ -51,8 +36,8 @@ $devToolsAutoloadLocations = [
5136$ phpcsAutoloadLocations = [
5237 __DIR__ . '/../vendor/squizlabs/php_codesniffer/autoload.php ' , // Git clone.
5338 __DIR__ . '/../squizlabs/php_codesniffer/autoload.php ' , // Composer bin dir install.
54- __DIR__ . '/../../autoload.php ' , // Installed as a Composer dependency for PHPCS itself. Running from vendor/bin/.
55- __DIR__ . '/../../../../autoload.php ' , // Installed as a Composer dependency for PHPCS itself. Running from vendor/phpcsstandards/phpcsdevtools/bin/.
39+ __DIR__ . '/../../autoload.php ' , // Composer dependency for PHPCS itself. Running from vendor/bin/.
40+ __DIR__ . '/../../../../autoload.php ' , // Composer dependency running from vendor/phpcsstandards/phpcsdevtools/bin/.
5641];
5742
5843// Try to find a usable PHPCSDevTools autoload file.
@@ -72,13 +57,13 @@ try {
7257 $ extractor = new PHPCSDevTools \Scripts \DocCodeExamples \CodeBlocksExtractor ();
7358
7459 // It is necessary to reset argv to avoid issues with the PHPCS Config,
75- // as it also checks for command line arguments.
60+ // as it also checks for command line arguments.
7661 $ _SERVER ['argv ' ] = [];
77- $ phpcsConfig = new PHP_CodeSniffer \Config ();
62+ $ phpcsConfig = new PHP_CodeSniffer \Config ();
7863
7964 $ check = new PHPCSDevTools \Scripts \DocCodeExamples \Check ($ config , $ extractor , $ phpcsConfig , $ writer );
80- exit ($ check ->run ());
65+ exit ($ check ->run ());
8166} catch (RuntimeException $ e ) {
82- echo $ e ->getMessage () . PHP_EOL ;
83- exit (1 );
67+ echo $ e ->getMessage () . PHP_EOL ;
68+ exit (1 );
8469}
0 commit comments