Skip to content

Commit 8496097

Browse files
committed
feat(set): Add Pest testing set configuration
- Introduces a new Pest set file with specific Rector rules for Pest tests - Adds Pest set to the list of imported sets in all.php for comprehensive code analysis - Enhances compatibility and consistency for projects using Pest testing framework
1 parent b93f2df commit 8496097

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

config/set/all.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
$rectorConfig->import(__DIR__.'/../config.php');
2121
$rectorConfig->sets([
2222
SetList::COMMON,
23+
SetList::PEST,
2324
SetList::PHPBENCH,
2425
SetList::PHPSTAN,
2526
SetList::RECTOR,

config/set/common.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Guanguans\RectorRules\Rector\FunctionLike\RenameGarbageParamNameRector;
2121
use Guanguans\RectorRules\Rector\Namespace_\RemoveNamespaceRector;
2222
use Rector\Config\RectorConfig;
23+
use Rector\Php82\Rector\Param\AddSensitiveParameterAttributeRector;
2324

2425
return static function (RectorConfig $rectorConfig): void {
2526
$rectorConfig->import(__DIR__.'/../config.php');
@@ -31,4 +32,19 @@
3132
SortFileFunctionStmtRector::class,
3233
// SortListItemOfSameScalarTypeRector::class,
3334
]);
35+
36+
$rectorConfig->ruleWithConfiguration(AddSensitiveParameterAttributeRector::class, [
37+
AddSensitiveParameterAttributeRector::SENSITIVE_PARAMETERS => [
38+
'accessToken',
39+
'apiKey',
40+
'botApiKey',
41+
'key',
42+
'password',
43+
'pushKey',
44+
'secret',
45+
'tempKey',
46+
'token',
47+
'webHook',
48+
],
49+
]);
3450
};

config/set/laravel/laravel-common.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@
1616
use Carbon\Carbon;
1717
use Illuminate\Support\Carbon as IlluminateCarbon;
1818
use Rector\Config\RectorConfig;
19+
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
1920
use Rector\Renaming\Rector\Name\RenameClassRector;
2021

2122
return static function (RectorConfig $rectorConfig): void {
2223
$rectorConfig->import(__DIR__.'/../../config.php');
2324
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
2425
Carbon::class => IlluminateCarbon::class,
2526
]);
27+
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
28+
'faker' => 'fake',
29+
'Pest\Faker\fake' => 'fake',
30+
'Pest\Faker\faker' => 'fake',
31+
]);
2632
};

config/set/pest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/** @noinspection PhpInternalEntityUsedInspection */
4+
5+
declare(strict_types=1);
6+
7+
/**
8+
* Copyright (c) 2025-2026 guanguans<ityaozm@gmail.com>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*
13+
* @see https://github.com/guanguans/rector-rules
14+
*/
15+
16+
use Rector\Config\RectorConfig;
17+
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
18+
19+
return static function (RectorConfig $rectorConfig): void {
20+
$rectorConfig->import(__DIR__.'/../config.php');
21+
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
22+
'test' => 'it',
23+
]);
24+
};

src/Set/SetList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ final class SetList
2323
public const LARAVEL_80 = __DIR__.'/../../config/set/laravel/laravel-80.php';
2424
public const LARAVEL_90 = __DIR__.'/../../config/set/laravel/laravel-90.php';
2525
public const LARAVEL_COMMON = __DIR__.'/../../config/set/laravel/laravel-common.php';
26+
public const PEST = __DIR__.'/../../config/set/pest.php';
2627
public const PHPBENCH = __DIR__.'/../../config/set/phpbench.php';
2728
public const PHPSTAN = __DIR__.'/../../config/set/phpstan.php';
2829
public const RECTOR = __DIR__.'/../../config/set/rector.php';

0 commit comments

Comments
 (0)