summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParagon Initiative Enterprises <security@paragonie.com>2016-05-10 16:45:16 -0400
committerParagon Initiative Enterprises <security@paragonie.com>2016-05-10 16:45:16 -0400
commit4ed9623466a93dbdc74edc91d46860f9e58d4c04 (patch)
tree79072079bf983e8af1ae79f45104cf1d33196803
parent2aaa52dcc5695fa8591f255bd36e7cf9aad56493 (diff)
downloadconstant_time_encoding-4ed9623466a93dbdc74edc91d46860f9e58d4c04.zip
constant_time_encoding-4ed9623466a93dbdc74edc91d46860f9e58d4c04.tar.gz
constant_time_encoding-4ed9623466a93dbdc74edc91d46860f9e58d4c04.tar.bz2
Add type declarations to Binaryv2.0.1
-rw-r--r--src/Binary.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Binary.php b/src/Binary.php
index dd32349..1028e66 100644
--- a/src/Binary.php
+++ b/src/Binary.php
@@ -43,7 +43,7 @@ abstract class Binary
* @param string $str
* @return int
*/
- public static function safeStrlen($str)
+ public static function safeStrlen(string $str): int
{
if (\function_exists('mb_strlen')) {
return \mb_strlen($str, '8bit');
@@ -65,10 +65,10 @@ abstract class Binary
* @throws \TypeError
*/
public static function safeSubstr(
- $str,
- $start = 0,
+ string $str,
+ int $start = 0,
$length = null
- ) {
+ ): string {
if (\function_exists('mb_substr')) {
// mb_substr($str, 0, NULL, '8bit') returns an empty string on PHP
// 5.3, so we have to find the length ourselves.