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:
paths:
- 'config/**'
- 'src/**'
- 'tests/**'
- 'rector.php'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- '.github/workflows/rector-cs.yml'

permissions:
contents: read

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

jobs:
rector-cs:
permissions:
contents: write # Required to commit formatting fixes back to the PR
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
with:
php: '8.1'
26 changes: 0 additions & 26 deletions .github/workflows/rector.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

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

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

return ConfigBuilder::build()
->setCacheFile(__DIR__ . '/runtime/.php-cs-fixer.cache')
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@Yiisoft/Core' => true,
'@Yiisoft/Core:risky' => true,
])
->setFinder($finder);
85 changes: 0 additions & 85 deletions .styleci.yml

This file was deleted.

4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
},
"require-dev": {
"codeception/codeception": "^5.0",
"friendsofphp/php-cs-fixer": "^3.95",
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^10.5",
"rector/rector": "^2.1.1",
Expand All @@ -70,6 +71,7 @@
"vimeo/psalm": "^5.15 || ^6.12",
"yiisoft/active-record": "dev-master",
"yiisoft/assets": "^5.1",
"yiisoft/code-style": "^1.1",
"yiisoft/csrf": "^2.0",
"yiisoft/db": "1.2 as dev-master",
"yiisoft/db-sqlite": "^1.0",
Expand Down Expand Up @@ -110,6 +112,8 @@
}
},
"scripts": {
"cs-fix": "php-cs-fixer fix",
"rector": "rector",
"test": "phpunit --testdox --no-interaction",
"test-watch": "phpunit-watcher watch"
},
Expand Down
2 changes: 1 addition & 1 deletion config/di-providers-web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Yiisoft\Yii\Debug\Api\Debug\Provider\DebugApiProvider;

if (!(bool)($params['yiisoft/yii-debug-api']['enabled'] ?? false)) {
if (!(bool) ($params['yiisoft/yii-debug-api']['enabled'] ?? false)) {
return [];
}

Expand Down
6 changes: 3 additions & 3 deletions config/di-web.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

return [
CollectorRepositoryInterface::class => static fn (StorageInterface $storage) => new CollectorRepository($storage),
CollectorRepositoryInterface::class => static fn(StorageInterface $storage) => new CollectorRepository($storage),
SchemaProviderInterface::class => function (ContainerInterface $container) {
if ($container->has(DatabaseProviderInterface::class)) {
return $container->get(CycleSchemaProvider::class);
Expand All @@ -30,10 +30,10 @@
}

throw new LogicException(
sprintf(
\sprintf(
'Inspecting database is not available. Configure "%s" service to be able to inspect database.',
ConnectionInterface::class,
)
),
);
},
HttpApplicationWrapper::class => [
Expand Down
7 changes: 4 additions & 3 deletions config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
use Yiisoft\Yii\Debug\Api\Inspector\Command\CodeceptionCommand;
use Yiisoft\Yii\Debug\Api\Inspector\Command\PHPUnitCommand;
use Yiisoft\Yii\Debug\Api\Inspector\Command\PsalmCommand;
use PHPUnit\Framework\Test;

$testCommands = [];
if (class_exists(PHPUnit\Framework\Test::class)) {
if (class_exists(Test::class)) {
$testCommands[PHPUnitCommand::COMMAND_NAME] = PHPUnitCommand::class;
}
if (class_exists(Extension::class)) {
Expand Down Expand Up @@ -41,8 +42,8 @@
],
'yiisoft/yii-swagger' => [
'annotation-paths' => [
dirname(__DIR__) . '/src/Debug/Controller',
dirname(__DIR__) . '/src/Debug/Middleware',
\dirname(__DIR__) . '/src/Debug/Controller',
\dirname(__DIR__) . '/src/Debug/Middleware',
],
],
];
8 changes: 4 additions & 4 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ static function (ResponseFactoryInterface $responseFactory, ValidatorInterface $
return new IpFilter(
validator: $validator,
responseFactory: $responseFactory,
ipRanges: $params['yiisoft/yii-debug-api']['allowedIPs']
ipRanges: $params['yiisoft/yii-debug-api']['allowedIPs'],
);
}
},
)
->middleware(FormatDataResponseAsJson::class)
->middleware(ResponseDataWrapper::class)
Expand Down Expand Up @@ -67,9 +67,9 @@ static function (ResponseFactoryInterface $responseFactory, ValidatorInterface $
return new IpFilter(
validator: $validator,
responseFactory: $responseFactory,
ipRanges: $params['yiisoft/yii-debug-api']['allowedIPs']
ipRanges: $params['yiisoft/yii-debug-api']['allowedIPs'],
);
}
},
)
->middleware(FormatDataResponseAsJson::class)
->middleware(ResponseDataWrapper::class)
Expand Down
15 changes: 4 additions & 11 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@

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__ . '/config',
__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
Loading
Loading