Upgraded to Symfony 6.3 and PHP 8.2.

This commit is contained in:
Klaus Silveira
2023-11-16 22:20:26 -05:00
parent dd98962de9
commit ea0d763394
18 changed files with 1167 additions and 1198 deletions

View File

@@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
php: [8.1]
php: [8.1, 8.2]
steps:
- uses: actions/checkout@v2

View File

@@ -8,34 +8,11 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
return $config->setRules([
'@Symfony' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'phpdoc_align' => false,
'phpdoc_order' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'return_assignment' => true,
'single_blank_line_at_eof' => true,
'single_line_comment_style' => true,
'ternary_to_null_coalescing' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'void_return' => true,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => false,
'import_functions' => false,
],
])
->setRiskyAllowed(true)
->setFinder($finder)

View File

@@ -5,32 +5,32 @@
"type": "project",
"license": "BSD-3-Clause",
"require": {
"php": "^8.1",
"php": ">=8.1",
"ext-iconv": "*",
"ext-mbstring": "*",
"league/commonmark": "^2.1",
"nesbot/carbon": "^2.55",
"symfony/asset": "^6.0",
"symfony/cache": "^6.0",
"symfony/console": "^6.0",
"symfony/form": "^6.0",
"symfony/framework-bundle": "^6.0",
"symfony/monolog-bundle": "^3.5",
"symfony/process": "^6.0",
"symfony/string": "^6.0",
"symfony/templating": "^6.0",
"symfony/translation": "^6.0",
"symfony/twig-bundle": "^6.0",
"symfony/webpack-encore-bundle": "^1.13",
"symfony/yaml": "^6.0"
"league/commonmark": "^2.4",
"nesbot/carbon": "^2.71",
"symfony/asset": "^6.3",
"symfony/cache": "^6.3",
"symfony/console": "^6.3",
"symfony/form": "^6.3",
"symfony/framework-bundle": "^6.3",
"symfony/monolog-bundle": "^3.10",
"symfony/process": "^6.3",
"symfony/string": "^6.3",
"symfony/templating": "^6.3",
"symfony/translation": "^6.3",
"symfony/twig-bundle": "^6.3",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "^6.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
"friendsofphp/php-cs-fixer": "^3.38",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^9.5",
"symfony/debug-bundle": "^6.0",
"symfony/dotenv": "^6.0"
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"symfony/debug-bundle": "^6.3",
"symfony/dotenv": "^6.3"
},
"config": {
"preferred-install": {

2167
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
FROM php:8.1-fpm-alpine
FROM php:8.2-fpm-alpine
ENV PHP_EXT_DEPS \
gettext=gettext-dev \
@@ -11,6 +11,7 @@ ENV PHP_EXT_DEPS \
RUN set -x; \
apk add --no-cache --virtual .php-extensions-build-dependencies \
$PHPIZE_DEPS \
linux-headers \
$(echo ${PHP_EXT_DEPS} | tr ' ' '\n' | cut -d = -f 2) \
&& apk add --no-cache \
$(echo ${PHP_EXT_DEPS} | tr ' ' '\n' | cut -d = -f 1) \

View File

@@ -58,7 +58,7 @@ class RepositoryExtension extends AbstractExtension
{
$parent = dirname($path);
if ($parent == '.') {
if ('.' == $parent) {
return '';
}
@@ -72,7 +72,7 @@ class RepositoryExtension extends AbstractExtension
$previousPart = '';
foreach ($parts as $index => $part) {
$previousPart .= ($index == 0 ? '' : '/') . $part;
$previousPart .= (0 == $index ? '' : '/').$part;
$breadcrumbs[] = [
'name' => $part,
'commitish' => $this->getCommitish($blob->getHash(), $previousPart),

View File

@@ -66,7 +66,7 @@ class Kernel extends BaseKernel
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/routes.yml');
if ($this->environment == 'dev') {
if ('dev' == $this->environment) {
$routes->import($confDir.'/dev/routes.yml');
}
}

View File

@@ -47,7 +47,7 @@ class Repository
return $this->system->getTags($this->repository);
}
public function getTree(?string $commitish = null): Tree
public function getTree(string $commitish = null): Tree
{
if (!$commitish) {
return $this->system->getTree($this->repository);
@@ -62,7 +62,7 @@ class Repository
return $this->system->getTree($this->repository, $commitish->getHash());
}
public function getCommit(?string $commitish = null): Commit
public function getCommit(string $commitish = null): Commit
{
if (!$commitish) {
return $this->system->getCommit($this->repository);
@@ -129,7 +129,7 @@ class Repository
}
}
public function searchCommits(Criteria $criteria, ?string $commitish = null): array
public function searchCommits(Criteria $criteria, string $commitish = null): array
{
if (!$commitish) {
return $this->system->searchCommits($this->repository, $criteria);

View File

@@ -24,7 +24,7 @@ class Commitish
$this->hash = $rev->getName();
$revSuffix = substr($commitish, strlen($this->hash));
if ($revSuffix && ($revSuffix[0] === '@' || $revSuffix[0] === '^' || $revSuffix[0] === '~')) {
if ($revSuffix && ('@' === $revSuffix[0] || '^' === $revSuffix[0] || '~' === $revSuffix[0])) {
$this->hash .= strtok($revSuffix, '/');
}
}

View File

@@ -40,7 +40,7 @@ class Blob extends Item
{
$fileName = strtolower($this->getFileName());
return $fileName == 'readme.md' || $fileName == 'readme.txt';
return 'readme.md' == $fileName || 'readme.txt' == $fileName;
}
public function getSize(): ?int

View File

@@ -128,7 +128,7 @@ class Parse
$this->currentHunk->addLine(new Line($line, Line::TYPE_DELETE, $oldNumber, $newNumber));
$this->currentFile->increaseDeletions();
$this->deletedLines++;
++$this->deletedLines;
}
protected function addedLine(string $line, array $context): void
@@ -138,7 +138,7 @@ class Parse
$this->currentHunk->addLine(new Line($line, Line::TYPE_ADD, $oldNumber, $newNumber));
$this->currentFile->increaseAdditions();
$this->addedLines++;
++$this->addedLines;
}
protected function line(string $line): void
@@ -151,8 +151,8 @@ class Parse
$newNumber = $this->newCounter + $this->addedLines;
$this->currentHunk->addLine(new Line($line, Line::TYPE_NO_CHANGE, $oldNumber, $newNumber));
$this->oldCounter++;
$this->newCounter++;
++$this->oldCounter;
++$this->newCounter;
}
protected function clearAccumulator(): void

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace GitList\SCM\Exception;
class InvalidCommitException extends \RuntimeException
use RuntimeException;
class InvalidCommitException extends RuntimeException
{
}

View File

@@ -18,17 +18,17 @@ interface System
public function getTags(Repository $repository): array;
public function getTree(Repository $repository, ?string $hash = null): Tree;
public function getTree(Repository $repository, string $hash = null): Tree;
public function getRecursiveTree(Repository $repository, ?string $hash = null): Tree;
public function getRecursiveTree(Repository $repository, string $hash = null): Tree;
public function getPathTree(Repository $repository, string $path, ?string $hash = null): Tree;
public function getPathTree(Repository $repository, string $path, string $hash = null): Tree;
public function getCommit(Repository $repository, ?string $hash = null): Commit;
public function getCommit(Repository $repository, string $hash = null): Commit;
public function getCommits(Repository $repository, ?string $hash = null, int $page = 1, int $perPage = 10): array;
public function getCommits(Repository $repository, string $hash = null, int $page = 1, int $perPage = 10): array;
public function getCommitsFromPath(Repository $repository, string $path, ?string $hash = null, int $page = 1, int $perPage = 10): array;
public function getCommitsFromPath(Repository $repository, string $path, string $hash = null, int $page = 1, int $perPage = 10): array;
public function getSpecificCommits(Repository $repository, array $hashes): array;
@@ -36,7 +36,7 @@ interface System
public function getBlob(Repository $repository, string $hash, string $path): Blob;
public function searchCommits(Repository $repository, Criteria $criteria, ?string $hash = null): array;
public function searchCommits(Repository $repository, Criteria $criteria, string $hash = null): array;
public function archive(Repository $repository, string $format, string $hash, string $path): string;
}

View File

@@ -330,12 +330,12 @@ class CommandLine implements System
$file = preg_split('/[\s]+/', $line, 5);
if ($file[1] == 'commit') {
if ('commit' == $file[1]) {
// Don't handle submodules yet
continue;
}
if ($file[0] == '120000') {
if ('120000' == $file[0]) {
$symlinkTarget = $this->run(['show', $file[2]], $repository);
$symlink = new Symlink($repository, $file[2]);
$symlink->setMode($file[0]);
@@ -347,7 +347,7 @@ class CommandLine implements System
continue;
}
if ($file[1] == 'blob') {
if ('blob' == $file[1]) {
$blob = new Blob($repository, $file[2]);
$blob->setMode($file[0]);
$blob->setName($file[4]);
@@ -396,7 +396,7 @@ class CommandLine implements System
{
$xmlStart = strpos($input, '<item>');
if ($xmlStart === false) {
if (false === $xmlStart) {
throw new InvalidCommitException($input);
}
@@ -429,10 +429,10 @@ class CommandLine implements System
$commit->setCommitedAt(new CarbonImmutable((string) $item->commiter_date));
$signatureStatus = (string) $item->valid_signature;
if ($signatureStatus != 'N') {
if ('N' != $signatureStatus) {
$signature = new Signature((string) $item->signer, (string) $item->signer_key);
if ($signatureStatus == 'B') {
if ('B' == $signatureStatus) {
$signature->validate();
}

View File

@@ -47,7 +47,7 @@ class CommandLine implements System
{
$path = $repository->getPath();
return file_exists($path) && (file_exists($path . '/.hg'));
return file_exists($path) && file_exists($path.'/.hg');
}
public function getDescription(Repository $repository): string
@@ -357,11 +357,11 @@ class CommandLine implements System
$file = preg_split('/[\s]+/', $line, 4);
if ($file[2] == '.hgtags') {
if ('.hgtags' == $file[2]) {
continue;
}
if ($file[2] == '@') {
if ('@' == $file[2]) {
$symlinkTarget = $this->run(['cat', '-r', $hash, $file[3]], $repository);
$symlink = new Symlink($repository, $file[0]);
$symlink->setMode($file[1]);