1 | <?php |
||
28 | class UserInfo implements UserInfoInterface |
||
29 | { |
||
30 | use ImmutablePropertyTrait; |
||
31 | |||
32 | /** |
||
33 | * User Component |
||
34 | * |
||
35 | * @var User |
||
36 | */ |
||
37 | protected $user; |
||
38 | |||
39 | /** |
||
40 | * Pass Component |
||
41 | * |
||
42 | * @var Pass |
||
43 | */ |
||
44 | protected $pass; |
||
45 | |||
46 | /** |
||
47 | * Create a new instance of UserInfo |
||
48 | * |
||
49 | * @param UserInterface|string $user |
||
50 | * @param PassInterface|string $pass |
||
51 | */ |
||
52 | 640 | public function __construct($user = null, $pass = null) |
|
58 | |||
59 | /** |
||
60 | * Retrieve the user component of the URI User Info part |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 132 | public function getUser() |
|
68 | |||
69 | /** |
||
70 | * Retrieve the pass component of the URI User Info part |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | 126 | public function getPass() |
|
78 | |||
79 | /** |
||
80 | * @inheritdoc |
||
81 | */ |
||
82 | 2 | public function __debugInfo() |
|
86 | |||
87 | /** |
||
88 | * @inheritdoc |
||
89 | */ |
||
90 | 12 | public static function __set_state(array $properties) |
|
94 | |||
95 | /** |
||
96 | * Returns the instance string representation; If the |
||
97 | * instance is not defined an empty string is returned |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 604 | public function __toString() |
|
115 | |||
116 | /** |
||
117 | * Returns the instance string representation |
||
118 | * with its optional URI delimiters |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 584 | public function getUriComponent() |
|
131 | |||
132 | /** |
||
133 | * Returns whether two UriPart objects represent the same value |
||
134 | * The comparison is based on the getUriComponent method |
||
135 | * |
||
136 | * @param UriPart $component |
||
137 | * |
||
138 | * @return bool |
||
139 | */ |
||
140 | 12 | public function sameValueAs(UriPart $component) |
|
144 | |||
145 | /** |
||
146 | * Return an instance with the specified user. |
||
147 | * |
||
148 | * This method MUST retain the state of the current instance, and return |
||
149 | * an instance that contains the specified user. |
||
150 | * |
||
151 | * An empty user is equivalent to removing the user information. |
||
152 | * |
||
153 | * @param string $user The user to use with the new instance. |
||
154 | * |
||
155 | * @throws \InvalidArgumentException for invalid user. |
||
156 | * |
||
157 | * @return static |
||
158 | */ |
||
159 | 114 | public function withUser($user) |
|
163 | |||
164 | /** |
||
165 | * Return an instance with the specified password. |
||
166 | * |
||
167 | * This method MUST retain the state of the current instance, and return |
||
168 | * an instance that contains the specified password. |
||
169 | * |
||
170 | * An empty password is equivalent to removing the password. |
||
171 | * |
||
172 | * @param string $pass The password to use with the new instance. |
||
173 | * |
||
174 | * @throws \InvalidArgumentException for invalid password. |
||
175 | * |
||
176 | * @return static |
||
177 | */ |
||
178 | 114 | public function withPass($pass) |
|
182 | |||
183 | /** |
||
184 | * @inheritdoc |
||
185 | */ |
||
186 | 640 | protected function assertValidObject() |
|
189 | } |
||
190 |
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.