Skip to content

Commit

Permalink
chore(composer): update vimeo/psalm dependency
Browse files Browse the repository at this point in the history
  - Update the vimeo/psalm dependency in composer.json from ^5.18 to ^5.19
  - Add composer-fixer script to run composer-fixer.php
  - Other minor changes and fixes
  • Loading branch information
guanguans committed Jan 10, 2024
1 parent 190ffc8 commit 6aaec44
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
62 changes: 62 additions & 0 deletions composer-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);

/**
* This file is part of the guanguans/laravel-soar.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

require __DIR__.'/vendor/autoload.php';

/** @noinspection JsonEncodingApiUsageInspection */
$composerJson = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
$symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput());

foreach ($composerJson as $option => $value) {
if (! in_array($option, ['require', 'require-dev'], true)) {
continue;
}

foreach ($value as $package => $version) {
if (
'php' === $package
|| '*' === $version
|| str_starts_with($package, 'ext-')
|| str_starts_with($version, 'dev-')
|| str_contains($version, '|')
) {
continue;
}

$symfonyStyle->warning("Fixing $option $package ...");

try {
Process::fromShellCommandline(sprintf(
'COMPOSER_MEMORY_LIMIT=-1 %s %s require %s %s --ansi -W -v',
(new PhpExecutableFinder())->find(),
(new Symfony\Component\Process\ExecutableFinder())->find('composer'),
$package,
'require-dev' === $option ? '--dev' : ''
))->mustRun(static function ($type, $buffer) use ($symfonyStyle): void {
$symfonyStyle->write($buffer);
});

$symfonyStyle->warning("Fixing $option $package success.");
} catch (ProcessFailedException $e) {
$symfonyStyle->error("Fixing $option $package failed.");
}
}
}

$symfonyStyle->success('All done.');
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"rector/rector": "^0.19",
"spatie/pest-plugin-snapshots": "^1.1 || ^2.0",
"spatie/ray": "^1.40",
"vimeo/psalm": "^5.18"
"vimeo/psalm": "^5.19"
},
"suggest": {
"barryvdh/laravel-debugbar": "Output SQL scores to Laravel DebugBar.",
Expand Down Expand Up @@ -165,6 +165,7 @@
"checks-parallel": "@composer-parallel composer-validate md-lint lint style-lint test psalm",
"composer-bin-all-update": "@composer bin all update --ansi -v",
"composer-check-platform-reqs": "@composer check-platform-reqs --lock --ansi -v",
"composer-fixer": "@php ./composer-fixer.php",
"composer-normalize": "@composer normalize --dry-run --diff --ansi -v",
"composer-parallel": "@composer parallel --ansi -v",
"composer-unused": "@php ./vendor/bin/composer-unused --ansi -v",
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
Expand Down Expand Up @@ -91,6 +92,7 @@
// StaticClosureRector::class,
// UnSpreadOperatorRector::class,

ChangeOrIfContinueToMultiContinueRector::class,
EncapsedStringsToSprintfRector::class,
// InlineIfToExplicitIfRector::class,
LogicalToBooleanRector::class,
Expand Down

0 comments on commit 6aaec44

Please sign in to comment.