| Conditions | 5 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function isValid(PublicKeyCredential $publicKeyCredential, PublicKeyCredentialCreationOptions $publicKeyCredentialCreationOptions): bool |
||
| 34 | { |
||
| 35 | if ('webauthn.create' !== $publicKeyCredential->getResponse()->getClientDataJSON()->getType()) { |
||
| 36 | throw new \InvalidArgumentException(); |
||
| 37 | } |
||
| 38 | if (hash_equals($publicKeyCredentialCreationOptions->getChallenge(), $publicKeyCredential->getResponse()->getClientDataJSON()->getChallenge())) { |
||
| 39 | throw new \InvalidArgumentException(); |
||
| 40 | } |
||
| 41 | if ($publicKeyCredentialCreationOptions->getRp()->getId() !== $publicKeyCredential->getResponse()->getClientDataJSON()->getOrigin()) { |
||
| 42 | throw new \InvalidArgumentException(); |
||
| 43 | } |
||
| 44 | if ($publicKeyCredential->getResponse()->getClientDataJSON()->getTokenBinding()) { |
||
| 45 | throw new \InvalidArgumentException(); |
||
| 46 | } |
||
| 49 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: