From 82ef76508feab9a1a774737f9b163d3c50707780 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 12 Apr 2025 17:30:26 +0200 Subject: [PATCH 1/5] chore: drop PHP <7.4, move to GitHub Actions --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++++++++++++ .travis.yml | 62 ---------------------------------------- 2 files changed, 51 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6dfa161 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + - pull_request + - push + +jobs: + tests: + name: "PHP ${{matrix.php}}" + runs-on: "ubuntu-24.04" + strategy: + fail-fast: false + matrix: + include: + - php: "7.4" + COMPOSER_FLAGS: "--ignore-platform-reqs --prefer-stable --prefer-lowest" + - php: "8.0" + - php: "8.1" + - php: "8.2" + - php: "8.3" + steps: + - name: Checkout source + uses: actions/checkout@v4 + - name: PHP setup + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, log_errors_max_len=0 + - name: "Update composer dependencies" + run: composer update -o --no-interaction --no-progress ${{ matrix.COMPOSER_FLAGS }} + - name: Tests + env: + PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.PHP_CS_FIXER_IGNORE_ENV }} + run: vendor/bin/phpunit + sca: + name: Static Code Analysis + runs-on: 'ubuntu-24.04' + env: + php-version: '7.1' + steps: + - name: Checkout source + uses: actions/checkout@v4 + - name: PHP setup + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, log_errors_max_len=0 + - name: "Update composer dependencies" + run: composer update -o --no-interaction --no-progress ${{ matrix.COMPOSER_FLAGS }} + - name: "composer-require-checker" + run: vendor/bin/composer-require-checker check composer.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index aadd63a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -language: php - -git: - depth: 1 - -cache: - directories: - - $HOME/.composer - -env: - global: - - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress" - - COMPOSER_FLAGS="" - -before_install: - # turn off XDebug - - phpenv config-rm xdebug.ini || return 0 - - # Composer: boost installation - - composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo - -jobs: - include: - - - stage: Static Code Analysis - php: 7.1 - install: - - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS - - composer info -D | sort - script: - - ./vendor/bin/php-cs-fixer fix -v --dry-run - - ./vendor/bin/composer-require-checker check composer.json - - - &STANDARD_TEST_JOB - stage: Test - php: 7.2 - install: - - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS - - composer info -D | sort - script: - - vendor/bin/phpunit || travis_terminate 1 - - - - <<: *STANDARD_TEST_JOB - stage: Test - php: 7.1 - env: COMPOSER_FLAGS="--ignore-platform-reqs --prefer-stable --prefer-lowest" - - - - <<: *STANDARD_TEST_JOB - stage: Test - php: 7.3 - - - - <<: *STANDARD_TEST_JOB - stage: Test - php: 7.4 - - - - <<: *STANDARD_TEST_JOB - stage: Test - php: 8.0 From ac901f83c7563b9215cd5a7ab028aada0fc5a655 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 12 Apr 2025 17:45:07 +0200 Subject: [PATCH 2/5] chore: allow PHP 8.4 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dfa161..d104683 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - php: "8.1" - php: "8.2" - php: "8.3" + - php: "8.4" steps: - name: Checkout source uses: actions/checkout@v4 From 570231717853cac6a7188761dbe5b892ebd31a7d Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 12 Apr 2025 17:46:40 +0200 Subject: [PATCH 3/5] upgrade deps, drop symfony/phpunit-bridge --- .github/workflows/ci.yml | 2 ++ composer.json | 11 +++++------ src/CommandExecutor.php | 2 +- src/ExecutionException.php | 2 +- src/ScriptExecutor.php | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d104683..7303700 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,3 +50,5 @@ jobs: run: composer update -o --no-interaction --no-progress ${{ matrix.COMPOSER_FLAGS }} - name: "composer-require-checker" run: vendor/bin/composer-require-checker check composer.json + - name: "PHP CS Fixer" + run: vendor/bin/php-cs-fixer check -v \ No newline at end of file diff --git a/composer.json b/composer.json index b98f135..3e29629 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,13 @@ } ], "require": { - "php": "^7.1.3 || ^8.0", - "symfony/process": "^4.4 || ^5 || ^6 || ^7" + "php": "^7.4 || ^8.0", + "symfony/process": "^5.4 || ^6.4 || ^7.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.1", - "maglnet/composer-require-checker": "^2 || ^3", - "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5", - "symfony/phpunit-bridge": "^5.3.7 || ^6 || ^7" + "friendsofphp/php-cs-fixer": "^3.72", + "maglnet/composer-require-checker": "^4.15.0", + "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12" }, "config": { "optimize-autoloader": true, diff --git a/src/CommandExecutor.php b/src/CommandExecutor.php index 6c48a7e..f3774ee 100644 --- a/src/CommandExecutor.php +++ b/src/CommandExecutor.php @@ -72,7 +72,7 @@ public function getResult(bool $checkCode = true): CliResult if ($checkCode && 0 !== $this->result->getCode()) { throw new ExecutionException( $this->result, - sprintf( + \sprintf( "Cannot execute `%s`:\nCode: %s\nExit text: %s\nError output: %s\nDetails:\n%s", $process->getCommandLine(), $this->result->getCode(), diff --git a/src/ExecutionException.php b/src/ExecutionException.php index 64517e8..89a941b 100644 --- a/src/ExecutionException.php +++ b/src/ExecutionException.php @@ -20,7 +20,7 @@ final class ExecutionException extends \RuntimeException */ private $result; - public function __construct(CliResult $result, $message = '', $code = 0, \Exception $previous = null) + public function __construct(CliResult $result, $message = '', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/ScriptExecutor.php b/src/ScriptExecutor.php index 36c873b..8ecdd0f 100644 --- a/src/ScriptExecutor.php +++ b/src/ScriptExecutor.php @@ -51,7 +51,7 @@ final class ScriptExecutor * @param string[] $scriptParts * @param ?string[] $scriptInit */ - public function __construct(array $scriptParts, string $cwd, array $scriptInit = null) + public function __construct(array $scriptParts, string $cwd, ?array $scriptInit = null) { $this->scriptParts = $scriptParts; $this->cwd = $cwd; @@ -69,7 +69,7 @@ public function __destruct() * @param string[] $scriptParts * @param ?string[] $scriptInit */ - public static function create(array $scriptParts, string $cwd, array $scriptInit = null): self + public static function create(array $scriptParts, string $cwd, ?array $scriptInit = null): self { return new self($scriptParts, $cwd, $scriptInit); } @@ -100,7 +100,7 @@ public function getResult(bool $checkCode = true): CliResult if ($checkCode && 0 !== $this->result->getCode()) { throw new ExecutionException( $this->result, - sprintf( + \sprintf( "Cannot execute `%s`:\n%s\nCode: %s\nExit text: %s\nError output: %s\nDetails:\n%s", $command, implode("\n", array_map(static function ($line) { return "$ {$line}"; }, $tmpFileLines)), From cb75f951db743160b0ab43b88318d8c158f2289e Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 12 Apr 2025 18:02:32 +0200 Subject: [PATCH 4/5] update libs --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3e29629..e364f4e 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ "symfony/process": "^5.4 || ^6.4 || ^7.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.72", - "maglnet/composer-require-checker": "^4.15.0", + "friendsofphp/php-cs-fixer": "^3.75", + "maglnet/composer-require-checker": "^3.8 || ^4", "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12" }, "config": { From 3e8cad51a814959989f764799f40277c09eb856a Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 12 Apr 2025 18:03:37 +0200 Subject: [PATCH 5/5] remove SymfonyTestsListener usage --- phpunit.xml.dist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7b2405b..4612095 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,10 +16,6 @@ - - - - ./src