for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* Copyright (c) Nate Brunette.
* Distributed under the MIT License (http://opensource.org/licenses/MIT)
*/
declare(strict_types=1);
namespace Tebru\Retrofit\Internal\AnnotationHandler;
use Tebru\AnnotationReader\AbstractAnnotation;
use Tebru\Retrofit\AnnotationHandler;
use Tebru\Retrofit\Converter;
use Tebru\Retrofit\Internal\ParameterHandler\HeaderMapParamHandler;
use Tebru\Retrofit\ServiceMethodBuilder;
use Tebru\Retrofit\StringConverter;
/**
* Class HeaderMapAnnotHandler
*
* @author Nate Brunette <[email protected]>
final class HeaderMapAnnotHandler implements AnnotationHandler
{
* Adds header map param handler
* @param AbstractAnnotation $annotation The annotation to handle
* @param ServiceMethodBuilder $serviceMethodBuilder Used to construct a [@see ServiceMethod]
* @param null|Converter|StringConverter $converter Converter used to convert types before sending to service method
* @param int|null $index The position of the parameter or null if annotation does not reference parameter
* @return void
public function handle(
AbstractAnnotation $annotation,
ServiceMethodBuilder $serviceMethodBuilder,
?Converter $converter,
?int $index
): void {
$serviceMethodBuilder->addParameterHandler($index, new HeaderMapParamHandler($converter));
$converter
null|object<Tebru\Retrofit\Converter>
object<Tebru\Retrofit\StringConverter>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
}
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: