diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 2f8a2d5..2cc50dc 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -9,16 +9,16 @@ on: jobs: php-cs-fixer: name: PHP CS Fixer (PHP ${{ matrix.php-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: php-version: - - '8.3' + - '8.4' steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -28,7 +28,7 @@ jobs: tools: cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 with: composer-options: '--working-dir=tools/php-cs-fixer' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f8c16d9..a61cd25 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,7 +9,7 @@ on: jobs: phpunit: name: PHPUnit (PHP ${{ matrix.php-version }} - Symfony ${{ matrix.symfony-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: SYMFONY_REQUIRE: ${{ matrix.symfony-version }} @@ -20,11 +20,11 @@ jobs: - '8.3' symfony-version: - '6.4.*' - - '7.0.*' + - '7.3.*' steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -39,7 +39,7 @@ jobs: composer global require --no-progress --no-scripts --no-plugins symfony/flex - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Setup Git run: | @@ -51,5 +51,5 @@ jobs: run: vendor/bin/phpunit --coverage-clover=coverage.xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 if: matrix.php-version == '8.2' && matrix.symfony-version == '6.4.*' diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 995a3ed..bebd647 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,16 +9,16 @@ on: jobs: phpstan: name: PHPStan (PHP ${{ matrix.php-version }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: php-version: - - '8.3' + - '8.4' steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -28,10 +28,10 @@ jobs: tools: cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Install Composer dependencies for PHPStan - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 with: composer-options: '--working-dir=tools/phpstan' diff --git a/phpstan.neon b/phpstan.neon index 8167602..e0270ce 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,3 +6,4 @@ parameters: - src - tests level: 7 + treatPhpDocTypesAsCertain: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7ed63a4..167d108 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,11 @@ diff --git a/src/Command.php b/src/Command.php index a31ba57..28a1ac5 100644 --- a/src/Command.php +++ b/src/Command.php @@ -21,7 +21,7 @@ public function __construct( public function run(): string { - $commandToRun = sprintf('cd %s && %s', escapeshellarg($this->directory), $this->commandString); + $commandToRun = \sprintf('cd %s && %s', escapeshellarg($this->directory), $this->commandString); if ($this->debug) { echo $commandToRun . "\n"; @@ -40,7 +40,7 @@ public function run(): string // it's ok } else { $exitCode = $process->getExitCode() ?? 255; - throw new GitRuntimeException(sprintf('Command %s failed with code %s: %s', $commandToRun, $exitCode, $process->getErrorOutput()), $exitCode); + throw new GitRuntimeException(\sprintf('Command %s failed with code %s: %s', $commandToRun, $exitCode, $process->getErrorOutput()), $exitCode); } } diff --git a/src/Configuration.php b/src/Configuration.php index f5a088b..c47231a 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -38,13 +38,13 @@ public function get(string $configOption, mixed $fallback = null): mixed public function set(string $configOption, mixed $configValue): void { - $this->repository->git(sprintf('config --local %s %s', $configOption, $configValue)); + $this->repository->git(\sprintf('config --local %s %s', $configOption, $configValue)); unset($this->configuration[$configOption]); } public function remove(string $configOption): void { - $this->repository->git(sprintf('config --local --unset %s', $configOption)); + $this->repository->git(\sprintf('config --local --unset %s', $configOption)); unset($this->configuration[$configOption]); } } diff --git a/src/Repository.php b/src/Repository.php index 73830c0..63c426c 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -39,7 +39,7 @@ public function __construct( */ public function getDifferenceBetweenBranches(string $targetBranch, string $sourceBranch): array { - $output = $this->git(sprintf('log %s..%s --date=%s --format=format:%s', $targetBranch, $sourceBranch, self::DATE_FORMAT, self::LOG_FORMAT)); + $output = $this->git(\sprintf('log %s..%s --date=%s --format=format:%s', $targetBranch, $sourceBranch, self::DATE_FORMAT, self::LOG_FORMAT)); return $this->parseLogsIntoArray($output); } @@ -126,7 +126,7 @@ public function getTags(): array */ public function getCommits(int $nbCommits = 10): array { - $output = $this->git(sprintf('log -n %d --date=%s --format=format:%s', $nbCommits, self::DATE_FORMAT, self::LOG_FORMAT)); + $output = $this->git(\sprintf('log -n %d --date=%s --format=format:%s', $nbCommits, self::DATE_FORMAT, self::LOG_FORMAT)); return $this->parseLogsIntoArray($output); } @@ -136,7 +136,7 @@ public function getCommits(int $nbCommits = 10): array */ public function getLastCommit(): array { - $output = $this->git(sprintf('log -n 1 --date=%s --format=format:%s', self::DATE_FORMAT, self::LOG_FORMAT)); + $output = $this->git(\sprintf('log -n 1 --date=%s --format=format:%s', self::DATE_FORMAT, self::LOG_FORMAT)); return $this->parseLogsIntoArray($output)[0]; } @@ -174,7 +174,7 @@ public function getDirectory(): string public static function createCommand(string $commandClass, string $directory, string $commandString, bool $debug): object { if (!\in_array(CommandInterface::class, class_implements($commandClass), true)) { - throw new \RuntimeException(sprintf('The Command class must implement the "%s" interface, the "%s" class does not.', CommandInterface::class, $commandClass)); + throw new \RuntimeException(\sprintf('The Command class must implement the "%s" interface, the "%s" class does not.', CommandInterface::class, $commandClass)); } return new $commandClass($directory, $commandString, $debug); diff --git a/tests/RepositoryTest.php b/tests/RepositoryTest.php index 3bbedec..51fa124 100644 --- a/tests/RepositoryTest.php +++ b/tests/RepositoryTest.php @@ -73,7 +73,6 @@ public function testCommittingSucceeds(): void $repository->git('rm README.md'); $repository->git('commit -m "Remove README.md"'); $logs = $repository->getCommits(7); - self::assertIsArray($logs); self::assertCount(2, $logs); $config = $repository->getConfiguration(); @@ -115,7 +114,6 @@ public function testGetLastCommitReturnsLastCommit(): void $repository->git('rm README.md'); $repository->git('commit -m "Remove README.md"'); $lastCommit = $repository->getLastCommit(); - self::assertIsArray($lastCommit); self::assertArrayHasKey('id', $lastCommit); self::assertArrayHasKey('author', $lastCommit); self::assertArrayHasKey('committed_date', $lastCommit); diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json index 7dee8d6..539dccb 100644 --- a/tools/php-cs-fixer/composer.json +++ b/tools/php-cs-fixer/composer.json @@ -1,5 +1,5 @@ { - "require": { - "friendsofphp/php-cs-fixer": "^3.22.0" - } + "require": { + "friendsofphp/php-cs-fixer": "^3.86.0" + } } diff --git a/tools/phpstan/composer.json b/tools/phpstan/composer.json index 84c8545..9010378 100644 --- a/tools/phpstan/composer.json +++ b/tools/phpstan/composer.json @@ -1,5 +1,5 @@ { "require": { - "phpstan/phpstan": "^1.10.26" + "phpstan/phpstan": "^2.1.22" } }