Issues (1)

src/IllegalInputKey.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\Deserializer;
5
6
use InvalidArgumentException;
7
use function get_class;
8
use function sprintf;
9
10
/**
11
 * Notifies the client that the input could not be accepted due to an illegal key.
12
 *
13
 * @author Stratadox
14
 */
15
final class IllegalInputKey extends InvalidArgumentException implements DeserializationFailure
16
{
17
    /**
18
     * Produces a deserialization exception to throw when a collection input key
19
     * is not considered valid.
20
     *
21
     * @param object  $collection     The collection that was assigned the
22
     *                                illegal input key.
23
     * @param string  $key            The input key that was considered invalid.
24
     * @param mixed[] $input          The input data that was provided.
25
     * @return DeserializationFailure The deserialization exception to throw.
26
     */
27
    public static function illegal(
28
        object $collection,
29
        string $key,
30
        array $input
0 ignored issues
show
The parameter $input 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

30
        /** @scrutinizer ignore-unused */ array $input

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...
31
    ): DeserializationFailure {
32
        return new IllegalInputKey(sprintf(
33
            'Invalid collection deserialization input: Unexpected key `%s` for the `%s` class.',
34
            $key,
35
            get_class($collection)
36
        ));
37
    }
38
}
39