Skip to content

Commit

Permalink
chore: Sync changes from the template (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: oprypkhantc <[email protected]>
  • Loading branch information
package-sync[bot] and oprypkhantc authored May 14, 2024
1 parent 96643ef commit b62c4e8
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Reformat using Prettier
uses: actionsx/prettier@v2
uses: actionsx/prettier@v3
with:
args: --write .

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
uses: actions/checkout@v3

- name: Run prettier
uses: actionsx/prettier@v2
uses: actionsx/prettier@v3
with:
args: --check .

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"require-dev": {
"pestphp/pest": "^2.8",
"mockery/mockery": "^1.4",
"php-cs-fixer/shim": "~3.19.2",
"tenantcloud/php-cs-fixer-rule-sets": "~3.0.0",
"php-cs-fixer/shim": "^3.54",
"tenantcloud/php-cs-fixer-rule-sets": "~3.3.1",
"phpstan/phpstan": "~1.10.21",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-webmozart-assert": "^1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/BackedEnumExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
trait BackedEnumExtensions
{
/**
* @return TEnumValue[]
* @return list<TEnumValue>
*/
public static function values(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/EnumInvalidUsageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class EnumInvalidUsageException extends RuntimeException
{
public function __construct(string $message, Throwable $previous = null)
public function __construct(string $message, ?Throwable $previous = null)
{
parent::__construct($message, 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/ValueEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($value)
/**
* Get the instance as an array.
*
* @return T[]
* @return list<T>
*/
public static function values(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/ValueNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ValueNotFoundException extends RuntimeException
{
public function __construct(mixed $value, Throwable $previous = null)
public function __construct(mixed $value, ?Throwable $previous = null)
{
parent::__construct("Value {$value} was not found.", 0, $previous);
}
Expand Down
14 changes: 5 additions & 9 deletions src/Iterators/ArrayValuesIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@ class ArrayValuesIterator implements Iterator
{
private int $position;

/** @var T[] */
private array $items;

/**
* @param T[] $items
* @param list<T> $items
*/
public function __construct(array $items = [])
{
$this->items = $items;

public function __construct(/** @var list<T> */
private array $items = []
) {
$this->rewind();
}

/**
* Merges new elements at given position.
*
* @param T[] $values
* @param list<T> $values
*/
public function merge(array $values, int $at): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Optional/MissingValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use RuntimeException;

class MissingValueException extends RuntimeException
{
}
class MissingValueException extends RuntimeException {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class StaticConstructorInvalidUsageException extends RuntimeException
{
public function __construct(string $message, Throwable $previous = null)
public function __construct(string $message, ?Throwable $previous = null)
{
parent::__construct($message, 0, $previous);
}
Expand Down
7 changes: 1 addition & 6 deletions src/StaticConstructor/StaticConstructorLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
*/
final class StaticConstructorLoader extends ClassLoader
{
private ClassLoader $delegate;

public function __construct(ClassLoader $delegate)
{
$this->delegate = $delegate;
}
public function __construct(private ClassLoader $delegate) {}

/**
* @param class-string $className
Expand Down
7 changes: 1 addition & 6 deletions tests/Enum/Stubs/NonValueEnumStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class NonValueEnumStub extends Enum

public static self $INHERITED_CASE;

private int $value;

public function __construct(int $value)
{
$this->value = $value;
}
public function __construct(private int $value) {}

public function value(): int
{
Expand Down

0 comments on commit b62c4e8

Please sign in to comment.