-
Notifications
You must be signed in to change notification settings - Fork 563
Expand file tree
/
Copy pathlistPrefix.php
More file actions
32 lines (28 loc) · 837 Bytes
/
listPrefix.php
File metadata and controls
32 lines (28 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php declare(strict_types = 1);
require_once __DIR__ . '/../../vendor/autoload.php';
$dir = $argv[1] ?? __DIR__;
$iterator = new RecursiveDirectoryIterator($dir);
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($iterator);
$locations = [];
foreach ($files as $file) {
$path = $file->getPathname();
if ($file->getExtension() !== 'php') {
continue;
}
$contents = file_get_contents($path);
$lines = explode("\n", $contents);
foreach ($lines as $i => $line) {
if (!str_contains($line, '_PHPStan_checksum')) {
continue;
}
$trimmedPath = substr($path, strlen($dir) + 1);
if (str_starts_with($trimmedPath, 'vendor/composer/autoload_')) {
continue;
}
$locations[] = $trimmedPath . ':' . ($i + 1);
}
}
sort($locations);
echo implode("\n", $locations);
echo "\n";