Skip to content
Closed
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
33 changes: 16 additions & 17 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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-

Expand Down Expand Up @@ -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"
Expand All @@ -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."


Expand All @@ -326,8 +322,11 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions bin/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 4 additions & 4 deletions bin/churn
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions box.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
{
"name": "*.php",
"in": "vendor"
},
{
"in": "vendor/symfony/console/Resources"
}
],
"output": "churn.phar"
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -86,7 +86,7 @@
"phpcs",
"phpcs --standard=phpcs-tests.xml",
"psalm",
"phpstan"
"phpstan --memory-limit=-1"
]
}
}
2 changes: 1 addition & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<license type="MIT" url="https://github.com/bmitch/churn-php/blob/master/LICENSE.md"/>
</copyright>
<requires>
<php version="^7.1 || ^8.0">
<php version="^8.1">
<ext name="json"/>
<ext name="tokenizer"/>
</php>
Expand Down
2 changes: 1 addition & 1 deletion phpcs-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</rule>

<!-- PHPCompatibility -->
<config name="testVersion" value="7.1-"/>
<config name="testVersion" value="8.1-"/>
<rule ref="PHPCompatibility"/>

<!-- Dock Blocks -->
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Process/ChangesCount/FossilChangesCountProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
17 changes: 12 additions & 5 deletions tests/EndToEnd/FossilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
17 changes: 12 additions & 5 deletions tests/EndToEnd/MercurialTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
17 changes: 12 additions & 5 deletions tests/EndToEnd/SubversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
17 changes: 12 additions & 5 deletions tests/Integration/Command/AssessComplexityCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
17 changes: 12 additions & 5 deletions tests/Integration/Command/RunCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 4 additions & 2 deletions tests/Integration/File/FileFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading