Skip to content

Commit

Permalink
Fix Utils::isUUID returning bool
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-schindler committed Oct 28, 2022
1 parent a869854 commit af36210
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Backend/Core/Functions/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static function encrypt(string $data, string $algo = "sha256"): string {
* Generates a random uuid (Version 4)
*
* @param string|null $data Random bytes
* @throws Exception If an appropriate source of randomness cannot be found on the system
* @return string A random uuid
*/
public static function uuid(?string $data = null): string {
Expand All @@ -42,7 +43,7 @@ public static function uuid(?string $data = null): string {
* @param string $uuid String to be checked
* @return boolean Whether it's the correct format or not
*/
public static function isUUID(string $uuid) {
public static function isUUID(string $uuid): bool {
return preg_match("/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i", $uuid) === 1;
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"php": "^8.1",
"ext-pdo": "*",
"ext-json": "*",
"ext-random": "*",
"phpstan/phpstan": "^1.2"
}
}

0 comments on commit af36210

Please sign in to comment.