|
27 | 27 | 'accessibleFields' => 'patchableFields', |
28 | 28 | ]); |
29 | 29 |
|
| 30 | + $staticReturnTypeMap = [ |
| 31 | + 'Cake\Console\BaseCommand' => ['setName'], |
| 32 | + 'Cake\Controller\Controller' => [ |
| 33 | + 'setName', 'setPlugin', 'enableAutoRender', 'disableAutoRender', 'addViewClasses', |
| 34 | + ], |
| 35 | + 'Cake\Core\BasePlugin' => ['enable', 'disable'], |
| 36 | + 'Cake\Core\PluginApplicationInterface' => ['addPlugin'], |
| 37 | + 'Cake\Core\PluginInterface' => ['enable', 'disable'], |
| 38 | + 'Cake\Database\TypedResultInterface' => ['setReturnType'], |
| 39 | + 'Cake\Datasource\EntityInterface' => [ |
| 40 | + 'setHidden', 'setVirtual', 'setDirty', 'setErrors', 'setError', 'setAccess', |
| 41 | + 'setPatchable', 'setSource', 'set', 'unset', 'setNew', |
| 42 | + ], |
| 43 | + 'Cake\Datasource\InvalidPropertyInterface' => ['setInvalid', 'setInvalidField'], |
| 44 | + 'Cake\Datasource\RepositoryInterface' => ['setAlias', 'setRegistryAlias'], |
| 45 | + 'Cake\Event\EventInterface' => ['setResult', 'setData'], |
| 46 | + 'Cake\Form\Form' => ['setSchema', 'setErrors', 'set', 'setData'], |
| 47 | + 'Cake\Http\BaseApplication' => ['addPlugin', 'addOptionalPlugin'], |
| 48 | + 'Cake\Mailer\Mailer' => ['setRenderer', 'setViewVars', 'render', 'setProfile', 'restore', 'reset'], |
| 49 | + 'Cake\ORM\Behavior\Translate\TranslateStrategyInterface' => ['setLocale'], |
| 50 | + 'Cake\ORM\Locator\LocatorInterface' => ['setConfig'], |
| 51 | + 'Cake\ORM\Table' => [ |
| 52 | + 'setTable', 'setAlias', 'setRegistryAlias', 'setConnection', 'setSchema', |
| 53 | + 'setPrimaryKey', 'setDisplayField', 'setEntityClass', 'addBehavior', |
| 54 | + 'addBehaviors', 'removeBehavior', 'addAssociations', |
| 55 | + 'setRequest', 'setResponse', 'setTemplatePath', |
| 56 | + 'enableAutoLayout', 'disableAutoLayout', 'setTheme', 'setTemplate', |
| 57 | + 'set', 'start', 'append', 'assign', 'reset', 'end', 'extend', |
| 58 | + 'loadHelpers', 'setPlugin', 'setElementCache', |
| 59 | + ], |
| 60 | + ]; |
| 61 | + |
30 | 62 | // For cakephp/cakephp#18115 |
31 | | - $rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [ |
32 | | - new AddReturnTypeDeclaration('Cake\Console\BaseCommand', 'setName', new SimpleStaticType('')), |
33 | | - new AddReturnTypeDeclaration('Cake\Controller\Controller', 'setName', new SimpleStaticType('')), |
34 | | - new AddReturnTypeDeclaration('Cake\Controller\Controller', 'setPlugin', new SimpleStaticType('')), |
35 | | - new AddReturnTypeDeclaration('Cake\Controller\Controller', 'enableAutoRender', new SimpleStaticType('')), |
36 | | - new AddReturnTypeDeclaration('Cake\Controller\Controller', 'disableAutoRender', new SimpleStaticType('')), |
37 | | - new AddReturnTypeDeclaration('Cake\Controller\Controller', 'addViewClasses', new SimpleStaticType('')), |
38 | | - new AddReturnTypeDeclaration('Cake\Core\BasePlugin', 'enable', new SimpleStaticType('')), |
39 | | - new AddReturnTypeDeclaration('Cake\Core\BasePlugin', 'disable', new SimpleStaticType('')), |
40 | | - new AddReturnTypeDeclaration('Cake\Core\PluginApplicationInterface', 'addPlugin', new SimpleStaticType('')), |
41 | | - new AddReturnTypeDeclaration('Cake\Core\PluginInterface', 'disable', new SimpleStaticType('')), |
42 | | - new AddReturnTypeDeclaration('Cake\Core\PluginInterface', 'enable', new SimpleStaticType('')), |
43 | | - new AddReturnTypeDeclaration('Cake\Core\PluginInterface', 'enable', new SimpleStaticType('')), |
44 | | - new AddReturnTypeDeclaration('Cake\Database\TypedResultInterface', 'setReturnType', new SimpleStaticType('')), |
45 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setHidden', new SimpleStaticType('')), |
46 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setVirtual', new SimpleStaticType('')), |
47 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setDirty', new SimpleStaticType('')), |
48 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setErrors', new SimpleStaticType('')), |
49 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setError', new SimpleStaticType('')), |
50 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setAccess', new SimpleStaticType('')), |
51 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setPatchable', new SimpleStaticType('')), |
52 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setSource', new SimpleStaticType('')), |
53 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'set', new SimpleStaticType('')), |
54 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'unset', new SimpleStaticType('')), |
55 | | - new AddReturnTypeDeclaration('Cake\Datasource\EntityInterface', 'setNew', new SimpleStaticType('')), |
56 | | - new AddReturnTypeDeclaration('Cake\Datasource\InvalidPropertyInterface', 'setInvalid', new SimpleStaticType('')), |
57 | | - new AddReturnTypeDeclaration('Cake\Datasource\InvalidPropertyInterface', 'setInvalidField', new SimpleStaticType('')), |
58 | | - new AddReturnTypeDeclaration('Cake\Datasource\RepositoryInterface', 'setAlias', new SimpleStaticType('')), |
59 | | - new AddReturnTypeDeclaration('Cake\Datasource\RepositoryInterface', 'setRegistryAlias', new SimpleStaticType('')), |
60 | | - new AddReturnTypeDeclaration('Cake\Event\EventInterface', 'setResult', new SimpleStaticType('')), |
61 | | - new AddReturnTypeDeclaration('Cake\Event\EventInterface', 'setData', new SimpleStaticType('')), |
62 | | - new AddReturnTypeDeclaration('Cake\Form\Form', 'setSchema', new SimpleStaticType('')), |
63 | | - new AddReturnTypeDeclaration('Cake\Form\Form', 'setErrors', new SimpleStaticType('')), |
64 | | - new AddReturnTypeDeclaration('Cake\Form\Form', 'set', new SimpleStaticType('')), |
65 | | - new AddReturnTypeDeclaration('Cake\Form\Form', 'setData', new SimpleStaticType('')), |
66 | | - new AddReturnTypeDeclaration('Cake\Http\BaseApplication', 'addPlugin', new SimpleStaticType('')), |
67 | | - new AddReturnTypeDeclaration('Cake\Http\BaseApplication', 'addOptionalPlugin', new SimpleStaticType('')), |
68 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'setRenderer', new SimpleStaticType('')), |
69 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'setViewVars', new SimpleStaticType('')), |
70 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'render', new SimpleStaticType('')), |
71 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'setProfile', new SimpleStaticType('')), |
72 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'restore', new SimpleStaticType('')), |
73 | | - new AddReturnTypeDeclaration('Cake\Mailer\Mailer', 'reset', new SimpleStaticType('')), |
74 | | - new AddReturnTypeDeclaration('Cake\ORM\Behavior\Translate\TranslateStrategyInterface', 'setLocale', new SimpleStaticType('')), |
75 | | - new AddReturnTypeDeclaration('Cake\ORM\Locator\LocatorInterface', 'setConfig', new SimpleStaticType('')), |
76 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setTable', new SimpleStaticType('')), |
77 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setAlias', new SimpleStaticType('')), |
78 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setRegistryAlias', new SimpleStaticType('')), |
79 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setConnection', new SimpleStaticType('')), |
80 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setSchema', new SimpleStaticType('')), |
81 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setPrimaryKey', new SimpleStaticType('')), |
82 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setDisplayField', new SimpleStaticType('')), |
83 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'setEntityClass', new SimpleStaticType('')), |
84 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'addBehavior', new SimpleStaticType('')), |
85 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'addBehaviors', new SimpleStaticType('')), |
86 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'removeBehavior', new SimpleStaticType('')), |
87 | | - new AddReturnTypeDeclaration('Cake\ORM\Table', 'addAssociations', new SimpleStaticType('')), |
88 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setRequest', new SimpleStaticType('')), |
89 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setResponse', new SimpleStaticType('')), |
90 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setTemplatePath', new SimpleStaticType('')), |
91 | | - new AddReturnTypeDeclaration('Cake\View\View', 'enableAutoLayout', new SimpleStaticType('')), |
92 | | - new AddReturnTypeDeclaration('Cake\View\View', 'disableAutoLayout', new SimpleStaticType('')), |
93 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setTheme', new SimpleStaticType('')), |
94 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setTemplate', new SimpleStaticType('')), |
95 | | - new AddReturnTypeDeclaration('Cake\View\View', 'set', new SimpleStaticType('')), |
96 | | - new AddReturnTypeDeclaration('Cake\View\View', 'start', new SimpleStaticType('')), |
97 | | - new AddReturnTypeDeclaration('Cake\View\View', 'append', new SimpleStaticType('')), |
98 | | - new AddReturnTypeDeclaration('Cake\View\View', 'assign', new SimpleStaticType('')), |
99 | | - new AddReturnTypeDeclaration('Cake\View\View', 'reset', new SimpleStaticType('')), |
100 | | - new AddReturnTypeDeclaration('Cake\View\View', 'end', new SimpleStaticType('')), |
101 | | - new AddReturnTypeDeclaration('Cake\View\View', 'extend', new SimpleStaticType('')), |
102 | | - new AddReturnTypeDeclaration('Cake\View\View', 'loadHelpers', new SimpleStaticType('')), |
103 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setPlugin', new SimpleStaticType('')), |
104 | | - new AddReturnTypeDeclaration('Cake\View\View', 'setElementCache', new SimpleStaticType('')), |
105 | | - ]); |
| 63 | + foreach ($staticReturnTypeMap as $className => $methods) { |
| 64 | + foreach ($methods as $method) { |
| 65 | + $rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [ |
| 66 | + new AddReturnTypeDeclaration($className, $method, new SimpleStaticType($className)), |
| 67 | + ]); |
| 68 | + } |
| 69 | + } |
106 | 70 |
|
107 | 71 | // ===== Remove underscores from method names ===== |
108 | 72 |
|
|
0 commit comments