1 | <?php |
||
25 | class AmoCRMClient |
||
26 | { |
||
27 | /** |
||
28 | * @var HttpClientInterface |
||
29 | */ |
||
30 | private $httpClient; |
||
31 | |||
32 | /** |
||
33 | * @var SessionStorageInterface |
||
34 | */ |
||
35 | private $sessionStorage; |
||
36 | |||
37 | /** |
||
38 | * @var LoggerInterface |
||
39 | */ |
||
40 | private $logger; |
||
41 | |||
42 | /** |
||
43 | * @var ResponseTransformerInterface |
||
44 | */ |
||
45 | private $responseTransformer; |
||
46 | |||
47 | /** |
||
48 | * AmoCRM constructor. |
||
49 | * |
||
50 | * @param HttpClientInterface|ClientInterface $httpClient |
||
51 | * @param SessionStorageInterface $sessionStorage |
||
52 | * @param ResponseTransformerInterface $responseTransformer |
||
53 | * @param LoggerInterface $logger |
||
54 | */ |
||
55 | 4 | public function __construct( |
|
66 | |||
67 | /** |
||
68 | * @param HttpClientInterface $httpClient |
||
69 | */ |
||
70 | public function setHttpClient($httpClient) |
||
74 | |||
75 | /** |
||
76 | * @param SessionStorageInterface $sessionStorage |
||
77 | */ |
||
78 | public function setSessionStorage($sessionStorage) |
||
82 | |||
83 | /** |
||
84 | * @param ResponseTransformerInterface $responseTransformer |
||
85 | */ |
||
86 | public function setResponseTransformer($responseTransformer) |
||
90 | |||
91 | /** |
||
92 | * @param LoggerInterface $logger |
||
93 | */ |
||
94 | public function setLogger($logger) |
||
98 | |||
99 | /** |
||
100 | * @param MethodInterface $method |
||
101 | * @return mixed |
||
102 | * @throws AmoCRMException |
||
103 | */ |
||
104 | 4 | public function exec(MethodInterface $method) |
|
139 | |||
140 | /** |
||
141 | * @param UserInterface $user |
||
142 | * @throws AmoCRMException |
||
143 | */ |
||
144 | 2 | private function auth(UserInterface $user) |
|
167 | } |
||
168 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.