1 | <?php |
||||||||
2 | |||||||||
3 | declare(strict_types=1); |
||||||||
4 | |||||||||
5 | namespace Swis\JsonApi\Client\Actions; |
||||||||
6 | |||||||||
7 | use Swis\JsonApi\Client\Interfaces\ItemInterface; |
||||||||
8 | |||||||||
9 | /** |
||||||||
10 | * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface |
||||||||
11 | */ |
||||||||
12 | trait Update |
||||||||
13 | { |
||||||||
14 | /** |
||||||||
15 | * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem> |
||||||||
16 | */ |
||||||||
17 | 4 | public function update(ItemInterface $item, array $parameters = [], array $headers = []) |
|||||||
18 | { |
||||||||
19 | 4 | return $this->getClient()->patch( |
|||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||||
20 | 4 | $this->getEndpoint().'/'.urlencode($item->getId()).'?'.http_build_query($parameters), |
|||||||
0 ignored issues
–
show
It seems like
getEndpoint() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() It seems like
$item->getId() can also be of type null ; however, parameter $string of urlencode() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
21 | 4 | $this->documentFactory->make($item), |
|||||||
22 | 2 | $headers, |
|||||||
23 | 2 | ); |
|||||||
24 | } |
||||||||
25 | } |
||||||||
26 |