-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphparkitect.php
More file actions
42 lines (34 loc) · 1.33 KB
/
Copy pathphparkitect.php
File metadata and controls
42 lines (34 loc) · 1.33 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
<?php
declare(strict_types=1);
use Arkitect\ClassSet;
use Arkitect\CLI\Config;
use Arkitect\Expression\ForClasses\HaveNameMatching;
use Arkitect\Expression\ForClasses\NotContainDocBlockLike;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\Rule;
return static function (Config $config): void {
$mvcClassSet = ClassSet::fromDir(
__DIR__.'/app',
__DIR__.'/tests',
);
$rules = [];
$rules[] = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App\Controller'))
->should(new HaveNameMatching('*Controller'))
->because('Append controller classes with Controller suffix');
$rules[] = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App\Repositories'))
->should(new HaveNameMatching('*Repository'))
->because('Append repositories with Repository suffix');
// $rules[] = Rule::allClasses()
// ->that(new ResideInOneOfTheseNamespaces('Tests'))
// ->should(new HaveNameMatching('*Test'))
// ->because('Append tests with Test suffix');
//
// $rules[] = Rule::allClasses()
// ->that(new ResideInOneOfTheseNamespaces('Tests'))
// ->should(new NotContainDocBlockLike('@test'))
// ->because('Use #[Test] attribute instead');
$config
->add($mvcClassSet, ...$rules);
};