-
-
Save bendavies/944de78000e38a327a5f009471ce4f40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Psl\Regex; | |
use Psl\File; | |
use Psl\Filesystem; | |
use Psl\Vec; | |
$covertedComments = Regex\replace(File\read('phpstan-baseline.php'), '/\/\/ identifier: (.+)/', '\'identifier\' => \'$1\','); | |
$tempBaseline = Filesystem\create_temporary_file(); | |
File\write($tempBaseline, $covertedComments); | |
$baseline = include $tempBaseline; | |
$errors = $baseline['parameters']['ignoreErrors']; | |
$chunks = Vec\chunk($errors, 100); | |
Vec\map_with_key($chunks, static function (int $index, array $chunk) { | |
$filename = 'phpstan-baseline-chunk-' . $index . '.php'; | |
Filesystem\create_file($filename); | |
$errors = var_export($chunk, true); | |
$covertedComments = Regex\replace($errors, '/\'identifier\' => \'(.+)\',/', '// identifier: $1'); | |
File\write($filename, '<?php return [\'parameters\' => [\'ignoreErrors\' => ' . $covertedComments . ']];'); | |
}); | |
echo 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment