summaryrefslogtreecommitdiff
path: root/vendor/paragonie/constant_time_encoding/src/Binary.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-07-12 22:26:21 +0300
committerAndrew Dolgov <[email protected]>2022-07-12 22:26:21 +0300
commit80d3db1dcf8fe9ca66d4e3f2e2116d3bc39ae2b4 (patch)
tree04b33bfb9c9368c4a31e287153abec690b9014e0 /vendor/paragonie/constant_time_encoding/src/Binary.php
parent4b6161892000cb2b8392dce92a9cf2cabdf2d20e (diff)
upgrade idiorm to php8.1-patched version (aaronpk/idiorm)
Diffstat (limited to 'vendor/paragonie/constant_time_encoding/src/Binary.php')
-rw-r--r--vendor/paragonie/constant_time_encoding/src/Binary.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/paragonie/constant_time_encoding/src/Binary.php b/vendor/paragonie/constant_time_encoding/src/Binary.php
index 38dbc4e66..828f3e0f6 100644
--- a/vendor/paragonie/constant_time_encoding/src/Binary.php
+++ b/vendor/paragonie/constant_time_encoding/src/Binary.php
@@ -2,8 +2,10 @@
declare(strict_types=1);
namespace ParagonIE\ConstantTime;
+use TypeError;
+
/**
- * Copyright (c) 2016 - 2018 Paragon Initiative Enterprises.
+ * Copyright (c) 2016 - 2022 Paragon Initiative Enterprises.
* Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -46,6 +48,8 @@ abstract class Binary
public static function safeStrlen(string $str): int
{
if (\function_exists('mb_strlen')) {
+ // mb_strlen in PHP 7.x can return false.
+ /** @psalm-suppress RedundantCast */
return (int) \mb_strlen($str, '8bit');
} else {
return \strlen($str);
@@ -60,9 +64,10 @@ abstract class Binary
* @staticvar boolean $exists
* @param string $str
* @param int $start
- * @param int $length
+ * @param ?int $length
* @return string
- * @throws \TypeError
+ *
+ * @throws TypeError
*/
public static function safeSubstr(
string $str,