1 | <?php |
||
29 | class UserInfo implements UserInfoInterface |
||
30 | { |
||
31 | use ImmutablePropertyTrait; |
||
32 | use ValidatorTrait; |
||
33 | |||
34 | /** |
||
35 | * User Component |
||
36 | * |
||
37 | * @var User |
||
38 | */ |
||
39 | protected $user; |
||
40 | |||
41 | /** |
||
42 | * Pass Component |
||
43 | * |
||
44 | * @var Pass |
||
45 | */ |
||
46 | protected $pass; |
||
47 | |||
48 | /** |
||
49 | * Create a new instance from a string |
||
50 | * |
||
51 | * @param string $str |
||
52 | * |
||
53 | * @return static |
||
54 | */ |
||
55 | 15 | public static function createFromString($str) |
|
64 | |||
65 | /** |
||
66 | * Create a new instance of UserInfo |
||
67 | * |
||
68 | * @param UserInterface|string $user |
||
69 | * @param PassInterface|string $pass |
||
70 | */ |
||
71 | 766 | public function __construct($user = null, $pass = null) |
|
77 | |||
78 | /** |
||
79 | * Retrieve the user component of the URI User Info part |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 246 | public function getUser() |
|
87 | |||
88 | /** |
||
89 | * Retrieve the pass component of the URI User Info part |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 240 | public function getPass() |
|
97 | |||
98 | /** |
||
99 | * @inheritdoc |
||
100 | */ |
||
101 | 2 | public function __debugInfo() |
|
105 | |||
106 | /** |
||
107 | * @inheritdoc |
||
108 | */ |
||
109 | 12 | public static function __set_state(array $properties) |
|
113 | |||
114 | /** |
||
115 | * Returns the component literal value. |
||
116 | * |
||
117 | * @return null|string |
||
118 | */ |
||
119 | 760 | public function getContent() |
|
133 | |||
134 | /** |
||
135 | * Returns the instance string representation; If the |
||
136 | * instance is not defined an empty string is returned |
||
137 | * |
||
138 | * @return string |
||
139 | */ |
||
140 | 760 | public function __toString() |
|
144 | |||
145 | /** |
||
146 | * Returns the instance string representation |
||
147 | * with its optional URI delimiters |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | 725 | public function getUriComponent() |
|
160 | |||
161 | /** |
||
162 | * Returns whether two UriPart objects represent the same value |
||
163 | * The comparison is based on the getUriComponent method |
||
164 | * |
||
165 | * @param UriPart $component |
||
166 | * |
||
167 | * @return bool |
||
168 | */ |
||
169 | 12 | public function sameValueAs(UriPart $component) |
|
173 | |||
174 | /** |
||
175 | * Return an instance with the specified user. |
||
176 | * |
||
177 | * This method MUST retain the state of the current instance, and return |
||
178 | * an instance that contains the specified user. |
||
179 | * |
||
180 | * An empty user is equivalent to removing the user information. |
||
181 | * |
||
182 | * @param string $user The user to use with the new instance. |
||
183 | * |
||
184 | * @throws \InvalidArgumentException for invalid user. |
||
185 | * |
||
186 | * @return static |
||
187 | */ |
||
188 | 213 | public function withUser($user) |
|
192 | |||
193 | /** |
||
194 | * Return an instance with the specified password. |
||
195 | * |
||
196 | * This method MUST retain the state of the current instance, and return |
||
197 | * an instance that contains the specified password. |
||
198 | * |
||
199 | * An empty password is equivalent to removing the password. |
||
200 | * |
||
201 | * @param string $pass The password to use with the new instance. |
||
202 | * |
||
203 | * @throws \InvalidArgumentException for invalid password. |
||
204 | * |
||
205 | * @return static |
||
206 | */ |
||
207 | 213 | public function withPass($pass) |
|
211 | |||
212 | /** |
||
213 | * @inheritdoc |
||
214 | */ |
||
215 | 766 | protected function assertValidObject() |
|
218 | } |
||
219 |
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 given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.