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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ composer.phar
# PhpUnit
/phpunit.phar
/phpunit.xml
/.phpunit.cache

# PHP CS Fixer
/.php-cs-fixer.cache
/.php-cs-fixer.php
22 changes: 5 additions & 17 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
use Yiisoft\CodeStyle\ConfigBuilder;

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

return (new Config())
return ConfigBuilder::build()
->setCacheFile(__DIR__ . '/runtime/.php-cs-fixer.cache')
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@PER-CS3.0' => true,
'no_unused_imports' => true,
'ordered_class_elements' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'declare_strict_types' => true,
'native_function_invocation' => true,
'native_constant_invocation' => true,
'fully_qualified_strict_types' => [
'import_symbols' => true
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'@Yiisoft/Core' => true,
'@Yiisoft/Core:risky' => true,
])
->setFinder($finder);
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
"require-dev": {
"ext-ctype": "*",
"bamarni/composer-bin-plugin": "^1.8.3",
"friendsofphp/php-cs-fixer": "^3.91.3",
"friendsofphp/php-cs-fixer": "^3.95.27",
"phpunit/phpunit": "^10.5.60",
"rector/rector": "^2.2.14",
"rector/rector": "^2.7.0",
"shipmonk/composer-dependency-analyser": "^1.8",
"spatie/phpunit-watcher": "^1.24"
"spatie/phpunit-watcher": "^1.24",
"yiisoft/code-style": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -72,6 +73,7 @@
"test": "phpunit --testdox --no-interaction",
"test-watch": "phpunit-watcher watch",
"cs-fix": "php-cs-fixer fix",
"rector": "rector",
"mutation": "infection --threads=max --min-covered-msi=100",
"dependency-analyser": "composer-dependency-analyser"
}
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
cacheDirectory="runtime/.phpunit.cache"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
Expand Down
14 changes: 3 additions & 11 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Yiisoft\CodeStyle\Rector\SetList;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPhpSets(php81: true)
->withRules([
InlineConstructorDefaultToPropertyRector::class,
])
->withSkip([
ClosureToArrowFunctionRector::class,
ReadOnlyPropertyRector::class,
NullToStrictStringFuncCallArgRector::class,
->withSets([
SetList::YII_CORE,
]);
2 changes: 2 additions & 0 deletions runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
4 changes: 1 addition & 3 deletions src/Paginator/KeysetPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,7 @@ private function readData(ReadableDataInterface $dataReader, Sort $sort): array
[$field] = $this->getFieldAndSortingFromSort($sort);

foreach ($dataReader->read() as $key => $item) {
if ($this->currentFirstValue === null) {
$this->currentFirstValue = (string) ArrayHelper::getValue($item, $field);
}
$this->currentFirstValue ??= (string) ArrayHelper::getValue($item, $field);

if (count($data) === $this->pageSize) {
$this->hasNextPage = true;
Expand Down
1 change: 0 additions & 1 deletion tests/Paginator/KeysetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ public function testGetPreviousPageExistForCoverage(): void
$dataReader = (new IterableDataReader(self::getDataSet()))->withSort($sort);
$paginator = (new KeysetPaginator($dataReader))->withToken(PageToken::next('1'));


$this->assertTrue($this->invokeMethod($paginator, 'previousPageExist', [$dataReader, $sort]));
}

Expand Down
Loading