Skip to content

Commit

Permalink
Migrate code to PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Mar 16, 2023
1 parent 0833f20 commit 981be40
Show file tree
Hide file tree
Showing 117 changed files with 385 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.1']
php: ['8.1']
phpunit: ['phpunit.xml', 'phpunit-integration-legacy.xml']

steps:
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'phpdoc_no_alias_tag' => false,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'single_line_comment_style' => false,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'match', 'parameters']],
'yoda_style' => false,

// Additional rules
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/AddSynonymEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@

final class AddSynonymEvent extends AfterEvent
{
private SynonymCreateStruct $synonymCreateStruct;

private Tag $synonym;

public function __construct(SynonymCreateStruct $synonymCreateStruct, Tag $synonym)
public function __construct(private SynonymCreateStruct $synonymCreateStruct, private Tag $synonym)
{
$this->synonymCreateStruct = $synonymCreateStruct;
$this->synonym = $synonym;
}

public function getSynonymCreateStruct(): SynonymCreateStruct
Expand Down
15 changes: 8 additions & 7 deletions bundle/API/Repository/Events/Tags/BeforeAddSynonymEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

final class BeforeAddSynonymEvent extends BeforeEvent
{
private SynonymCreateStruct $synonymCreateStruct;

private Tag $synonym;

public function __construct(SynonymCreateStruct $synonymCreateStruct)
public function __construct(private SynonymCreateStruct $synonymCreateStruct)
{
$this->synonymCreateStruct = $synonymCreateStruct;
}

public function getSynonymCreateStruct(): SynonymCreateStruct
Expand All @@ -29,9 +26,13 @@ public function getSynonymCreateStruct(): SynonymCreateStruct

public function getSynonym(): Tag
{
if (!isset($this->synonym)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasSynonym() or set it with setSynonym() before you call the getter.', Tag::class));
}
$this->synonym ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasSynonym() or set it with setSynonym() before you call the getter.',
Tag::class,
),
);

return $this->synonym;
}
Expand Down
18 changes: 8 additions & 10 deletions bundle/API/Repository/Events/Tags/BeforeConvertToSynonymEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@

final class BeforeConvertToSynonymEvent extends BeforeEvent
{
private Tag $tag;

private Tag $mainTag;

private Tag $synonym;

public function __construct(Tag $tag, Tag $mainTag)
public function __construct(private Tag $tag, private Tag $mainTag)
{
$this->tag = $tag;
$this->mainTag = $mainTag;
}

public function getTag(): Tag
Expand All @@ -36,9 +30,13 @@ public function getMainTag(): Tag

public function getSynonym(): Tag
{
if (!isset($this->synonym)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasSynonym() or set it with setSynonym() before you call the getter.', Tag::class));
}
$this->synonym ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasSynonym() or set it with setSynonym() before you call the getter.',
Tag::class,
),
);

return $this->synonym;
}
Expand Down
18 changes: 8 additions & 10 deletions bundle/API/Repository/Events/Tags/BeforeCopySubtreeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@

final class BeforeCopySubtreeEvent extends BeforeEvent
{
private Tag $tag;

private ?Tag $parentTag;

private Tag $copiedTag;

public function __construct(Tag $tag, ?Tag $parentTag = null)
public function __construct(private Tag $tag, private ?Tag $parentTag = null)
{
$this->tag = $tag;
$this->parentTag = $parentTag;
}

public function getTag(): Tag
Expand All @@ -36,9 +30,13 @@ public function getParentTag(): ?Tag

public function getCopiedTag(): Tag
{
if (!isset($this->copiedTag)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasCopiedTag() or set it with setCopiedTag() before you call the getter.', Tag::class));
}
$this->copiedTag ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasCopiedTag() or set it with setCopiedTag() before you call the getter.',
Tag::class,
),
);

return $this->copiedTag;
}
Expand Down
15 changes: 8 additions & 7 deletions bundle/API/Repository/Events/Tags/BeforeCreateTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

final class BeforeCreateTagEvent extends BeforeEvent
{
private TagCreateStruct $tagCreateStruct;

private Tag $tag;

public function __construct(TagCreateStruct $tagCreateStruct)
public function __construct(private TagCreateStruct $tagCreateStruct)
{
$this->tagCreateStruct = $tagCreateStruct;
}

public function getTagCreateStruct(): TagCreateStruct
Expand All @@ -29,9 +26,13 @@ public function getTagCreateStruct(): TagCreateStruct

public function getTag(): Tag
{
if (!isset($this->tag)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasTag() or set it with setTag() before you call the getter.', Tag::class));
}
$this->tag ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasTag() or set it with setTag() before you call the getter.',
Tag::class,
),
);

return $this->tag;
}
Expand Down
5 changes: 1 addition & 4 deletions bundle/API/Repository/Events/Tags/BeforeDeleteTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

final class BeforeDeleteTagEvent extends BeforeEvent
{
private Tag $tag;

public function __construct(Tag $tag)
public function __construct(private Tag $tag)
{
$this->tag = $tag;
}

public function getTag(): Tag
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/BeforeMergeTagsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

final class BeforeMergeTagsEvent extends BeforeEvent
{
private Tag $tag;

private Tag $targetTag;

public function __construct(Tag $tag, Tag $targetTag)
public function __construct(private Tag $tag, private Tag $targetTag)
{
$this->tag = $tag;
$this->targetTag = $targetTag;
}

public function getTag(): Tag
Expand Down
18 changes: 8 additions & 10 deletions bundle/API/Repository/Events/Tags/BeforeMoveSubtreeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@

final class BeforeMoveSubtreeEvent extends BeforeEvent
{
private Tag $tag;

private ?Tag $parentTag;

private Tag $movedTag;

public function __construct(Tag $tag, ?Tag $parentTag = null)
public function __construct(private Tag $tag, private ?Tag $parentTag = null)
{
$this->tag = $tag;
$this->parentTag = $parentTag;
}

public function getTag(): Tag
Expand All @@ -36,9 +30,13 @@ public function getParentTag(): ?Tag

public function getMovedTag(): Tag
{
if (!isset($this->movedTag)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasMovedTag() or set it with setMovedTag() before you call the getter.', Tag::class));
}
$this->movedTag ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasMovedTag() or set it with setMovedTag() before you call the getter.',
Tag::class,
),
);

return $this->movedTag;
}
Expand Down
18 changes: 8 additions & 10 deletions bundle/API/Repository/Events/Tags/BeforeUpdateTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@

final class BeforeUpdateTagEvent extends BeforeEvent
{
private TagUpdateStruct $tagUpdateStruct;

private Tag $tag;

private Tag $updatedTag;

public function __construct(TagUpdateStruct $tagUpdateStruct, Tag $tag)
public function __construct(private TagUpdateStruct $tagUpdateStruct, private Tag $tag)
{
$this->tagUpdateStruct = $tagUpdateStruct;
$this->tag = $tag;
}

public function getTagUpdateStruct(): TagUpdateStruct
Expand All @@ -37,9 +31,13 @@ public function getTag(): Tag

public function getUpdatedTag(): Tag
{
if (!isset($this->updatedTag)) {
throw new UnexpectedValueException(sprintf('Return value is not set or not a type of %s. Check with hasUpdatedTag() or set it with setUpdatedTag() before you call the getter.', Tag::class));
}
$this->updatedTag ??
throw new UnexpectedValueException(
sprintf(
'Return value is not set or not a type of %s. Check with hasUpdatedTag() or set it with setUpdatedTag() before you call the getter.',
Tag::class,
),
);

return $this->updatedTag;
}
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/ConvertToSynonymEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

final class ConvertToSynonymEvent extends AfterEvent
{
private Tag $synonym;

private Tag $mainTag;

public function __construct(Tag $synonym, Tag $mainTag)
public function __construct(private Tag $synonym, private Tag $mainTag)
{
$this->synonym = $synonym;
$this->mainTag = $mainTag;
}

public function getSynonym(): Tag
Expand Down
11 changes: 1 addition & 10 deletions bundle/API/Repository/Events/Tags/CopySubtreeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,8 @@

final class CopySubtreeEvent extends AfterEvent
{
private Tag $tag;

private Tag $copiedTag;

private ?Tag $parentTag;

public function __construct(Tag $tag, Tag $copiedTag, ?Tag $parentTag = null)
public function __construct(private Tag $tag, private Tag $copiedTag, private ?Tag $parentTag = null)
{
$this->tag = $tag;
$this->copiedTag = $copiedTag;
$this->parentTag = $parentTag;
}

public function getTag(): Tag
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/CreateTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@

final class CreateTagEvent extends AfterEvent
{
private TagCreateStruct $tagCreateStruct;

private Tag $tag;

public function __construct(TagCreateStruct $tagCreateStruct, Tag $tag)
public function __construct(private TagCreateStruct $tagCreateStruct, private Tag $tag)
{
$this->tagCreateStruct = $tagCreateStruct;
$this->tag = $tag;
}

public function getTagCreateStruct(): TagCreateStruct
Expand Down
5 changes: 1 addition & 4 deletions bundle/API/Repository/Events/Tags/DeleteTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

final class DeleteTagEvent extends AfterEvent
{
private Tag $tag;

public function __construct(Tag $tag)
public function __construct(private Tag $tag)
{
$this->tag = $tag;
}

public function getTag(): Tag
Expand Down
5 changes: 1 addition & 4 deletions bundle/API/Repository/Events/Tags/MergeTagsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

final class MergeTagsEvent extends AfterEvent
{
private Tag $targetTag;

public function __construct(Tag $targetTag)
public function __construct(private Tag $targetTag)
{
$this->targetTag = $targetTag;
}

public function getTargetTag(): Tag
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/MoveSubtreeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

final class MoveSubtreeEvent extends AfterEvent
{
private Tag $tag;

private ?Tag $parentTag;

public function __construct(Tag $tag, ?Tag $parentTag = null)
public function __construct(private Tag $tag, private ?Tag $parentTag = null)
{
$this->tag = $tag;
$this->parentTag = $parentTag;
}

public function getTag(): Tag
Expand Down
8 changes: 1 addition & 7 deletions bundle/API/Repository/Events/Tags/UpdateTagEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@

final class UpdateTagEvent extends AfterEvent
{
private TagUpdateStruct $tagUpdateStruct;

private Tag $tag;

public function __construct(TagUpdateStruct $tagUpdateStruct, Tag $tag)
public function __construct(private TagUpdateStruct $tagUpdateStruct, private Tag $tag)
{
$this->tagUpdateStruct = $tagUpdateStruct;
$this->tag = $tag;
}

public function getTagUpdateStruct(): TagUpdateStruct
Expand Down
Loading

0 comments on commit 981be40

Please sign in to comment.