TransitionWasFailed   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 26
ccs 4
cts 8
cp 0.5
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A exception() 0 3 1
A transition() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "TransitionWasFailed.php" doesn't match the expected filename "transitionwasfailed.php"
Loading history...
2
3
namespace Star\Component\State\Event;
4
5
use Symfony\Contracts\EventDispatcher\Event;
6
7
final class TransitionWasFailed extends Event implements StateEvent
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
8
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class TransitionWasFailed
Loading history...
9
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
10
     * @var string
11
     */
12
    private $transition;
0 ignored issues
show
Coding Style introduced by
Private member variable "transition" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style introduced by
Private member variable "transition" must be prefixed with an underscore
Loading history...
13
14
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
15
     * @var \Throwable
16
     */
17
    private $exception;
0 ignored issues
show
Coding Style introduced by
Private member variable "exception" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "exception" must be prefixed with an underscore
Loading history...
18
19 11
    public function __construct(string $transition, \Throwable $exception)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Missing function doc comment
Loading history...
20
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
21 11
        $this->transition = $transition;
22 11
        $this->exception = $exception;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
23 11
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end __construct()
Loading history...
24
25
    public function transition(): string
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
26
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
27
        return $this->transition;
28
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end transition()
Loading history...
29
30
    public function exception(): \Throwable
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
31
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
32
        return $this->exception;
33
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end exception()
Loading history...
34
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
35