1717namespace SimpleSAML \Module \oidc \Forms ;
1818
1919use Exception ;
20+ use Nette \Forms \Container ;
2021use Nette \Forms \Form ;
2122use SimpleSAML \Auth \Source ;
2223use SimpleSAML \Module \oidc \ModuleConfig ;
2324use SimpleSAML \Module \oidc \Forms \Controls \CsrfProtection ;
2425use Traversable ;
2526
27+ /**
28+ * @psalm-suppress PropertyNotSetInConstructor Raised for $httpRequest which is marked as internal, so won't handle.
29+ */
2630class ClientForm extends Form
2731{
2832 protected const TYPE_ARRAY = 'array ' ;
@@ -123,7 +127,7 @@ protected function validateByMatchingRegex(
123127 }
124128 }
125129
126- public function getValues ($ returnType = null , ?array $ controls = null ): array
130+ public function getValues (string | object | bool | null $ returnType = null , ?array $ controls = null ): array
127131 {
128132 /** @var array $values */
129133 $ values = parent ::getValues (self ::TYPE_ARRAY );
@@ -157,7 +161,7 @@ public function getValues($returnType = null, ?array $controls = null): array
157161 /**
158162 * @throws Exception
159163 */
160- public function setDefaults ($ data , bool $ erase = false ): ClientForm
164+ public function setDefaults (object | array $ data , bool $ erase = false ): static
161165 {
162166 if (! is_array ($ data )) {
163167 if ($ data instanceof Traversable) {
@@ -187,7 +191,9 @@ public function setDefaults($data, bool $erase = false): ClientForm
187191 $ scopes = is_array ($ data ['scopes ' ]) ? $ data ['scopes ' ] : [];
188192 $ data ['scopes ' ] = array_intersect ($ scopes , array_keys ($ this ->getScopes ()));
189193
190- return parent ::setDefaults ($ data , $ erase );
194+ parent ::setDefaults ($ data , $ erase );
195+
196+ return $ this ;
191197 }
192198
193199 /**
@@ -203,7 +209,7 @@ protected function buildForm(): void
203209 $ this ->onValidate [] = $ this ->validateBackChannelLogoutUri (...);
204210
205211 $ this ->setMethod ('POST ' );
206- $ this ->addComponent (new CsrfProtection ('{oidc:client:csrf_error} ' ), Form::PROTECTOR_ID );
212+ $ this ->addComponent (new CsrfProtection ('{oidc:client:csrf_error} ' ), Form::ProtectorId );
207213
208214 $ this ->addText ('name ' , '{oidc:client:name} ' )
209215 ->setMaxLength (255 )
0 commit comments