forked from phparkitect/arkitect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phparkitect.php
29 lines (22 loc) · 941 Bytes
/
phparkitect.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
<?php
declare(strict_types=1);
use Arkitect\ClassSet;
use Arkitect\CLI\Config;
use Arkitect\Expression\ForClasses\Extend;
use Arkitect\Expression\ForClasses\Implement;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\Rule;
return static function (Config $config): void {
$classSet = ClassSet::fromDir(__DIR__.'/src');
$rules = [];
$rules[] = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('Arkitect\Expression\ForClasses'))
->should(new Implement('Arkitect\Expression\Expression'))
->because('we want that all rules for classes implement Expression class.');
$rules[] = Rule::allClasses()
->that(new Extend('Symfony\Component\Console\Command\Command'))
->should(new ResideInOneOfTheseNamespaces('Arkitect\CLI\Command'))
->because('we want find easily all the commands');
$config
->add($classSet, ...$rules);
};