@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * Generate a 16-bit integer |
27 | 27 | * /dev/urandom |
28 | 28 | * |
29 | - * @return int |
|
29 | + * @return string |
|
30 | 30 | */ |
31 | 31 | function randombytes_random16() |
32 | 32 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Generate a 16-bit integer |
69 | 69 | * /dev/urandom |
70 | 70 | * |
71 | - * @return int |
|
71 | + * @return string |
|
72 | 72 | */ |
73 | 73 | public static function randombytes_random16() |
74 | 74 | { |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $RandomCompatDIR = dirname(__FILE__); |
56 | 56 | |
57 | -require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; |
|
58 | -require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; |
|
59 | -require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; |
|
57 | +require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'byte_safe_strings.php'; |
|
58 | +require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'cast_to_int.php'; |
|
59 | +require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'error_polyfill.php'; |
|
60 | 60 | |
61 | 61 | if (!is_callable('random_bytes')) { |
62 | 62 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | if (extension_loaded('libsodium')) { |
77 | 77 | // See random_bytes_libsodium.php |
78 | 78 | if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { |
79 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; |
|
79 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium.php'; |
|
80 | 80 | } elseif (method_exists('Sodium', 'randombytes_buf')) { |
81 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; |
|
81 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_libsodium_legacy.php'; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // place, that is not helpful to us here. |
118 | 118 | |
119 | 119 | // See random_bytes_dev_urandom.php |
120 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; |
|
120 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_dev_urandom.php'; |
|
121 | 121 | } |
122 | 122 | // Unset variables after use |
123 | 123 | $RandomCompat_basedir = null; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | extension_loaded('mcrypt') |
160 | 160 | ) { |
161 | 161 | // See random_bytes_mcrypt.php |
162 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; |
|
162 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_mcrypt.php'; |
|
163 | 163 | } |
164 | 164 | $RandomCompatUrandom = null; |
165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); |
185 | 185 | if (method_exists($RandomCompatCOMtest, 'GetRandom')) { |
186 | 186 | // See random_bytes_com_dotnet.php |
187 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; |
|
187 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_bytes_com_dotnet.php'; |
|
188 | 188 | } |
189 | 189 | } catch (com_exception $e) { |
190 | 190 | // Don't try to use it. |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | if (!is_callable('random_int')) { |
223 | - require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; |
|
223 | + require_once $RandomCompatDIR.DIRECTORY_SEPARATOR.'random_int.php'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | $RandomCompatDIR = null; |
@@ -202,7 +202,7 @@ |
||
202 | 202 | * We don't have any more options, so let's throw an exception right now |
203 | 203 | * and hope the developer won't let it fail silently. |
204 | 204 | * |
205 | - * @param mixed $length |
|
205 | + * @param integer $length |
|
206 | 206 | * @psalm-suppress InvalidReturnType |
207 | 207 | * @throws Exception |
208 | 208 | * @return string |
@@ -180,7 +180,7 @@ |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | return (string) substr( |
183 | - (string )$binary_string, |
|
183 | + (string) $binary_string, |
|
184 | 184 | (int) $start, |
185 | 185 | (int) $length |
186 | 186 | ); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | if (DIRECTORY_SEPARATOR === '/') { |
68 | 68 | if (!is_readable('/dev/urandom')) { |
69 | 69 | throw new Exception( |
70 | - 'Environment misconfiguration: ' . |
|
70 | + 'Environment misconfiguration: '. |
|
71 | 71 | '/dev/urandom cannot be read.' |
72 | 72 | ); |
73 | 73 | } |