Skip to content

Commit

Permalink
Run Tests on PHP 8.4 (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzweifel authored Nov 13, 2024
1 parent ac8936e commit 38fcaf2
Show file tree
Hide file tree
Showing 26 changed files with 700 additions and 797 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2, 8.3]
php: [8.2, 8.3, 8.4]

name: P${{ matrix.php }} - ${{ matrix.os }}

Expand Down
3 changes: 1 addition & 2 deletions app/Actions/AddReleaseNotesToChangelogAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public function __construct(
private readonly FindSecondLevelHeadingWithText $findSecondLevelHeadingWithText,
private readonly PlaceReleaseNotesBelowUnreleasedHeadingAction $addNewReleaseNotesWithUnreleasedHeadingToChangelog,
private readonly PlaceReleaseNotesAtTheTopAction $addNewReleaseToChangelog
) {
}
) {}

/**
* @throws Throwable
Expand Down
14 changes: 6 additions & 8 deletions app/Actions/ExtractPermalinkFragmentFromHeadingAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

class ExtractPermalinkFragmentFromHeadingAction
{
public function __construct(private readonly GitHubActionsOutput $gitHubActionsOutput)
{
}
public function __construct(private readonly GitHubActionsOutput $gitHubActionsOutput) {}

public function execute(Heading $releaseHeading): string
{
Expand Down Expand Up @@ -62,8 +60,8 @@ protected function prepareCommonmarkEnvironment(): Environment
];

$environment = new Environment($config);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new HeadingPermalinkExtension());
$environment->addExtension(new CommonMarkCoreExtension);
$environment->addExtension(new HeadingPermalinkExtension);

return $environment;
}
Expand All @@ -74,12 +72,12 @@ protected function prepareCommonmarkEnvironment(): Environment
*/
protected function attachPermalinkToHeading(Heading $releaseHeading, Environment $environment): Document
{
$document = new Document();
$document = new Document;
$document->appendChild($releaseHeading);

$documentParsedEvent = new DocumentParsedEvent($document);

$processor = (new HeadingPermalinkProcessor());
$processor = (new HeadingPermalinkProcessor);
$processor->setEnvironment($environment);
$processor->__invoke($documentParsedEvent);

Expand All @@ -92,7 +90,7 @@ protected function attachPermalinkToHeading(Heading $releaseHeading, Environment
*/
protected function extractLinkFragmentFromRenderedHtml(string $html): ?string
{
$domDocument = new DOMDocument();
$domDocument = new DOMDocument;
$domDocument->loadHTML($html);

/** @var \DOMAttr $hrefAttribute */
Expand Down
6 changes: 2 additions & 4 deletions app/Actions/InsertReleaseNotesInChangelogAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

class InsertReleaseNotesInChangelogAction
{
public function __construct(private readonly PrepareReleaseNotesAction $prepareReleaseNotes)
{
}
public function __construct(private readonly PrepareReleaseNotesAction $prepareReleaseNotes) {}

/**
* @throws ReleaseNotesCanNotBeplacedException
Expand Down Expand Up @@ -40,6 +38,6 @@ public function execute(Document $changelog, string $releaseNotes, Heading $newR

// If the CHANGELOG doesn't have any children, we currently don't insert the release notes.
// An exception is thrown and an error message is displayed to the user.
throw new ReleaseNotesCanNotBeplacedException();
throw new ReleaseNotesCanNotBeplacedException;
}
}
4 changes: 2 additions & 2 deletions app/Actions/ParseAndLinkifyGitHubUsernamesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function execute(?string $releaseNotes): ?string
];

$environment = new Environment($config);
$environment->addExtension(new MarkdownRendererExtension());
$environment->addExtension(new MentionExtension());
$environment->addExtension(new MarkdownRendererExtension);
$environment->addExtension(new MentionExtension);

$parser = new CommonmarkMarkdownParser($environment);
$renderer = new CommonmarkRenderer($environment);
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/PlaceReleaseNotesAtTheTopAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function __construct(
private readonly CreateNewReleaseHeadingWithCompareUrl $createNewReleaseHeadingWithCompareUrl,
private readonly GenerateCompareUrl $generateCompareUrl,
private readonly GitHubActionsOutput $gitHubActionsOutput,
) {
}
) {}

/**
* @throws Throwable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function __construct(
private readonly CreateNewReleaseHeadingWithCompareUrl $createNewReleaseHeading,
private readonly GitHubActionsOutput $gitHubActionsOutput,
private readonly InsertReleaseNotesInChangelogAction $insertReleaseNotesInChangelogAction
) {
}
) {}

/**
* @throws Throwable
Expand Down
4 changes: 1 addition & 3 deletions app/Actions/PrepareReleaseNotesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

class PrepareReleaseNotesAction
{
public function __construct(private readonly Markdown $markdown, private readonly ShiftHeadingLevelInDocumentAction $shiftHeadingLevelInDocument)
{
}
public function __construct(private readonly Markdown $markdown, private readonly ShiftHeadingLevelInDocumentAction $shiftHeadingLevelInDocument) {}

public function execute(string $releaseNotes, Heading $newReleaseHeading): Document
{
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/ShiftHeadingLevelInDocumentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ShiftHeadingLevelInDocumentAction

public function execute(Document $document, int $baseHeadingLevel): Document
{
$headings = (new Query())
$headings = (new Query)
->where(Query::type(Heading::class))
->findAll($document);

Expand Down
4 changes: 1 addition & 3 deletions app/CreateNewReleaseHeading.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

class CreateNewReleaseHeading
{
public function __construct(private readonly ExtractPermalinkFragmentFromHeadingAction $extractPermalinkFragmentFromHeading)
{
}
public function __construct(private readonly ExtractPermalinkFragmentFromHeadingAction $extractPermalinkFragmentFromHeading) {}

public function create(string $text, string $releaseDate, bool $hideDate = false): Heading
{
Expand Down
3 changes: 1 addition & 2 deletions app/CreateNewReleaseHeadingWithCompareUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
private readonly GenerateCompareUrl $generateCompareUrl,
private readonly GitHubActionsOutput $gitHubActionsOutput,
private readonly ExtractPermalinkFragmentFromHeadingAction $extractPermalinkFragmentFromHeading
) {
}
) {}

public function create(string $repositoryUrl, string $previousVersion, string $latestVersion, string $headingText, string $releaseDate, bool $hideDate = false): Heading
{
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->app->singleton(GitHubActionsOutput::class, fn () => new GitHubActionsOutput());
$this->app->singleton(GitHubActionsOutput::class, fn () => new GitHubActionsOutput);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Queries/FindFirstSecondLevelHeading.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function find(Document $document): ?Heading
/**
* @phpstan-var Heading|null
*/
return (new Query())
return (new Query)
->where(Query::type(Heading::class))
->andWhere(new HeadingLevel(2))
->findOne($document);
Expand Down
2 changes: 1 addition & 1 deletion app/Queries/FindSecondLevelHeadingWithText.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function find(Document $document, string $previousVersion): ?Heading
/**
* @phpstan-var Heading|null
*/
return (new Query())
return (new Query)
->where(Query::type(Heading::class))
->andWhere(new HeadingLevel(2))
->andWhere(new HeadingText($previousVersion))
Expand Down
2 changes: 1 addition & 1 deletion app/Queries/FindUnreleasedHeading.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function find(Document $document): ?Heading
/**
* @phpstan-var Heading|null
*/
return (new Query())
return (new Query)
->where(Query::type(Heading::class))
->andWhere(Query::hasChild(Query::type(Link::class)))
->andWhere(Query::hasChild(Query::hasChild(Query::type(Text::class))))
Expand Down
4 changes: 1 addition & 3 deletions app/QueryExpressions/HeadingLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

class HeadingLevel implements ExpressionInterface
{
public function __construct(private readonly int $level)
{
}
public function __construct(private readonly int $level) {}

public function __invoke(Node $node): bool
{
Expand Down
4 changes: 1 addition & 3 deletions app/QueryExpressions/HeadingText.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

class HeadingText implements ExpressionInterface
{
public function __construct(private readonly string $text)
{
}
public function __construct(private readonly string $text) {}

public function __invoke(Node $node): bool
{
Expand Down
3 changes: 1 addition & 2 deletions app/Support/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class Markdown
public function __construct(
private readonly MarkdownParser $markdownParser,
private readonly MarkdownRenderer $markdownRenderer
) {
}
) {}

public function parse(string $markdown): Document
{
Expand Down
2 changes: 1 addition & 1 deletion app/Support/MarkdownParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MarkdownParser

public function __construct(Environment $environment)
{
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new CommonMarkCoreExtension);
$this->parser = new CommonmarkMarkdownParser($environment);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Support/MarkdownRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MarkdownRenderer

public function __construct(Environment $environment)
{
$environment->addExtension(new MarkdownRendererExtension());
$environment->addExtension(new MarkdownRendererExtension);

$this->renderer = new CommonmarkRenderer($environment);
}
Expand Down
Loading

0 comments on commit 38fcaf2

Please sign in to comment.