1 | <?php |
||
17 | class Paginator |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * @var int $page |
||
22 | * |
||
23 | * @JMS\Exclude() |
||
24 | */ |
||
25 | private $page = 1; |
||
26 | |||
27 | /** |
||
28 | * @var int $total |
||
29 | * |
||
30 | * @JMS\Type("integer") |
||
31 | * @JMS\SerializedName("count") |
||
32 | */ |
||
33 | private $total = 0; |
||
34 | |||
35 | /** |
||
36 | * @var Collection|Videos $items |
||
37 | * |
||
38 | * @JMS\Type("Realshadow\Redtube\Entities\Videos") |
||
39 | * @JMS\SerializedName("videos") |
||
40 | */ |
||
41 | private $items; |
||
42 | |||
43 | /** |
||
44 | */ |
||
45 | public function __construct() |
||
46 | { |
||
47 | $this->items = new Collection; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @JMS\PostDeserialize() |
||
52 | */ |
||
53 | public function onPostDeserialize() |
||
57 | |||
58 | /** |
||
59 | * @param int $page |
||
60 | * |
||
61 | * @return Paginator |
||
62 | */ |
||
63 | public function setPage($page) |
||
69 | |||
70 | /** |
||
71 | * @return int |
||
72 | */ |
||
73 | public function getTotal() |
||
77 | |||
78 | /** |
||
79 | * @return int |
||
80 | */ |
||
81 | public function perPage() |
||
85 | |||
86 | /** |
||
87 | * @return int |
||
88 | */ |
||
89 | public function currentPage() |
||
93 | |||
94 | /** |
||
95 | * @return float |
||
96 | */ |
||
97 | public function getLastPage() |
||
101 | |||
102 | /** |
||
103 | * @return Collection |
||
104 | */ |
||
105 | public function items() |
||
109 | |||
110 | } |
||
111 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: