Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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.*'
10 changes: 5 additions & 5 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ parameters:
- src
- tests
level: 7
treatPhpDocTypesAsCertain: false
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
displayDetailsOnPhpunitDeprecations="true"
colors="true"
failOnRisky="true"
failOnWarning="true">
Expand Down
4 changes: 2 additions & 2 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
8 changes: 4 additions & 4 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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];
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions tests/RepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions tools/php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.22.0"
}
"require": {
"friendsofphp/php-cs-fixer": "^3.86.0"
}
}
2 changes: 1 addition & 1 deletion tools/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"phpstan/phpstan": "^1.10.26"
"phpstan/phpstan": "^2.1.22"
}
}