Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Rector + PHP CS Fixer

on:
pull_request_target:
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/rector-cs.yml'
- 'composer.json'
- 'rector.php'
- '.php-cs-fixer.dist.php'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
php: '8.4'
23 changes: 0 additions & 23 deletions .github/workflows/rector.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ phpunit.phar
/phpunit.xml
# phpunit cache
/.phpunit.cache/*

# PHP CS Fixer
/.php-cs-fixer.cache
22 changes: 22 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = (new Finder())->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@PER-CS3.0' => true,
'no_unused_imports' => true,
'ordered_class_elements' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
])
->setFinder($finder);
85 changes: 0 additions & 85 deletions .styleci.yml

This file was deleted.

6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
"yiisoft/arrays": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.89.2",
"maglnet/composer-require-checker": "^4.7.1",
"phpunit/phpunit": "^10.5.52",
"rector/rector": "^2.1.4",
"rector/rector": "^2.2.8",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^5.26.1 || ^6.10.3"
Expand All @@ -62,6 +63,7 @@
},
"scripts": {
"test": "phpunit --testdox --no-interaction",
"test-watch": "phpunit-watcher watch"
"test-watch": "phpunit-watcher watch",
"cs-fix": "php-cs-fixer fix"
}
}
4 changes: 1 addition & 3 deletions src/Paginator/InvalidPageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@
/**
* Thrown when the page is invalid.
*/
class InvalidPageException extends LogicException
{
}
class InvalidPageException extends LogicException {}
5 changes: 2 additions & 3 deletions src/Paginator/KeysetFilterContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public function __construct(
public readonly string $field,
public readonly string $value,
public readonly int $sorting,
public readonly bool $isReverse
) {
}
public readonly bool $isReverse,
) {}
}
2 changes: 1 addition & 1 deletion src/Paginator/KeysetPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ private function prepareSortInDataReader(ReadableDataInterface $dataReader, ?Sor
throw new InvalidArgumentException('Data should be always sorted to work with keyset pagination.');
}
$sort = $sort->withOrder(
array_slice($defaultOrder, 0, 1, true)
array_slice($defaultOrder, 0, 1, true),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Paginator/PageNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class PageNotFoundException extends InvalidPageException
public function __construct(int $page)
{
parent::__construct(
sprintf('Page %d not found.', $page)
sprintf('Page %d not found.', $page),
);
}
}
3 changes: 1 addition & 2 deletions src/Paginator/PageToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ final class PageToken
private function __construct(
public readonly string $value,
public readonly bool $isPrevious,
) {
}
) {}

public static function previous(string $value): self
{
Expand Down
4 changes: 1 addition & 3 deletions src/Processor/DataProcessorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@
*
* @psalm-suppress ClassMustBeFinal We assume that the class may be extended in userland.
*/
class DataProcessorException extends RuntimeException
{
}
class DataProcessorException extends RuntimeException {}
4 changes: 1 addition & 3 deletions src/Reader/DataReaderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@
*
* @psalm-suppress ClassMustBeFinal We assume that the class may be extended in userland.
*/
class DataReaderException extends RuntimeException
{
}
class DataReaderException extends RuntimeException {}
4 changes: 1 addition & 3 deletions src/Reader/DataReaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ interface DataReaderInterface extends
CountableDataInterface,
SortableDataInterface,
FilterableDataInterface,
IteratorAggregate
{
}
IteratorAggregate {}
4 changes: 1 addition & 3 deletions src/Reader/Filter/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@
* Represents a filter that matches all items.
* Used to indicate that no filtering should be applied.
*/
final class All implements FilterInterface
{
}
final class All implements FilterInterface {}
5 changes: 2 additions & 3 deletions src/Reader/Filter/Between.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ final class Between implements FilterInterface
public function __construct(
public readonly string $field,
public readonly bool|DateTimeInterface|float|int|string|Stringable $minValue,
public readonly bool|DateTimeInterface|float|int|string|Stringable $maxValue
) {
}
public readonly bool|DateTimeInterface|float|int|string|Stringable $maxValue,
) {}
}
3 changes: 1 addition & 2 deletions src/Reader/Filter/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ abstract class Compare implements FilterInterface
final public function __construct(
public readonly string $field,
public readonly bool|DateTimeInterface|float|int|string|Stringable $value,
) {
}
) {}

/**
* @param bool|DateTimeInterface|float|int|string|Stringable $value Value to compare to.
Expand Down
4 changes: 1 addition & 3 deletions src/Reader/Filter/Equals.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* `Equals` filter defines a criteria for ensuring field value equals a given value.
*/
final class Equals extends Compare
{
}
final class Equals extends Compare {}
3 changes: 1 addition & 2 deletions src/Reader/Filter/EqualsNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ final class EqualsNull implements FilterInterface
*/
public function __construct(
public readonly string $field,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Reader/Filter/GreaterThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* `GreaterThan` filter defines a criteria for ensuring field value is greater than a given value.
*/
final class GreaterThan extends Compare
{
}
final class GreaterThan extends Compare {}
4 changes: 1 addition & 3 deletions src/Reader/Filter/GreaterThanOrEqual.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* `GreaterThanOrEqual` filter defines a criteria for ensuring field value is greater than or equal to a given value.
*/
final class GreaterThanOrEqual extends Compare
{
}
final class GreaterThanOrEqual extends Compare {}
4 changes: 2 additions & 2 deletions src/Reader/Filter/In.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class In implements FilterInterface
public function __construct(
public readonly string $field,
/** @var bool[]|float[]|int[]|string[]|Stringable[] Values to check against. */
public readonly array $values
public readonly array $values,
) {
$this->assertValues($values);
}
Expand All @@ -36,7 +36,7 @@ private function assertValues(array $values): void
sprintf(
'The value should be scalar or Stringable. "%s" is received.',
get_debug_type($value),
)
),
);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Reader/Filter/LessThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* `LessThan` filter defines a criteria for ensuring field value is less than a given value.
*/
final class LessThan extends Compare
{
}
final class LessThan extends Compare {}
4 changes: 1 addition & 3 deletions src/Reader/Filter/LessThanOrEqual.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* `LessThanOrEqual` filter defines a criteria for ensuring field value is less than or equal to a given value.
*/
final class LessThanOrEqual extends Compare
{
}
final class LessThanOrEqual extends Compare {}
3 changes: 1 addition & 2 deletions src/Reader/Filter/Like.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ public function __construct(
public readonly string|Stringable $value,
public readonly ?bool $caseSensitive = null,
public readonly LikeMode $mode = LikeMode::Contains,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Reader/Filter/None.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@
* Represents a filter that matches no items.
* Used to indicate that all items should be excluded.
*/
final class None implements FilterInterface
{
}
final class None implements FilterInterface {}
3 changes: 1 addition & 2 deletions src/Reader/Filter/Not.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ final class Not implements FilterInterface
*/
public function __construct(
public readonly FilterInterface $filter,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions src/Reader/FilterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* Filter is a set of settings for modifying data reader criteria.
*/
interface FilterInterface
{
}
interface FilterInterface {}
3 changes: 1 addition & 2 deletions src/Reader/Iterable/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public function __construct(
*/
public readonly array $iterableFilterHandlers,
private readonly ValueReaderInterface $valueReader,
) {
}
) {}

/**
* @psalm-param class-string<FilterInterface> $class
Expand Down
Loading
Loading