Skip to content

Commit

Permalink
chore(php): optimize rector.php file
Browse files Browse the repository at this point in the history
- Comment out unused defines for MHASH_XXH3, MHASH_XXH32, MHASH_XXH64, MHASH_XXH128
- Add ExplicitReturnNullRector to the list of rectors
  • Loading branch information
guanguans committed Apr 22, 2024
1 parent 2c17990 commit 598c813
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Guanguans\Notify\Foundation\Rectors\HasOptionsDocCommentRector;
use Guanguans\Notify\Foundation\Rectors\ToInternalExceptionRector;
use GuzzleHttp\RequestOptions;
use Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector;
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
Expand All @@ -43,10 +44,10 @@
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
\define('MHASH_XXH3', 2 << 0);
\define('MHASH_XXH32', 2 << 1);
\define('MHASH_XXH64', 2 << 2);
\define('MHASH_XXH128', 2 << 3);
// \define('MHASH_XXH3', 2 << 0);
// \define('MHASH_XXH32', 2 << 1);
// \define('MHASH_XXH64', 2 << 2);
// \define('MHASH_XXH128', 2 << 3);
$rectorConfig->importNames(false, false);
$rectorConfig->importShortClasses(false);
$rectorConfig->parallel(240);
Expand Down Expand Up @@ -91,6 +92,7 @@
LogicalToBooleanRector::class,
NewlineAfterStatementRector::class,
RemoveUselessReturnTagRector::class,
ExplicitReturnNullRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
SensitiveHereNowDocRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
Expand Down Expand Up @@ -137,6 +139,11 @@
'**/__snapshots__*',
]);

// This is magic but it works.
$rectorConfig->rules([
HasOptionsDocCommentRector::class,
]);

$rectorConfig->sets([
DowngradeLevelSetList::DOWN_TO_PHP_74,
LevelSetList::UP_TO_PHP_74,
Expand Down Expand Up @@ -187,7 +194,7 @@
$rectorConfig->rules([
SortAssociativeArrayByKeyRector::class,
HasHttpClientDocCommentRector::class,
HasOptionsDocCommentRector::class,
// HasOptionsDocCommentRector::class,
ToInternalExceptionRector::class,
]);

Expand Down

0 comments on commit 598c813

Please sign in to comment.