Failed Conditions
Pull Request — master (#47)
by Jordan
07:14 queued 03:12
created

Matrices::zeroMatrix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Samsara\Fermat;
4
5
use Samsara\Fermat\Types\Base\Interfaces\Groups\MatrixInterface;
6
7
class Matrices
8
{
9
    const IMMUTABLE_MATRIX = '';
10
    const MUTABLE_MATRIX = '';
11
12
    public static function zeroMatrix(string $type, int $rows, int $columns): MatrixInterface
0 ignored issues
show
Unused Code introduced by
The parameter $rows is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
    public static function zeroMatrix(string $type, /** @scrutinizer ignore-unused */ int $rows, int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $columns is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
    public static function zeroMatrix(string $type, int $rows, /** @scrutinizer ignore-unused */ int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
    public static function zeroMatrix(/** @scrutinizer ignore-unused */ string $type, int $rows, int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
14
15
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Samsara\Fermat\Types\Bas...\Groups\MatrixInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
16
17
    public static function onesMatrix(string $type, int $rows, int $columns): MatrixInterface
0 ignored issues
show
Unused Code introduced by
The parameter $rows is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public static function onesMatrix(string $type, /** @scrutinizer ignore-unused */ int $rows, int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $columns is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public static function onesMatrix(string $type, int $rows, /** @scrutinizer ignore-unused */ int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public static function onesMatrix(/** @scrutinizer ignore-unused */ string $type, int $rows, int $columns): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
20
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Samsara\Fermat\Types\Bas...\Groups\MatrixInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
21
22
    public static function identityMatrix(string $type, int $size): MatrixInterface
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

22
    public static function identityMatrix(/** @scrutinizer ignore-unused */ string $type, int $size): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $size is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

22
    public static function identityMatrix(string $type, /** @scrutinizer ignore-unused */ int $size): MatrixInterface

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
25
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Samsara\Fermat\Types\Bas...\Groups\MatrixInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
26
27
}