diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 7d81158..ba3e278 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -22,15 +22,11 @@ jobs:
strategy:
matrix:
php-version:
- - "7.1"
- - "7.2"
- - "7.3"
- - "7.4"
- - "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
+ - "8.5"
os:
- ubuntu-latest
- windows-latest
@@ -98,7 +94,7 @@ jobs:
with:
coverage: "none"
ini-values: "error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1"
- php-version: "8.1"
+ php-version: "8.5"
tools: composer:v2
- uses: "ramsey/composer-install@v2"
@@ -135,7 +131,7 @@ jobs:
with:
coverage: "pcov"
ini-values: "error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1"
- php-version: "8.1"
+ php-version: "8.5"
tools: composer:v2
- uses: "ramsey/composer-install@v2"
@@ -182,7 +178,7 @@ jobs:
with:
coverage: "none"
ini-values: "error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1"
- php-version: "8.1"
+ php-version: "8.5"
tools: composer:v2, composer-normalize, composer-require-checker
- name: "Validate composer.json"
@@ -251,9 +247,9 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
- key: composer-${{ runner.os }}-7.1-${{ hashFiles('composer.*') }}
+ key: composer-${{ runner.os }}-8.1-${{ hashFiles('composer.*') }}
restore-keys: |
- composer-${{ runner.os }}-7.1-
+ composer-${{ runner.os }}-8.1-
composer-${{ runner.os }}-
composer-
@@ -286,11 +282,11 @@ jobs:
strategy:
matrix:
php-version:
- - "7.0"
- - "5.6"
- - "5.5"
- - "5.4"
- - "5.3"
+ - "7.1"
+ - "7.2"
+ - "7.3"
+ - "7.4"
+ - "8.0"
steps:
- name: "Install PHP"
@@ -313,7 +309,7 @@ jobs:
run: |
php -r "passthru('./churn.phar', \$code); if (\$code !== 1) exit('Invalid error code. Expected 1, got ' . \$code);" &> error
echo "Error code is OK. Now testing error message..."
- grep 'The application requires the version ">=7.1.3" or greater' error
+ grep 'The application requires the version ">=8.1.33" or greater' error
echo "Everything is OK."
@@ -326,8 +322,11 @@ jobs:
strategy:
matrix:
php-version:
- - "7.1"
- "8.1"
+ - "8.2"
+ - "8.3"
+ - "8.4"
+ - "8.5"
steps:
- name: "Checkout"
diff --git a/Makefile b/Makefile
index 701826f..ce81099 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ box:
build: ## Build churn.phar
build: box
scp -r src bin composer.json box.json.dist manifest.xml LICENSE.md build/
- $(COMPOSER_BIN) config platform.php 7.1.3 --working-dir=build/
+ $(COMPOSER_BIN) config platform.php 8.1.33 --working-dir=build/
$(COMPOSER_BIN) update --no-dev --no-interaction --prefer-dist --working-dir=build/
CHURN_VERSION=$$( $(PHP_BIN) build/bin/churn --version --no-ansi | grep -Po '(?<= )[^@]+' ) ;\
sed -i -e "s@0.0.0-dev@$${CHURN_VERSION}@g" build/manifest.xml
diff --git a/bin/app.php b/bin/app.php
index 25c3c54..d86e4ca 100644
--- a/bin/app.php
+++ b/bin/app.php
@@ -16,8 +16,11 @@
return $version;
})('bmitch/churn-php'));
-$application->add(AssessComplexityCommand::newInstance());
-$application->add($run = RunCommand::newInstance());
+$method = method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+$application->{$method}(AssessComplexityCommand::newInstance());
+$application->{$method}($run = RunCommand::newInstance());
$application->setDefaultCommand($run->getName());
return $application;
diff --git a/bin/churn b/bin/churn
index 21fba1a..aa7f012 100755
--- a/bin/churn
+++ b/bin/churn
@@ -12,21 +12,21 @@ if (!version_compare(PHP_VERSION, PHP_VERSION, '=')) {
)
);
- die(1);
+ exit(1);
}
-if (version_compare('7.1.3', PHP_VERSION, '>=')) {
+if (version_compare(PHP_VERSION, '8.1.33', '<')) {
fwrite(
STDERR,
sprintf(
- 'The application requires the version ">=7.1.3" or greater.' . PHP_EOL .
+ 'The application requires the version ">=8.1.33" or greater.' . PHP_EOL .
'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION,
PHP_BINARY
)
);
- die(1);
+ exit(1);
}
require_once __DIR__ . '/bootstrap.php';
diff --git a/box.json.dist b/box.json.dist
index 14ebec6..2c8ea6d 100644
--- a/box.json.dist
+++ b/box.json.dist
@@ -18,6 +18,9 @@
{
"name": "*.php",
"in": "vendor"
+ },
+ {
+ "in": "vendor/symfony/console/Resources"
}
],
"output": "churn.phar"
diff --git a/composer.json b/composer.json
index 6c7d076..56c266b 100644
--- a/composer.json
+++ b/composer.json
@@ -22,11 +22,11 @@
],
"homepage": "https://github.com/bmitch/churn-php",
"require": {
- "php": ">=7.1.3",
+ "php": ">=8.1.33",
"ext-json": "*",
"ext-tokenizer": "*",
"composer-runtime-api": "^2",
- "symfony/console": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
+ "symfony/console": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0",
"symfony/filesystem": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/process": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
@@ -86,7 +86,7 @@
"phpcs",
"phpcs --standard=phpcs-tests.xml",
"psalm",
- "phpstan"
+ "phpstan --memory-limit=-1"
]
}
}
diff --git a/manifest.xml b/manifest.xml
index f497780..5da0798 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/phpcs-tests.xml b/phpcs-tests.xml
index 0d1ea2d..af81584 100644
--- a/phpcs-tests.xml
+++ b/phpcs-tests.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/phpstan.neon b/phpstan.neon
index f80b591..935853f 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -12,6 +12,8 @@ parameters:
reportUnmatchedIgnoredErrors: true
ignoreErrors:
- '/^Casting to .+ something that''s already/'
+ - "#Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Application and 'addCommand' will always evaluate to true#"
+ - "#Variable method call on Symfony\\\\Component\\\\Console\\\\Application#"
checkTooWideReturnTypesInProtectedAndPublicMethods: true
checkUninitializedProperties: true
diff --git a/src/Process/ChangesCount/FossilChangesCountProcess.php b/src/Process/ChangesCount/FossilChangesCountProcess.php
index 9fd4a86..8a6f55f 100644
--- a/src/Process/ChangesCount/FossilChangesCountProcess.php
+++ b/src/Process/ChangesCount/FossilChangesCountProcess.php
@@ -24,7 +24,7 @@ public function __construct(File $file, string $dateSince)
{
$process = new Process([
'fossil', 'timeline', '-t', 'ci',
- '-W', '0', '-n', '0', 'after', $dateSince,
+ '-W', '0', 'after', $dateSince,
'-p', $file->getFullPath(),
], \dirname($file->getFullPath()));
diff --git a/tests/EndToEnd/FossilTest.php b/tests/EndToEnd/FossilTest.php
index 54eef6d..5afbd96 100644
--- a/tests/EndToEnd/FossilTest.php
+++ b/tests/EndToEnd/FossilTest.php
@@ -16,21 +16,28 @@ final class FossilTest extends BaseTestCase
*/
private $commandTester;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
- $application->add(RunCommand::newInstance());
+ $method = \method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+ $application->{$method}(RunCommand::newInstance());
$command = $application->find('run');
$this->commandTester = new CommandTester($command);
}
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/EndToEnd/MercurialTest.php b/tests/EndToEnd/MercurialTest.php
index 9c871b3..db85c37 100644
--- a/tests/EndToEnd/MercurialTest.php
+++ b/tests/EndToEnd/MercurialTest.php
@@ -16,21 +16,28 @@ final class MercurialTest extends BaseTestCase
*/
private $commandTester;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
- $application->add(RunCommand::newInstance());
+ $method = \method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+ $application->{$method}(RunCommand::newInstance());
$command = $application->find('run');
$this->commandTester = new CommandTester($command);
}
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/EndToEnd/SubversionTest.php b/tests/EndToEnd/SubversionTest.php
index 490e6b0..2e28a97 100644
--- a/tests/EndToEnd/SubversionTest.php
+++ b/tests/EndToEnd/SubversionTest.php
@@ -16,21 +16,28 @@ final class SubversionTest extends BaseTestCase
*/
private $commandTester;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
- $application->add(RunCommand::newInstance());
+ $method = \method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+ $application->{$method}(RunCommand::newInstance());
$command = $application->find('run');
$this->commandTester = new CommandTester($command);
}
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/Integration/Command/AssessComplexityCommandTest.php b/tests/Integration/Command/AssessComplexityCommandTest.php
index c33506e..ae696ef 100644
--- a/tests/Integration/Command/AssessComplexityCommandTest.php
+++ b/tests/Integration/Command/AssessComplexityCommandTest.php
@@ -16,21 +16,28 @@ final class AssessComplexityCommandTest extends BaseTestCase
*/
private $commandTester;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
- $application->add(AssessComplexityCommand::newInstance());
+ $method = \method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+ $application->{$method}(AssessComplexityCommand::newInstance());
$command = $application->find('assess-complexity');
$this->commandTester = new CommandTester($command);
}
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/Integration/Command/RunCommandTest.php b/tests/Integration/Command/RunCommandTest.php
index 3ae94a5..e95e71a 100644
--- a/tests/Integration/Command/RunCommandTest.php
+++ b/tests/Integration/Command/RunCommandTest.php
@@ -28,21 +28,28 @@ final class RunCommandTest extends BaseTestCase
*/
private $tmpFile;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$application = new Application('churn-php', 'test');
- $application->add(RunCommand::newInstance());
+ $method = \method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+ $application->{$method}(RunCommand::newInstance());
$command = $application->find('run');
$this->commandTester = new CommandTester($command);
}
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/Integration/File/FileFinderTest.php b/tests/Integration/File/FileFinderTest.php
index 413491a..af325b4 100644
--- a/tests/Integration/File/FileFinderTest.php
+++ b/tests/Integration/File/FileFinderTest.php
@@ -15,9 +15,11 @@ final class FileFinderTest extends BaseTestCase
*/
private $fileFinder;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Integration/ManifestTest.php b/tests/Integration/ManifestTest.php
index 45a4908..f6a7cd0 100644
--- a/tests/Integration/ManifestTest.php
+++ b/tests/Integration/ManifestTest.php
@@ -16,9 +16,11 @@ final class ManifestTest extends BaseTestCase
*/
private $manifest;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Configuration/Validator/CommitsSinceTest.php b/tests/Unit/Configuration/Validator/CommitsSinceTest.php
index 1afcc0a..2aaa412 100644
--- a/tests/Unit/Configuration/Validator/CommitsSinceTest.php
+++ b/tests/Unit/Configuration/Validator/CommitsSinceTest.php
@@ -15,9 +15,11 @@ final class CommitsSinceTest extends ValidatorBaseTestCase
*/
private $validator;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Configuration/Validator/ValidatorBaseTestCase.php b/tests/Unit/Configuration/Validator/ValidatorBaseTestCase.php
index fb93309..f085572 100644
--- a/tests/Unit/Configuration/Validator/ValidatorBaseTestCase.php
+++ b/tests/Unit/Configuration/Validator/ValidatorBaseTestCase.php
@@ -43,16 +43,18 @@ abstract public static function provideValidValues(): iterable;
*/
abstract public static function provideInvalidValues(): iterable;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
$this->config = new EditableConfig();
}
- /**
+ /**
* @test
*/
public function it_returns_the_default_value(): void
diff --git a/tests/Unit/File/FileFinderTest.php b/tests/Unit/File/FileFinderTest.php
index 596b543..5b635c5 100644
--- a/tests/Unit/File/FileFinderTest.php
+++ b/tests/Unit/File/FileFinderTest.php
@@ -16,9 +16,11 @@ final class FileFinderTest extends BaseTestCase
*/
protected $fileFinder;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/File/FileHelperTest.php b/tests/Unit/File/FileHelperTest.php
index 53c782c..9cdded3 100644
--- a/tests/Unit/File/FileHelperTest.php
+++ b/tests/Unit/File/FileHelperTest.php
@@ -16,9 +16,11 @@ final class FileHelperTest extends BaseTestCase
*/
private static $filesToDelete = [];
- /** @return void */
+ /**
+ * Test teardown
+ */
#[\Override]
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/Unit/File/FileTest.php b/tests/Unit/File/FileTest.php
index 2a6d863..bd2404f 100644
--- a/tests/Unit/File/FileTest.php
+++ b/tests/Unit/File/FileTest.php
@@ -14,9 +14,11 @@ final class FileTest extends BaseTestCase
**/
private $file;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Process/ChangesCount/NoVcsChangesCountProcessTest.php b/tests/Unit/Process/ChangesCount/NoVcsChangesCountProcessTest.php
index 5256eec..35747b5 100644
--- a/tests/Unit/Process/ChangesCount/NoVcsChangesCountProcessTest.php
+++ b/tests/Unit/Process/ChangesCount/NoVcsChangesCountProcessTest.php
@@ -15,9 +15,11 @@ final class NoVcsChangesCountProcessTest extends BaseTestCase
*/
private $process;
- /** @return void */
+ /**
+ * TEst setup
+ */
#[\Override]
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Process/ConcreteProcessFactoryTest.php b/tests/Unit/Process/ConcreteProcessFactoryTest.php
index 2c224ac..98a78c5 100644
--- a/tests/Unit/Process/ConcreteProcessFactoryTest.php
+++ b/tests/Unit/Process/ConcreteProcessFactoryTest.php
@@ -20,9 +20,11 @@ final class ConcreteProcessFactoryTest extends BaseTestCase
*/
private $processFactory;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Result/ResultTest.php b/tests/Unit/Result/ResultTest.php
index 1c0d4d4..16b406f 100644
--- a/tests/Unit/Result/ResultTest.php
+++ b/tests/Unit/Result/ResultTest.php
@@ -18,9 +18,11 @@ final class ResultTest extends BaseTestCase
*/
protected $result;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/Unit/Result/ResultsRendererFactoryTest.php b/tests/Unit/Result/ResultsRendererFactoryTest.php
index 1af30ac..585e5dd 100644
--- a/tests/Unit/Result/ResultsRendererFactoryTest.php
+++ b/tests/Unit/Result/ResultsRendererFactoryTest.php
@@ -19,9 +19,11 @@ final class ResultsRendererFactoryTest extends BaseTestCase
*/
private $factory;
- /** @return void */
+ /**
+ * Test setup
+ */
#[\Override]
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/console-application.php b/tests/console-application.php
index 13e8cd5..9d5cb5a 100644
--- a/tests/console-application.php
+++ b/tests/console-application.php
@@ -15,7 +15,10 @@
use Symfony\Component\Console\Application;
$application = new Application('churn-php', 'test');
-$application->add(AssessComplexityCommand::newInstance());
-$application->add(RunCommand::newInstance());
+$method = method_exists($application, 'addCommand')
+ ? 'addCommand'
+ : 'add';
+$application->{$method}(AssessComplexityCommand::newInstance());
+$application->{$method}(RunCommand::newInstance());
return $application;
diff --git a/tests/docker/fossil/Dockerfile b/tests/docker/fossil/Dockerfile
index cbe2ab4..756dc42 100644
--- a/tests/docker/fossil/Dockerfile
+++ b/tests/docker/fossil/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:8.1-cli
+FROM php:8.4-cli
# Requirements for running phpunit
RUN apt-get update && apt-get install -y git zip
diff --git a/tests/docker/mercurial/Dockerfile b/tests/docker/mercurial/Dockerfile
index 6eb96f0..3d8d44f 100644
--- a/tests/docker/mercurial/Dockerfile
+++ b/tests/docker/mercurial/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:8.1-cli
+FROM php:8.4-cli
# Requirements for running phpunit
RUN apt-get update && apt-get install -y git zip
diff --git a/tests/docker/subversion/Dockerfile b/tests/docker/subversion/Dockerfile
index 5ec61e2..b00875a 100644
--- a/tests/docker/subversion/Dockerfile
+++ b/tests/docker/subversion/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:8.1-cli
+FROM php:8.4-cli
# Requirements for running phpunit
RUN apt-get update && apt-get install -y git zip