Skip to content

Commit

Permalink
Set Override attribute to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
SenseException committed Mar 7, 2024
1 parent 795bc1d commit 76b5f24
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Collator/ConfigurableCollator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Budgegeria\IntlSort\Exception\IntlSortException;
use Collator as IntlCollator;
use IntlException;
use Override;

use function assert;
use function is_int;
Expand All @@ -18,6 +19,7 @@ public function __construct(private readonly IntlCollator $collator, private rea
}

/** @throws IntlSortException */
#[Override]
public function compare(mixed $value, mixed $comparativeValue): int
{
if ($this->isNullFirst($value, $comparativeValue)) {
Expand Down
2 changes: 2 additions & 0 deletions src/Comparator/CallableAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Budgegeria\IntlSort\Collator\Collator;
use Closure;
use Override;

class CallableAccess implements Comparable
{
Expand All @@ -18,6 +19,7 @@ public function __construct(private readonly Collator $collator, callable $func)
$this->func = $func(...);
}

#[Override]
public function compare(mixed $value, mixed $comparativeValue): int
{
return $this->collator->compare(
Expand Down
2 changes: 2 additions & 0 deletions src/Comparator/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Budgegeria\IntlSort\Comparator;

use Budgegeria\IntlSort\Collator\Collator;
use Override;

class Comparator implements Comparable
{
public function __construct(private readonly Collator $collator)
{
}

#[Override]
public function compare(mixed $value, mixed $comparativeValue): int
{
return $this->collator->compare($value, $comparativeValue);
Expand Down
2 changes: 2 additions & 0 deletions src/ComparatorFactory/CallableAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Budgegeria\IntlSort\Comparator\CallableAccess as Comparator;
use Budgegeria\IntlSort\Comparator\Comparable;
use Closure;
use Override;

class CallableAccess implements Factory
{
Expand All @@ -20,6 +21,7 @@ public function __construct(callable $func)
$this->func = $func(...);
}

#[Override]
public function create(Collator $collator): Comparable
{
return new Comparator($collator, $this->func);
Expand Down
2 changes: 2 additions & 0 deletions src/ComparatorFactory/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
use Budgegeria\IntlSort\Collator\Collator;
use Budgegeria\IntlSort\Comparator\Comparable;
use Budgegeria\IntlSort\Comparator\Comparator;
use Override;

class Standard implements Factory
{
#[Override]
public function create(Collator $collator): Comparable
{
return new Comparator($collator);
Expand Down
2 changes: 2 additions & 0 deletions src/Sorter/Asc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Budgegeria\IntlSort\Sorter;

use Budgegeria\IntlSort\Comparator\Comparable;
use Override;

use function uasort;

Expand All @@ -17,6 +18,7 @@ public function __construct(private readonly Comparable $comparable)
/**
* {@inheritDoc}
*/
#[Override]
public function sort(array $values): array
{
$comparable = $this->comparable;
Expand Down
3 changes: 3 additions & 0 deletions src/Sorter/Desc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Budgegeria\IntlSort\Sorter;

use Override;

use function array_reverse;

final class Desc implements Sorter
Expand All @@ -15,6 +17,7 @@ public function __construct(private readonly Sorter $sorter)
/**
* {@inheritDoc}
*/
#[Override]
public function sort(array $values): array
{
$values = $this->sorter->sort($values);
Expand Down
2 changes: 2 additions & 0 deletions src/Sorter/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Budgegeria\IntlSort\Sorter;

use Budgegeria\IntlSort\Comparator\Comparable;
use Override;

use function uksort;

Expand All @@ -17,6 +18,7 @@ public function __construct(private readonly Comparable $comparable)
/**
* {@inheritDoc}
*/
#[Override]
public function sort(array $values): array
{
$comparable = $this->comparable;
Expand Down
3 changes: 3 additions & 0 deletions src/Sorter/Omit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Budgegeria\IntlSort\Sorter;

use Override;

use function array_values;

final class Omit implements Sorter
Expand All @@ -13,6 +15,7 @@ public function __construct(private readonly Sorter $sorter)
}

/** @inheritdoc */
#[Override]
public function sort(array $values): array
{
$values = $this->sorter->sort($values);
Expand Down

0 comments on commit 76b5f24

Please sign in to comment.