Issues (12)

config/state-machine.php (1 issue)

Labels
Severity
1
<?php
2
3
return [
4
    'graphA' => [
5
        // class of your domain object
6
        'class' => App\User::class,
0 ignored issues
show
The type App\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
        // name of the graph (default is "default")
9
        'graph' => 'graphA',
10
11
        // property of your object holding the actual state (default is "state")
12
        'property_path' => 'state',
13
14
        'metadata' => [
15
            'title' => 'Graph A',
16
        ],
17
18
        // list of all possible states
19
        'states' => [
20
            // a state as associative array
21
            ['name' => 'new'],
22
            // a state as associative array with metadata
23
            [
24
                'name' => 'pending_review',
25
                'metadata' => ['title' => 'Pending Review'],
26
            ],
27
            // states as string
28
            'awaiting_changes',
29
            'accepted',
30
            'published',
31
            'rejected',
32
        ],
33
34
        // list of all possible transitions
35
        'transitions' => [
36
            'create' => [
37
                'from' => ['new'],
38
                'to' => 'pending_review',
39
            ],
40
            'ask_for_changes' => [
41
                'from' => ['pending_review', 'accepted'],
42
                'to' => 'awaiting_changes',
43
                'metadata' => ['title' => 'Ask for changes'],
44
            ],
45
            'cancel_changes' => [
46
                'from' => ['awaiting_changes'],
47
                'to' => 'pending_review',
48
            ],
49
            'submit_changes' => [
50
                'from' => ['awaiting_changes'],
51
                'to' => 'pending_review',
52
            ],
53
            'approve' => [
54
                'from' => ['pending_review', 'rejected'],
55
                'to' => 'accepted',
56
            ],
57
            'publish' => [
58
                'from' => ['accepted'],
59
                'to' => 'published',
60
            ],
61
        ],
62
63
        // list of all callbacks
64
        'callbacks' => [
65
            // will be called when testing a transition
66
            'guard' => [
67
                'guard_on_submitting' => [
68
                    // call the callback on a specific transition
69
                    'on' => 'submit_changes',
70
                    // will call the method of this class
71
                    'do' => ['MyClass', 'handle'],
72
                    // arguments for the callback
73
                    'args' => ['object'],
74
                ],
75
                'guard_on_approving' => [
76
                    // call the callback on a specific transition
77
                    'on' => 'approve',
78
                    // will check the ability on the gate or the class policy
79
                    'can' => 'approve',
80
                ],
81
            ],
82
83
            // will be called before applying a transition
84
            'before' => [],
85
86
            // will be called after applying a transition
87
            'after' => [],
88
        ],
89
    ],
90
];
91