src/IllegalInputKey.php
public static function illegal(
        object $collection,
        string $key
    ): CannotDeserialize {
        return new IllegalInputKey(withMessage(
            'Invalid collection deserialization input: Unexpected key `%s` for the `%s` class.',
            $key,
            classOfThe($collection)
        ));
    }
public static function illegal(
        object $collection,
        string $key
    ): CannotDeserialize {
        return new IllegalInputKey(withMessage(
            'Invalid collection deserialization input: Unexpected key `%s` for the `%s` class.',
            $key,
            classOfThe($collection)
        ));
    }
public static function illegal ( object $ collection , string $ key ) : CannotDeserialize { return new IllegalInputKey ( withMessage ( 'Invalid collection deserialization input: Unexpected key `%s` for the `%s` class.' , $ key , classOfThe ( $ collection ) ) ) ; }
Produces a deserialization exception to throw when a collection input key
is not considered valid.

@param object $collection The collection that was assigned the illegal
input key.
@param string $key        The input key that was considered invalid.
@return CannotDeserialize The deserialization exception to throw.
Produces a deserialization exception to throw when a collection input key is not considered valid .