GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#56)
by Arthur
03:40 queued 01:33
created

DataTransferObjectError::immutable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spatie\DataTransferObject;
6
7
use TypeError;
8
9
class DataTransferObjectError extends TypeError
10
{
11
    public static function unknownProperties(array $properties, string $className): DataTransferObjectError
12
    {
13
        $propertyNames = implode('`, `', $properties);
14
15
        return new static("Public properties `{$propertyNames}` not found on {$className}");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Public properties `{$pr... found on {$className}".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
16
    }
17
18
    public static function propertyNotFound(string $property, string $className): DataTransferObjectError
19
    {
20
        return new static("Property `{$property}` not found on {$className}");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Property `{$property}` ... found on {$className}".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21
    }
22
23
    public static function invalidType(Property $property, $value): DataTransferObjectError
24
    {
25
        if ($value === null) {
26
            $value = 'null';
27
        }
28
29
        if (is_object($value)) {
30
            $value = get_class($value);
31
        }
32
33
        if (is_array($value)) {
34
            $value = 'array';
35
        }
36
37
        $expectedTypes = implode(', ', $property->getTypes());
38
39
        return new static("Invalid type: expected {$property->getFqn()} to be of type {$expectedTypes}, instead got value `{$value}`.");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Invalid type: expected ... got value `{$value}`.".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
40
    }
41
42
    public static function uninitialized(Property $property): DataTransferObjectError
43
    {
44
        return new static("Non-nullable property {$property->getFqn()} has not been initialized.");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Non-nullable property {... not been initialized.".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
45
    }
46
47
    public static function immutable(string $property): DataTransferObjectError
48
    {
49
        return new static("Cannot change the value of property {$property} on an immutable data transfer object");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Cannot change the value...e data transfer object".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
50
    }
51
52
    public static function immutableProperty(string $property): DataTransferObjectError
53
    {
54
        return new static("Cannot change the value of property {$property}. It is immutable!");
0 ignored issues
show
Unused Code introduced by
The call to DataTransferObjectError::__construct() has too many arguments starting with "Cannot change the value...rty}. It is immutable!".

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
55
    }
56
}
57