Skip to content

Commit

Permalink
Update dependencies (#181)
Browse files Browse the repository at this point in the history
* update dependencies, fix tests

* fix tests

* fix tests

* fix tests

* fix tests

Co-authored-by: Artjoms Suharevs <[email protected]>
  • Loading branch information
imunhatep and Artjoms Suharevs authored Apr 8, 2022
1 parent 2af905e commit c59d4fa
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ jobs:
strategy:
matrix:
php:
- "7.3"
- "7.4"
- "8.0"
symfony:
- 3.*
- 4.*
- 5.*
- 6.*
dependency-version:
# - prefer-lowest
- prefer-stable
exclude:
- {php: "8.0", symfony: "3.*"}
- {php: "7.4", symfony: "6.*"}

name: PHP ${{ matrix.php }} - S ${{ matrix.symfony }} - ${{ matrix.dependency-version }} - tests
steps:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
],
"require": {
"php": ">=7.2.0",
"symfony/process": "~3.4|~4.0|~5.0",
"symfony/filesystem": "~3.4|~4.0|~5.0",
"symfony/finder": "~3.4|~4.0|~5.0",
"symfony/process": ">=3.4",
"symfony/filesystem": ">=3.4",
"symfony/finder": ">=3.4",
"phpcollection/phpcollection": "~0.4|~0.5"
},
"require-dev": {
Expand Down
30 changes: 9 additions & 21 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@

use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
// $services->set(ArraySyntaxFixer::class)->call('configure', [
// 'syntax' => 'short'
// ]);

// $services->set(LineLengthFixer::class)->call('configure', [
// "max_line_length" => 100,
// "break_long_lines" => true, # default: true
// "inline_short_lines" => false # default: true
// ]);

$parameters = $containerConfigurator->parameters();

$parameters->set(Option::SETS, [
SetList::CLEAN_CODE,
SetList::PSR_12
]);

$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);

$parameters->set(Option::SKIP, ['Unused variable $deleted.' => ['src/GitElephant/Objects/Diff/DiffChunk.php'], 'Unused variable $new.' => ['src/GitElephant/Objects/Diff/DiffChunk.php']]);
};
// A. full sets
$containerConfigurator->import(SetList::PSR_12);

// B. standalone rule
$services = $containerConfigurator->services();
$services->set(ArraySyntaxFixer::class)
->call('configure', [[ 'syntax' => 'short', ]]);
};
6 changes: 4 additions & 2 deletions src/GitElephant/Objects/Diff/DiffChunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,17 @@ private function getLinesNumbers(string $line): void
$this->originStartLine = $matches[1];
$this->originEndLine = $matches[1];
} else {
[$this->originStartLine, $this->originEndLine] = explode(',', $matches[1]);
$this->originStartLine = (int) explode(',', $matches[1])[0];
$this->originEndLine = (int) explode(',', $matches[1])[1];
}

if (!strpos($matches[2], ',')) {
// one line
$this->destStartLine = $matches[2];
$this->destEndLine = $matches[2];
} else {
[$this->destStartLine, $this->destEndLine] = explode(',', $matches[2]);
$this->destStartLine = (int) explode(',', $matches[2])[0];
$this->destEndLine = (int) explode(',', $matches[2])[1];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/GitElephant/Objects/LogRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function parseOutputLines(array $outputLines): void
$commitLines[] = $line;
}

if (null !== $commitLines && count($commitLines) > 0) {
if (is_array($commitLines) && count($commitLines) !== 0) {
$this->rangeCommits[] = Commit::createFromOutputLines($this->getRepository(), $commitLines);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/GitElephant/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function tearDown(): void
array_map(function (Repository $repo) use ($fs) {
$fs->remove($repo->getPath());
}, $this->repository);
} else {
} elseif ($this->path) {
$fs->remove($this->path);
}
m::close();
Expand Down

0 comments on commit c59d4fa

Please sign in to comment.