forked from mongodb/mongo-php-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
43 lines (38 loc) · 1.59 KB
/
rector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector;
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/examples',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tools',
]);
// Modernize code
$rectorConfig->sets([LevelSetList::UP_TO_PHP_74]);
$rectorConfig->skip([
// Falsely detect unassigned variables in code paths stopped by PHPUnit\Framework\Assert::markTestSkipped()
AddDefaultValueForUndefinedVariableRector::class => [
__DIR__ . '/tests/',
],
// @see https://github.com/phpstan/phpstan-src/pull/2429
RemoveExtraParametersRector::class => [
__DIR__ . '/src/Operation/',
],
// Assigns wrong type due to outdated PHPStan stubs
TypedPropertyFromAssignsRector::class => [
__DIR__ . '/src/Model/BSONIterator.php',
],
// Not necessary in documentation examples
JsonThrowOnErrorRector::class => [
__DIR__ . '/tests/DocumentationExamplesTest.php',
],
]);
// All classes are public API by default, unless marked with @internal.
$rectorConfig->ruleWithConfiguration(RemoveAnnotationRector::class, ['api']);
};