Skip to content

Commit

Permalink
Drop support for PHP 8.1 (#11)
Browse files Browse the repository at this point in the history
* Drop support for PHP 8.1

* Fix CS

* Ignore some phpmd errors
  • Loading branch information
core23 authored May 25, 2024
1 parent 194ba90 commit 97c6f4e
Show file tree
Hide file tree
Showing 17 changed files with 1,429 additions and 908 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"issues": "https://github.com/nucleos/relazy/issues"
},
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"symfony/console": "^6.3",
"symfony/dependency-injection": "^6.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Action/BaseAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getTitle(): string
/**
* Execute a command and render the output through the classical indented output.
*/
final protected function executeCommand(Console $console, string $command, float $timeout = null): Process
final protected function executeCommand(Console $console, string $command, ?float $timeout = null): Process
{
$console->writeLine(sprintf("<comment>%s</comment>\n\n", $command));

Expand Down
3 changes: 3 additions & 0 deletions src/Action/Filesystem/FilesUpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function __construct(array $files)
$this->files = $files;
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function execute(Context $context, Console $console): void
{
$currentVersion = $context->getCurrentVersion();
Expand Down
3 changes: 3 additions & 0 deletions src/Action/Shell/CommandAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public function __construct(string $command, ?bool $suppressOutput = null, ?bool
$this->timeout = $timeout;
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function execute(Context $context, Console $console): void
{
$command = $this->command;
Expand Down
3 changes: 3 additions & 0 deletions src/Action/VersionControl/PublishAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function __construct(
$this->askRemoteName = $askRemoteName ?? false;
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function execute(Context $context, Console $console): void
{
if ($this->askConfirmation) {
Expand Down
3 changes: 3 additions & 0 deletions src/Changelog/Formatter/MarkdownFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ protected function getNewLines(ReleaseType $type, string $version, ?string $comm
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @param string[] $lines
*/
protected function findPositionToInsert(array $lines, ReleaseType $type): int
Expand Down
3 changes: 3 additions & 0 deletions src/Changelog/Formatter/SemanticFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ protected function getNewLines(ReleaseType $type, string $version, ?string $comm
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @param string[] $lines
*
* @throws RelazyException
Expand Down
2 changes: 1 addition & 1 deletion src/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class BaseCommand extends Command

private ?RelazyConfig $config = null;

public function __construct(string $name = null)
public function __construct(?string $name = null)
{
$this->informationCollector = new InteractionCollector();

Expand Down
2 changes: 1 addition & 1 deletion src/Config/RelazyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RelazyConfig
*/
private array $postReleaseActions = [];

public function __construct(VersionControl $vcs = null)
public function __construct(?VersionControl $vcs = null)
{
$this->vcs = $vcs ?? new Noop();
}
Expand Down
4 changes: 1 addition & 3 deletions src/Exception/CommandException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace Nucleos\Relazy\Exception;

class CommandException extends RelazyException
{
}
class CommandException extends RelazyException {}
4 changes: 1 addition & 3 deletions src/Exception/NoReleaseFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@

namespace Nucleos\Relazy\Exception;

class NoReleaseFoundException extends RelazyException
{
}
class NoReleaseFoundException extends RelazyException {}
4 changes: 1 addition & 3 deletions src/Exception/RelazyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

use RuntimeException;

class RelazyException extends RuntimeException
{
}
class RelazyException extends RuntimeException {}
3 changes: 3 additions & 0 deletions src/Interaction/InteractionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public function setValue(mixed $value): void
$this->hasValue = true;
}

/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function validate(mixed $value): mixed
{
switch ($this->type) {
Expand Down
3 changes: 3 additions & 0 deletions src/Output/OutputConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;

/**
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
final class OutputConsole implements Console
{
private FormatterHelper $formatterHelper;
Expand Down
5 changes: 5 additions & 0 deletions src/Version/Generator/SemanticGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public function __construct(?string $label = null, ?bool $allowLabel = null, ?st
$this->type = $type;
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function generateNextVersion(Context $context): string
{
$type = ReleaseType::from($this->type ?? $context->getInformationCollection()->getValue(self::TYPE));
Expand Down
16 changes: 4 additions & 12 deletions src/VersionControl/Noop.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ public function getTags(): array
return [];
}

public function createTag(string $name): void
{
}
public function createTag(string $name): void {}

public function publishTag(string $tagName, ?string $remote = null): void
{
}
public function publishTag(string $tagName, ?string $remote = null): void {}

public function getAllModificationsSince(string $tag, bool $color = true, bool $noMergeCommits = false): array
{
Expand All @@ -46,11 +42,7 @@ public function getLocalModifications(): array
return [];
}

public function saveWorkingCopy(string $commitMsg = '', array $filter = []): void
{
}
public function saveWorkingCopy(string $commitMsg = '', array $filter = []): void {}

public function publishChanges(?string $remote = null): void
{
}
public function publishChanges(?string $remote = null): void {}
}
Loading

0 comments on commit 97c6f4e

Please sign in to comment.