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 | 408 | public function __construct($user = null, $pass = null) |
|
58 | |||
59 | /** |
||
60 | * Retrieve the user component of the URI User Info part |
||
61 | * |
||
62 | 88 | * @return string |
|
63 | */ |
||
64 | 88 | public function getUser() |
|
68 | |||
69 | /** |
||
70 | 84 | * Retrieve the pass component of the URI User Info part |
|
71 | * |
||
72 | 84 | * @return string |
|
73 | */ |
||
74 | public function getPass() |
||
78 | 384 | ||
79 | /** |
||
80 | 384 | * Returns the instance string representation; If the |
|
81 | 384 | * instance is not defined an empty string is returned |
|
82 | 332 | * |
|
83 | * @return string |
||
84 | */ |
||
85 | 82 | public function __toString() |
|
99 | 372 | ||
100 | 78 | /** |
|
101 | 78 | * Returns the instance string representation |
|
102 | * with its optional URI delimiters |
||
103 | 372 | * |
|
104 | * @return string |
||
105 | */ |
||
106 | public function getUriComponent() |
||
115 | |||
116 | /** |
||
117 | 76 | * Returns whether two UriPart objects represent the same value |
|
118 | * The comparison is based on the getUriComponent method |
||
119 | 76 | * |
|
120 | * @param UriPart $component |
||
121 | * |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function sameValueAs(UriPart $component) |
||
128 | |||
129 | /** |
||
130 | * Return an instance with the specified user. |
||
131 | * |
||
132 | * This method MUST retain the state of the current instance, and return |
||
133 | 408 | * an instance that contains the specified user. |
|
134 | * |
||
135 | 408 | * An empty user is equivalent to removing the user information. |
|
136 | * |
||
137 | * @param string $user The user to use with the new instance. |
||
138 | * |
||
139 | * @throws \InvalidArgumentException for invalid user. |
||
140 | * |
||
141 | * @return static |
||
142 | */ |
||
143 | public function withUser($user) |
||
147 | |||
148 | /** |
||
149 | * Return an instance with the specified password. |
||
150 | * |
||
151 | * This method MUST retain the state of the current instance, and return |
||
152 | * an instance that contains the specified password. |
||
153 | * |
||
154 | * An empty password is equivalent to removing the password. |
||
155 | * |
||
156 | * @param string $pass The password to use with the new instance. |
||
157 | * |
||
158 | * @throws \InvalidArgumentException for invalid password. |
||
159 | * |
||
160 | * @return static |
||
161 | */ |
||
162 | public function withPass($pass) |
||
166 | |||
167 | /** |
||
168 | * @inheritdoc |
||
169 | */ |
||
170 | public static function __set_state(array $properties) |
||
174 | |||
175 | /** |
||
176 | * @inheritdoc |
||
177 | */ |
||
178 | protected function assertValidObject() |
||
181 | } |
||
182 |
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.