Passed
Push — master ( c2c3f8...3daf51 )
by Smoren
02:16
created

Exponential::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Sequence\Structs;
6
7
/**
8
 * @template T of int|float
9
 * @extends StepSequence<T>
10
 */
11
class Exponential extends StepSequence
12
{
13
    /**
14
     * @param T $start
15
     * @param int<0, max>|null $size
16
     * @param T $step
0 ignored issues
show
Bug introduced by
The type Smoren\Sequence\Structs\T 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...
17
     */
18 3
    public function __construct($start, ?int $size, $step)
19
    {
20 3
        parent::__construct($start, $size, $step);
21
    }
22
23
    /**
24
     * @param int $index
25
     * @return T
26
     */
27 3
    public function getValueByIndex(int $index)
28
    {
29 3
        return $this->start * ($this->step ** $index);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->start * $this->step ** $index returns the type integer which is incompatible with the documented return type Smoren\Sequence\Structs\T.
Loading history...
30
    }
31
32
    /**
33
     * @param int $previousValue
34
     * @return T
35
     */
36 3
    public function getNextValue($previousValue)
37
    {
38 3
        return $previousValue * $this->step;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $previousValue * $this->step returns the type integer which is incompatible with the documented return type Smoren\Sequence\Structs\T.
Loading history...
39
    }
40
}
41