summaryrefslogtreecommitdiff
path: root/vendor/paragonie/constant_time_encoding/src/Binary.php
diff options
context:
space:
mode:
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,