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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,18 @@ jobs:

- name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon --error-format=checkstyle | cs2pr

- name: Setup rector cache
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/rector
key: ${{ runner.os }}-rector-${{ hashFiles('rector.php', 'composer.lock') }}
restore-keys: ${{ runner.os }}-rector-

- name: Create rector cache dir
run: mkdir -p ${{ runner.temp }}/rector

- name: Run rector
env:
RECTOR_CACHE_DIR: ${{ runner.temp }}/rector
run: composer rector-setup && composer rector-check
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
"annotate": "bin/cake annotate all",
"illuminate": "bin/cake illuminate code",
"phpstan": "phpstan analyse",
"phpstan-baseline": "phpstan --generate-baseline"
"phpstan-baseline": "phpstan --generate-baseline",
"rector-setup": "cp composer.json composer.backup && composer require --dev rector/rector:\"~2.3.1\" && mv composer.backup composer.json",
"rector-check": "vendor/bin/rector process --dry-run",
"rector-fix": "vendor/bin/rector process"
}
}
62 changes: 61 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
'default' => [
'className' => FileEngine::class,
'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null),
'url' => env('CACHE_DEFAULT_URL'),
],

/*
Expand All @@ -134,7 +134,7 @@
'path' => CACHE . 'persistent' . DS,
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKECORE_URL', null),
'url' => env('CACHE_CAKECORE_URL'),
],

/*
Expand All @@ -149,7 +149,7 @@
'path' => CACHE . 'models' . DS,
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
'url' => env('CACHE_CAKEMODEL_URL'),
],
],

Expand Down Expand Up @@ -250,7 +250,7 @@
//'password' => null,
'client' => null,
'tls' => false,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL'),
],
],

Expand Down Expand Up @@ -364,15 +364,15 @@
'className' => FileLog::class,
'path' => LOGS,
'file' => 'debug',
'url' => env('LOG_DEBUG_URL', null),
'url' => env('LOG_DEBUG_URL'),
'scopes' => null,
'levels' => ['notice', 'info', 'debug'],
],
'error' => [
'className' => FileLog::class,
'path' => LOGS,
'file' => 'error',
'url' => env('LOG_ERROR_URL', null),
'url' => env('LOG_ERROR_URL'),
'scopes' => null,
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
],
Expand All @@ -381,7 +381,7 @@
'className' => FileLog::class,
'path' => LOGS,
'file' => 'queries',
'url' => env('LOG_QUERIES_URL', null),
'url' => env('LOG_QUERIES_URL'),
'scopes' => ['cake.database.queries'],
],
],
Expand Down Expand Up @@ -459,7 +459,7 @@
*/
'DebugKit' => [
'forceEnable' => filter_var(env('DEBUG_KIT_FORCE_ENABLE', false), FILTER_VALIDATE_BOOLEAN),
'safeTld' => env('DEBUG_KIT_SAFE_TLD', null),
'safeTld' => env('DEBUG_KIT_SAFE_TLD'),
'ignoreAuthorization' => env('DEBUG_KIT_IGNORE_AUTHORIZATION', false),
],

Expand Down
4 changes: 2 additions & 2 deletions config/app_local.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/*
* You can use a DSN string to set the entire configuration
*/
'url' => env('DATABASE_URL', null),
'url' => env('DATABASE_URL'),
],

/*
Expand Down Expand Up @@ -91,7 +91,7 @@
'username' => null,
'password' => null,
'client' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL'),
],
],
];
4 changes: 2 additions & 2 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@
* If you don't use these checks you can safely remove this code
* and the mobiledetect package from composer.json.
*/
ServerRequest::addDetector('mobile', function ($request) {
ServerRequest::addDetector('mobile', function ($request): bool {
$detector = new MobileDetect();

return $detector->isMobile();
});
ServerRequest::addDetector('tablet', function ($request) {
ServerRequest::addDetector('tablet', function ($request): bool {
$detector = new MobileDetect();

return $detector->isTablet();
Expand Down
70 changes: 70 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;

$cacheDir = getenv('RECTOR_CACHE_DIR') ?: sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'rector';

return RectorConfig::configure()
->withPaths([
__DIR__ . '/config',
__DIR__ . '/src',
__DIR__ . '/tests',
])

->withCache(
cacheClass: FileCacheStorage::class,
cacheDirectory: $cacheDir,
)

->withPhpSets()
->withAttributesSets()

->withSets([
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::TYPE_DECLARATION,
])

->withSkip([
ClassPropertyAssignToConstructorPromotionRector::class,
CatchExceptionNameMatchingTypeRector::class,
ClosureToArrowFunctionRector::class,
RemoveUselessReturnTagRector::class,
ReturnTypeFromStrictFluentReturnRector::class,
NewlineAfterStatementRector::class,
StringClassNameToClassConstantRector::class,
ReturnTypeFromStrictTypedCallRector::class,
ParamTypeByMethodCallTypeRector::class,
CompactToVariablesRector::class,
SplitDoubleAssignRector::class,
ChangeOrIfContinueToMultiContinueRector::class,
ExplicitBoolCompareRector::class,
NewlineBeforeNewAssignSetRector::class,
DisallowedEmptyRuleFixerRector::class,
RemoveUselessParamTagRector::class,
]);
1 change: 0 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ public function services(ContainerInterface $container): void
}

/**
* @param \Psr\Http\Message\ServerRequestInterface $request
* @return \Authentication\AuthenticationServiceInterface
*/
public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface
Expand Down
6 changes: 2 additions & 4 deletions src/Command/CleanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class CleanCommand extends Command
{
/**
* The name of this command.
*
* @var string
*/
protected string $name = 'clean';

Expand Down Expand Up @@ -44,9 +42,9 @@ public static function getDescription(): string
*
* @param \Cake\Console\Arguments $args The command arguments.
* @param \Cake\Console\ConsoleIo $io The console io
* @return int|null|void The exit code or null for success
* @return void The exit code or null for success
*/
public function execute(Arguments $args, ConsoleIo $io)
public function execute(Arguments $args, ConsoleIo $io): void
{
$confirmation = $io->ask(
'Are you sure you want to clean all packages data and related tags? This action cannot be undone. (yes/no)',
Expand Down
13 changes: 5 additions & 8 deletions src/Command/DevserverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class DevserverCommand extends Command
{
/**
* The name of this command.
*
* @var string
*/
protected string $name = 'devserver';

Expand Down Expand Up @@ -49,7 +47,7 @@ public static function getDescription(): string
* @param \Cake\Console\ConsoleOptionParser $parser The parser to be defined
* @return \Cake\Console\ConsoleOptionParser The built parser.
*/
public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser
{
return parent::buildOptionParser($parser)
->setDescription(static::getDescription());
Expand Down Expand Up @@ -102,10 +100,10 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
if (!$process->isRunning()) {
$poll = false;
$exitCode = $process->getExitCode();
$io->error("$name has died with code $exitCode.");
$io->error(sprintf('%s has died with code %s.', $name, $exitCode));
$errorOutput = trim($process->getErrorOutput());
if ($errorOutput !== '') {
$io->error("$name | $errorOutput");
$io->error(sprintf('%s | %s', $name, $errorOutput));
}
break;
}
Expand All @@ -115,7 +113,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
if (!empty($output)) {
foreach (explode("\n", trim($output)) as $line) {
if ($line !== '') {
$io->info("$name | $line");
$io->info(sprintf('%s | %s', $name, $line));
}
}
}
Expand All @@ -124,7 +122,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
if (!empty($error)) {
foreach (explode("\n", trim($error)) as $line) {
if ($line !== '') {
$io->comment("$name | $line");
$io->comment(sprintf('%s | %s', $name, $line));
}
}
}
Expand All @@ -135,7 +133,6 @@ public function execute(Arguments $args, ConsoleIo $io): ?int

$io->verbose('Start shutdown');
foreach ($servers as $server) {
/** @var \Symfony\Component\Process\Process $process */
$process = $server['process'];
if ($process->isRunning()) {
$process->stop(1); // graceful timeout of 1 second
Expand Down
Loading
Loading