|
10 | 10 | * For the full copyright and license information, please view |
11 | 11 | * the LICENSE file that was distributed with this source code. |
12 | 12 | */ |
13 | | -use Boundwize\StructArmed\Rule\Rules\Function_\MustHaveReturnTypeFunctionRule; |
| 13 | + |
| 14 | +use Boundwize\StructArmed\Architecture; |
| 15 | +use Boundwize\StructArmed\Preset\Preset; |
14 | 16 | use Boundwize\StructArmed\Preset\Presets\CodeQualityPreset; |
| 17 | +use Boundwize\StructArmed\Preset\Presets\Psr4Preset; |
| 18 | +use Boundwize\StructArmed\Rule\Rules\Class_\ExtendedClassMustBeAbstractOrInstantiatedRule; |
| 19 | +use Boundwize\StructArmed\Rule\Rules\Function_\MustHaveReturnTypeFunctionRule; |
15 | 20 | use CodeIgniter\Cache\ResponseCache; |
| 21 | +use CodeIgniter\Database\BaseResult; |
| 22 | +use CodeIgniter\DataCaster\DataCaster; |
| 23 | +use CodeIgniter\DataConverter\DataConverter; |
| 24 | +use CodeIgniter\Entity\Cast\CastInterface; |
| 25 | +use CodeIgniter\Entity\Cast\URICast; |
| 26 | +use CodeIgniter\Entity\Entity; |
| 27 | +use CodeIgniter\Entity\Exceptions\CastException; |
16 | 28 | use CodeIgniter\HTTP\CLIRequest; |
| 29 | +use CodeIgniter\HTTP\DownloadResponse; |
17 | 30 | use CodeIgniter\HTTP\Header; |
18 | 31 | use CodeIgniter\HTTP\IncomingRequest; |
| 32 | +use CodeIgniter\HTTP\RedirectResponse; |
| 33 | +use CodeIgniter\HTTP\Response; |
19 | 34 | use CodeIgniter\HTTP\ResponseInterface; |
20 | | -use CodeIgniter\DataCaster\DataCaster; |
21 | | -use CodeIgniter\Entity\Cast\CastInterface; |
22 | | -use CodeIgniter\Entity\Exceptions\CastException; |
23 | | -use CodeIgniter\DataConverter\DataConverter; |
24 | | -use CodeIgniter\Entity\Entity; |
25 | | -use CodeIgniter\Entity\Cast\URICast; |
| 35 | +use CodeIgniter\HTTP\ResponseTrait; |
| 36 | +use CodeIgniter\HTTP\SSEResponse; |
| 37 | +use CodeIgniter\HTTP\StreamResponse; |
26 | 38 | use CodeIgniter\HTTP\URI; |
27 | 39 | use CodeIgniter\Log\Handlers\ChromeLoggerHandler; |
28 | | -use CodeIgniter\Security\CheckPhpIni; |
29 | | -use CodeIgniter\View\Table; |
30 | | -use CodeIgniter\Database\BaseResult; |
31 | | -use CodeIgniter\View\Plugins; |
32 | | -use CodeIgniter\HTTP\ResponseTrait; |
33 | 40 | use CodeIgniter\Pager\PagerInterface; |
34 | | -use CodeIgniter\HTTP\Response; |
35 | | -use CodeIgniter\HTTP\RedirectResponse; |
36 | | -use CodeIgniter\HTTP\DownloadResponse; |
| 41 | +use CodeIgniter\Security\CheckPhpIni; |
37 | 42 | use CodeIgniter\Validation\Validation; |
| 43 | +use CodeIgniter\View\Plugins; |
38 | 44 | use CodeIgniter\View\RendererInterface; |
39 | | -use Boundwize\StructArmed\Architecture; |
40 | | -use Boundwize\StructArmed\Preset\Preset; |
41 | | -use Boundwize\StructArmed\Preset\Presets\Psr4Preset; |
| 45 | +use CodeIgniter\View\Table; |
42 | 46 |
|
43 | 47 | return Architecture::define() |
44 | 48 | ->skip([ |
|
56 | 60 | ->layer('Helpers', __DIR__ . '/system/Helpers') |
57 | 61 | ->rule('helpers.functions_must_have_return_type', new MustHaveReturnTypeFunctionRule('Helpers')) |
58 | 62 |
|
| 63 | + ->rule('base_classes.must_be_abstract', new ExtendedClassMustBeAbstractOrInstantiatedRule('Source', '/^CodeIgniter\\\\.*Base.*$/')) |
| 64 | + |
59 | 65 | // Resolve CodeIgniter layers from class names because several layers share directories. |
60 | 66 | ->layerPattern('API', '/^CodeIgniter\\\\API\\\\.*$/') |
61 | 67 | ->layerPattern('Cache', '/^CodeIgniter\\\\Cache\\\\.*$/') |
|
72 | 78 | ->layerPattern('Filters', '/^CodeIgniter\\\\Filters\\\\Filter.*$/') |
73 | 79 | ->layerPattern('Format', '/^CodeIgniter\\\\Format\\\\.*$/') |
74 | 80 | ->layerPattern('Honeypot', '/^CodeIgniter\\\\.*Honeypot.*$/') |
| 81 | + ->layerPattern('Input', '/^CodeIgniter\\\\Input\\\\.*$/') |
75 | 82 | ->layerPattern('URI', '/^CodeIgniter\\\\HTTP\\\\URI$/') |
76 | 83 | ->layerPattern('HTTP', '/^CodeIgniter\\\\HTTP\\\\.*$/', '/(Exception|URI)/') |
77 | 84 | ->layerPattern('I18n', '/^CodeIgniter\\\\I18n\\\\.*$/') |
78 | 85 | ->layerPattern('Images', '/^CodeIgniter\\\\Images\\\\.*$/') |
79 | 86 | ->layerPattern('Language', '/^CodeIgniter\\\\Language\\\\.*$/') |
| 87 | + ->layerPattern('Lock', '/^CodeIgniter\\\\Lock\\\\.*$/') |
80 | 88 | ->layerPattern('Log', '/^CodeIgniter\\\\Log\\\\.*$/') |
81 | 89 | ->layerPattern('Model', '/^CodeIgniter\\\\.*Model$/') |
82 | 90 | ->layerPattern('Modules', '/^CodeIgniter\\\\Modules\\\\.*$/') |
|
96 | 104 | 'Controller' => ['HTTP', 'Validation'], |
97 | 105 | 'Cookie' => ['I18n'], |
98 | 106 | 'Database' => ['Entity', 'Events', 'I18n'], |
99 | | - 'DataCaster' => ['I18n', 'URI', 'Database'], |
| 107 | + 'DataCaster' => ['I18n', 'URI', 'Database', 'Encryption'], |
100 | 108 | 'DataConverter' => ['DataCaster'], |
101 | 109 | 'Email' => ['I18n', 'Events'], |
102 | 110 | 'Entity' => ['DataCaster', 'I18n'], |
103 | 111 | 'Files' => ['I18n'], |
104 | 112 | 'Filters' => ['HTTP'], |
105 | 113 | 'Honeypot' => ['Filters', 'HTTP'], |
106 | | - 'HTTP' => ['Cookie', 'Files', 'I18n', 'Security', 'URI'], |
| 114 | + 'HTTP' => ['Cookie', 'Files', 'I18n', 'Input', 'Security', 'URI'], |
| 115 | + 'Input' => ['I18n'], |
107 | 116 | 'Images' => ['Files', 'I18n'], |
| 117 | + 'Lock' => ['Cache'], |
108 | 118 | 'Model' => ['Database', 'DataCaster', 'DataConverter', 'Entity', 'I18n', 'Pager', 'Validation'], |
109 | 119 | 'Pager' => ['URI', 'View'], |
110 | 120 | 'Publisher' => ['Files', 'URI'], |
111 | 121 | // +API = API + its allowed layers; +Controller = Controller + its allowed layers |
112 | | - 'RESTful' => ['+API', '+Controller'], |
113 | | - 'Router' => ['HTTP', 'I18n'], |
114 | | - 'Security' => ['Cookie', 'HTTP', 'I18n', 'Session'], |
115 | | - 'Session' => ['Cookie', 'Database', 'HTTP', 'I18n'], |
116 | | - 'Throttle' => ['Cache', 'I18n'], |
117 | | - 'Validation' => ['Database', 'HTTP', 'Helpers'], |
118 | | - 'View' => ['Cache'], |
| 122 | + 'RESTful' => ['+API', '+Controller'], |
| 123 | + 'Router' => ['HTTP', 'I18n'], |
| 124 | + 'Security' => ['Cookie', 'HTTP', 'I18n', 'Session'], |
| 125 | + 'Session' => ['Cookie', 'Database', 'HTTP', 'I18n'], |
| 126 | + 'Throttle' => ['Cache', 'I18n'], |
| 127 | + 'Validation' => ['Database', 'HTTP', 'Helpers', 'I18n', 'Input'], |
| 128 | + 'View' => ['Cache'], |
119 | 129 | ]) |
120 | 130 | ->skipPathsForRuleset(['*test*']) |
121 | 131 | // Skip violations for class-specific dependencies. |
|
129 | 139 | CastInterface::class, |
130 | 140 | CastException::class, |
131 | 141 | ]) |
132 | | - ->skipClassViolation(\CodeIgniter\DataCaster\Exceptions\CastException::class, [ |
| 142 | + ->skipClassViolation(CodeIgniter\DataCaster\Exceptions\CastException::class, [ |
133 | 143 | CastException::class, |
134 | 144 | ]) |
135 | 145 | ->skipClassViolation(DataConverter::class, [ |
|
157 | 167 | ->skipClassViolation(Response::class, [PagerInterface::class]) |
158 | 168 | ->skipClassViolation(RedirectResponse::class, [PagerInterface::class]) |
159 | 169 | ->skipClassViolation(DownloadResponse::class, [PagerInterface::class]) |
160 | | - ->skipClassViolation(Validation::class, [RendererInterface::class]); |
| 170 | + ->skipClassViolation(SSEResponse::class, [PagerInterface::class]) |
| 171 | + ->skipClassViolation(StreamResponse::class, [PagerInterface::class]) |
| 172 | + ->skipClassViolation(Validation::class, [RendererInterface::class]) |
| 173 | + |
| 174 | + ->baseline(__DIR__ . '/structarmed-baseline.php'); |
0 commit comments