File tree Expand file tree Collapse file tree 2 files changed +50
-4
lines changed
Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ require_once __DIR__ . '/../../vendor/autoload.php ' ;
4+
5+ $ dir = $ argv [1 ] ?? __DIR__ ;
6+ $ iterator = new RecursiveDirectoryIterator ($ dir );
7+ $ iterator ->setFlags (RecursiveDirectoryIterator::SKIP_DOTS );
8+ $ files = new RecursiveIteratorIterator ($ iterator );
9+
10+ $ locations = [];
11+ foreach ($ files as $ file ) {
12+ $ path = $ file ->getPathname ();
13+ if ($ file ->getExtension () !== 'php ' ) {
14+ continue ;
15+ }
16+ $ contents = file_get_contents ($ path );
17+ $ lines = explode ("\n" , $ contents );
18+ foreach ($ lines as $ i => $ line ) {
19+ if (!str_contains ($ line , '_PHPStan_checksum ' )) {
20+ continue ;
21+ }
22+
23+ $ trimmedPath = substr ($ path , strlen ($ dir ) + 1 );
24+ $ locations [] = $ trimmedPath . ': ' . ($ i + 1 );
25+ }
26+ }
27+ sort ($ locations );
28+ echo implode ("\n" , $ locations );
29+ echo "\n" ;
Original file line number Diff line number Diff line change @@ -246,12 +246,29 @@ jobs:
246246 with :
247247 name : phar-file-checksum
248248
249- - name : " New checksum"
250- run : echo $(md5sum phpstan.phar | cut -d' ' -f1)
249+ - name : " Install PHP"
250+ uses : " shivammathur/setup-php@v2"
251+ with :
252+ coverage : " none"
253+ php-version : " 8.1"
254+
255+ - name : " Install dependencies"
256+ run : " composer install --no-interaction --no-progress"
257+
258+ - name : " Extract old phpstan.phar"
259+ run : " php compiler/build/box.phar extract phar-file-checksum/phpstan.phar phar-old"
260+
261+ - name : " Extract new phpstan.phar"
262+ run : " php compiler/build/box.phar extract phpstan.phar phar-new"
263+
264+ - name : " List prefix locations in old PHAR"
265+ run : " php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-old > phar-old.txt"
251266
252- - name : " Old checksum "
253- run : echo $(md5sum phar-file-checksum/phpstan.phar | cut -d' ' -f1)
267+ - name : " List prefix locations in new PHAR "
268+ run : " php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-new > phar-new.txt "
254269
270+ - name : " Diff locations"
271+ run : " diff -u phar-old.txt phar-new.txt"
255272
256273 commit :
257274 name : " Commit PHAR"
You can’t perform that action at this time.
0 commit comments