Skip to content

Commit af3c1b4

Browse files
committed
apply rector
1 parent f5bfaf0 commit af3c1b4

File tree

8 files changed

+30
-38
lines changed

8 files changed

+30
-38
lines changed

.php-cs-fixer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
// 'style' => 'for',
9393
// ],
9494
'explicit_string_variable' => false,
95-
'final_class' => false,
95+
// 'final_class' => false,
9696
// 'final_internal_class' => false,
9797
// 'final_public_method_for_abstract_class' => false,
9898
'logical_operators' => false,
@@ -198,7 +198,7 @@
198198
->append(glob(__DIR__.'/{*,.*}.php', \GLOB_BRACE))
199199
->append([
200200
__DIR__.'/composer-updater',
201-
__DIR__.'/platform-lint',
201+
__DIR__.'/favorite-link',
202202
])
203203
->notPath([
204204
'bootstrap/*',

app/Commands/.gitkeep

Whitespace-only changes.

app/Commands/InspireCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use LaravelZero\Framework\Commands\Command;
1818
use function Termwind\{render};
1919

20-
class InspireCommand extends Command
20+
final class InspireCommand extends Command
2121
{
2222
/**
2323
* The signature of the command.
@@ -51,6 +51,7 @@ public function handle(): void
5151
/**
5252
* Define the command's schedule.
5353
*/
54+
#[\Override()]
5455
public function schedule(Schedule $schedule): void
5556
{
5657
// $schedule->command(static::class)->everyMinute();

app/Providers/AppServiceProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use Illuminate\Support\ServiceProvider;
1717

18-
class AppServiceProvider extends ServiceProvider
18+
final class AppServiceProvider extends ServiceProvider
1919
{
2020
/**
2121
* Bootstrap any application services.
@@ -25,5 +25,6 @@ public function boot(): void {}
2525
/**
2626
* Register any application services.
2727
*/
28+
#[\Override()]
2829
public function register(): void {}
2930
}

favorite-link

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/usr/bin/env php
22
<?php
33

4-
define('LARAVEL_START', microtime(true));
4+
declare(strict_types=1);
5+
6+
/**
7+
* Copyright (c) 2018-2024 guanguans<[email protected]>
8+
*
9+
* For the full copyright and license information, please view
10+
* the LICENSE file that was distributed with this source code.
11+
*
12+
* @see https://github.com/guanguans/favorite-link
13+
*/
14+
15+
\define('LARAVEL_START', microtime(true));
516

617
/*
718
|--------------------------------------------------------------------------
@@ -15,7 +26,7 @@ define('LARAVEL_START', microtime(true));
1526
|
1627
*/
1728

18-
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
29+
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
1930

2031
$app = require_once __DIR__.'/bootstrap/app.php';
2132

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ parameters:
3030
# noVariableVariables: false
3131

3232
ignoreErrors:
33-
- "#^Unsafe usage of new static\\(\\)\\.$#"
33+
# - "#^Unsafe usage of new static\\(\\)\\.$#"

rector.php

+9-30
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@
1111
* @see https://github.com/guanguans/favorite-link
1212
*/
1313

14-
use Ergebnis\Rector\Rules\Arrays\SortAssociativeArrayByKeyRector;
15-
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
14+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
1615
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
1716
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
1817
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
1918
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
2019
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
2120
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
2221
use Rector\Config\RectorConfig;
22+
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
2323
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
2424
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector;
2525
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
2626
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
27-
use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
2827
use Rector\Php73\Rector\String_\SensitiveHereNowDocRector;
2928
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
3029
use Rector\PHPUnit\Set\PHPUnitSetList;
@@ -47,17 +46,15 @@
4746
$rectorConfig->parallel(240);
4847
// $rectorConfig->disableParallel();
4948
$rectorConfig->phpstanConfig(__DIR__.'/phpstan.neon');
50-
$rectorConfig->phpVersion(PhpVersion::PHP_74);
49+
$rectorConfig->phpVersion(PhpVersion::PHP_83);
5150
// $rectorConfig->cacheClass(FileCacheStorage::class);
5251
// $rectorConfig->cacheDirectory(__DIR__.'/.build/rector');
5352
// $rectorConfig->containerCacheDirectory(__DIR__.'/.build/rector');
5453
// $rectorConfig->disableParallel();
5554
// $rectorConfig->fileExtensions(['php']);
5655
// $rectorConfig->indent(' ', 4);
5756
// $rectorConfig->memoryLimit('2G');
58-
// $rectorConfig->nestedChainMethodCallLimit(3);
5957
// $rectorConfig->noDiffs();
60-
// $rectorConfig->parameters()->set(Option::APPLY_AUTO_IMPORT_NAMES_ON_CHANGED_FILES_ONLY, true);
6158
// $rectorConfig->removeUnusedImports();
6259

6360
$rectorConfig->bootstrapFiles([
@@ -69,7 +66,7 @@
6966
]);
7067

7168
$rectorConfig->paths([
72-
__DIR__.'/src',
69+
__DIR__.'/app',
7370
__DIR__.'/tests',
7471
__DIR__.'/.*.php',
7572
__DIR__.'/*.php',
@@ -88,30 +85,12 @@
8885
ReturnBinaryOrToEarlyReturnRector::class,
8986
SensitiveHereNowDocRector::class,
9087
WrapEncapsedVariableInCurlyBracesRector::class,
91-
CompactToVariablesRector::class => [
92-
__DIR__.'/src/Foundation/Support/Utils.php',
93-
],
94-
RemoveTraitUseRector::class => [
95-
__DIR__.'/src/Foundation/Message.php',
96-
],
97-
RenameParamToMatchTypeRector::class => [
98-
__DIR__.'/src/Foundation/Authenticators/AggregateAuthenticator.php',
99-
__DIR__.'/src/Foundation/Exceptions/RequestException.php',
88+
RemoveEmptyClassMethodRector::class => [
89+
__DIR__.'/app/Providers/AppServiceProvider.php',
10090
],
10191
StaticClosureRector::class => [
10292
__DIR__.'/tests',
10393
],
104-
StringToClassConstantRector::class => [
105-
__DIR__.'/src/Foundation/Rfc',
106-
__DIR__.'/src/*/Messages/*.php',
107-
__DIR__.'/tests',
108-
__DIR__.'/src/Foundation/Support/Utils.php',
109-
__DIR__.'/src/Foundation/Response.php',
110-
],
111-
// SortAssociativeArrayByKeyRector::class => [
112-
// __DIR__.'/src',
113-
// __DIR__.'/tests',
114-
// ],
11594

11695
// paths
11796
__DIR__.'/tests.php',
@@ -132,8 +111,8 @@
132111
]);
133112

134113
$rectorConfig->sets([
135-
DowngradeLevelSetList::DOWN_TO_PHP_74,
136-
LevelSetList::UP_TO_PHP_74,
114+
// DowngradeLevelSetList::DOWN_TO_PHP_83,
115+
LevelSetList::UP_TO_PHP_83,
137116
SetList::CODE_QUALITY,
138117
SetList::CODING_STYLE,
139118
SetList::DEAD_CODE,
@@ -145,7 +124,7 @@
145124
SetList::EARLY_RETURN,
146125
SetList::INSTANCEOF,
147126

148-
PHPUnitSetList::PHPUNIT_90,
127+
PHPUnitSetList::PHPUNIT_100,
149128
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
150129
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
151130
]);

tests/Unit/ExampleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
* @see https://github.com/guanguans/favorite-link
1212
*/
1313

14-
test('example', function (): void {
14+
it('example', function (): void {
1515
expect(true)->toBeTrue();
1616
});

0 commit comments

Comments
 (0)