forked from PGSSoft/HashId
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector-php83.php
More file actions
54 lines (45 loc) · 1.69 KB
/
rector-php83.php
File metadata and controls
54 lines (45 loc) · 1.69 KB
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
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
/**
* PHP 8.3 Features Configuration
*
* Implements PHP 8.3 modernization features for the HashId Bundle.
* This configuration applies PHP 8.3 specific transformations including:
* - Typed class constants
* - Override attribute for inherited methods
* - Anonymous readonly classes
* - json_validate() function usage
*/
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$rectorConfig->skip([
__DIR__ . '/tests/Fixtures',
__DIR__ . '/tests/App',
__DIR__ . '/var',
__DIR__ . '/vendor',
]);
// Import PHP 8.3 rules from Rector
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_83,
]);
// Additional PHP 8.3 specific rules
$rectorConfig->rule(AddOverrideAttributeToOverriddenMethodsRector::class);
// Note: Some PHP 8.3 features require manual implementation:
// - Typed class constants (no automatic Rector rule yet)
// - Dynamic class constant fetch (syntax-specific, manual implementation)
// - json_validate() replacement (context-specific logic)
// - Anonymous readonly classes (manual for test fixtures)
// Configure Rector for optimal performance
$rectorConfig->parallel();
$rectorConfig->cacheDirectory(__DIR__ . '/var/cache/rector');
// Import names for cleaner code
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
};