2323error_reporting (E_ALL );
2424
2525if (ini_get ('phar.readonly ' ) === '1 ' ) {
26- echo 'Unable to build, phar.readonly in php.ini is set to read only. ' . PHP_EOL ;
26+ echo 'Unable to build, phar.readonly in php.ini is set to read only. ' . PHP_EOL ;
2727 exit (1 );
2828}
2929
30- require_once dirname (__DIR__ ). '/autoload.php ' ;
31- require_once dirname (__DIR__ ). '/src/Util/Tokens.php ' ;
30+ require_once dirname (__DIR__ ) . '/autoload.php ' ;
31+ require_once dirname (__DIR__ ) . '/src/Util/Tokens.php ' ;
3232
3333if (defined ('PHP_CODESNIFFER_VERBOSITY ' ) === false ) {
3434 define ('PHP_CODESNIFFER_VERBOSITY ' , 0 );
@@ -54,13 +54,13 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
5454 $ tokenizer = new PHP ($ contents , $ config , "\n" );
5555 $ tokens = $ tokenizer ->getTokens ();
5656 } catch (TokenizerException $ e ) {
57- throw new RuntimeException ('Failed to tokenize file ' . $ fullpath );
57+ throw new RuntimeException ('Failed to tokenize file ' . $ fullpath );
5858 }
5959
6060 $ stripped = '' ;
6161 foreach ($ tokens as $ token ) {
6262 if ($ token ['code ' ] === T_ATTRIBUTE_END || $ token ['code ' ] === T_OPEN_TAG ) {
63- $ stripped .= $ token ['content ' ]. "\n" ;
63+ $ stripped .= $ token ['content ' ] . "\n" ;
6464 continue ;
6565 }
6666
@@ -87,13 +87,13 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
8787];
8888
8989foreach ($ scripts as $ script ) {
90- echo "Building $ script phar " . PHP_EOL ;
90+ echo "Building $ script phar " . PHP_EOL ;
9191
92- $ pharName = $ script. '.phar ' ;
93- $ pharFile = getcwd (). '/ ' . $ pharName ;
94- echo "\t=> $ pharFile " . PHP_EOL ;
92+ $ pharName = $ script . '.phar ' ;
93+ $ pharFile = getcwd () . '/ ' . $ pharName ;
94+ echo "\t=> $ pharFile " . PHP_EOL ;
9595 if (file_exists ($ pharFile ) === true ) {
96- echo "\t** file exists, removing ** " . PHP_EOL ;
96+ echo "\t** file exists, removing ** " . PHP_EOL ;
9797 unlink ($ pharFile );
9898 }
9999
@@ -105,7 +105,7 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
105105
106106 echo "\t=> adding files... " ;
107107
108- $ srcDir = realpath (__DIR__ . '/../src ' );
108+ $ srcDir = realpath (__DIR__ . '/../src ' );
109109 $ srcDirLen = strlen ($ srcDir );
110110
111111 $ rdi = new RecursiveDirectoryIterator ($ srcDir , RecursiveDirectoryIterator::FOLLOW_SYMLINKS );
@@ -123,11 +123,11 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
123123 }
124124
125125 $ fullpath = $ file ->getPathname ();
126- if (strpos ($ fullpath , DIRECTORY_SEPARATOR . 'Tests ' . DIRECTORY_SEPARATOR ) !== false ) {
126+ if (strpos ($ fullpath , DIRECTORY_SEPARATOR . 'Tests ' . DIRECTORY_SEPARATOR ) !== false ) {
127127 continue ;
128128 }
129129
130- $ path = 'src ' . substr ($ fullpath , $ srcDirLen );
130+ $ path = 'src ' . substr ($ fullpath , $ srcDirLen );
131131
132132 if (substr ($ filename , -4 ) === '.xml ' ) {
133133 $ phar ->addFile ($ fullpath , $ path );
@@ -140,39 +140,39 @@ function stripWhitespaceAndComments(string $fullpath, Config $config)
140140 }//end foreach
141141
142142 // Add requirements check.
143- $ phar ->addFromString ('requirements.php ' , stripWhitespaceAndComments (realpath (__DIR__ . '/../requirements.php ' ), $ config ));
143+ $ phar ->addFromString ('requirements.php ' , stripWhitespaceAndComments (realpath (__DIR__ . '/../requirements.php ' ), $ config ));
144144
145145 // Add autoloader.
146- $ phar ->addFromString ('autoload.php ' , stripWhitespaceAndComments (realpath (__DIR__ . '/../autoload.php ' ), $ config ));
146+ $ phar ->addFromString ('autoload.php ' , stripWhitespaceAndComments (realpath (__DIR__ . '/../autoload.php ' ), $ config ));
147147
148148 // Add licence file.
149- $ phar ->addFile (realpath (__DIR__ . '/../licence.txt ' ), 'licence.txt ' );
149+ $ phar ->addFile (realpath (__DIR__ . '/../licence.txt ' ), 'licence.txt ' );
150150
151- echo 'done ' . PHP_EOL ;
152- echo "\t Added " . $ fileCount. ' files ' . PHP_EOL ;
151+ echo 'done ' . PHP_EOL ;
152+ echo "\t Added " . $ fileCount . ' files ' . PHP_EOL ;
153153
154154 /*
155155 Add the stub.
156156 */
157157
158158 echo "\t=> adding stub... " ;
159- $ stub = '#!/usr/bin/env php ' . "\n" ;
160- $ stub .= '<?php ' . "\n" ;
161- $ stub .= 'Phar::mapPhar( \'' . $ pharName. '\'); ' . "\n" ;
162- $ stub .= 'require_once "phar:// ' . $ pharName. '/requirements.php"; ' . "\n" ;
163- $ stub .= 'PHP_CodeSniffer\checkRequirements(); ' . "\n" ;
164- $ stub .= 'require_once "phar:// ' . $ pharName. '/autoload.php"; ' . "\n" ;
165- $ stub .= '$runner = new PHP_CodeSniffer\Runner(); ' . "\n" ;
166- $ stub .= '$exitCode = $runner->run ' . $ script. '(); ' . "\n" ;
167- $ stub .= 'exit($exitCode); ' . "\n" ;
159+ $ stub = '#!/usr/bin/env php ' . "\n" ;
160+ $ stub .= '<?php ' . "\n" ;
161+ $ stub .= 'Phar::mapPhar( \'' . $ pharName . '\'); ' . "\n" ;
162+ $ stub .= 'require_once "phar:// ' . $ pharName . '/requirements.php"; ' . "\n" ;
163+ $ stub .= 'PHP_CodeSniffer\checkRequirements(); ' . "\n" ;
164+ $ stub .= 'require_once "phar:// ' . $ pharName . '/autoload.php"; ' . "\n" ;
165+ $ stub .= '$runner = new PHP_CodeSniffer\Runner(); ' . "\n" ;
166+ $ stub .= '$exitCode = $runner->run ' . $ script . '(); ' . "\n" ;
167+ $ stub .= 'exit($exitCode); ' . "\n" ;
168168 $ stub .= '__HALT_COMPILER(); ' ;
169169 $ phar ->setStub ($ stub );
170170
171- echo 'done ' . PHP_EOL ;
171+ echo 'done ' . PHP_EOL ;
172172}//end foreach
173173
174174Timing::printRunTime ();
175175
176176echo PHP_EOL ;
177- echo 'Filesize generated phpcs.phar file: ' . number_format (filesize (dirname (__DIR__ ). '/phpcs.phar ' ), 0 , ', ' , '. ' ). ' bytes ' . PHP_EOL ;
178- echo 'Filesize generated phpcs.phar file: ' . number_format (filesize (dirname (__DIR__ ). '/phpcbf.phar ' ), 0 , ', ' , '. ' ). ' bytes ' . PHP_EOL ;
177+ echo 'Filesize generated phpcs.phar file: ' . number_format (filesize (dirname (__DIR__ ) . '/phpcs.phar ' ), 0 , ', ' , '. ' ) . ' bytes ' . PHP_EOL ;
178+ echo 'Filesize generated phpcs.phar file: ' . number_format (filesize (dirname (__DIR__ ) . '/phpcbf.phar ' ), 0 , ', ' , '. ' ) . ' bytes ' . PHP_EOL ;
0 commit comments