@@ -29,19 +29,14 @@ class Base58
2929 * @since v1.1.0 Added the optional $service argument.
3030 */
3131 public function __construct (
32- $ alphabet = null ,
33- ServiceInterface $ service = null
32+ ? string $ alphabet = null ,
33+ ? ServiceInterface $ service = null
3434 ) {
3535 // Handle null alphabet
3636 if (is_null ($ alphabet ) === true ) {
3737 $ alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz ' ;
3838 }
3939
40- // Type validation
41- if (is_string ($ alphabet ) === false ) {
42- throw new InvalidArgumentException ('Argument $alphabet must be a string. ' );
43- }
44-
4540 // The alphabet must contain 58 characters
4641 if (strlen ($ alphabet ) !== 58 ) {
4742 throw new InvalidArgumentException ('Argument $alphabet must contain 58 characters. ' );
@@ -71,7 +66,7 @@ public function __construct(
7166 * @since v1.0.0
7267 * @return string The Base58 encoded string.
7368 */
74- public function encode ($ string )
69+ public function encode (string $ string ) : string
7570 {
7671 return $ this ->service ->encode ($ string );
7772 }
@@ -83,7 +78,7 @@ public function encode($string)
8378 * @since v1.0.0
8479 * @return string Returns the decoded string.
8580 */
86- public function decode ($ base58 )
81+ public function decode (string $ base58 ) : string
8782 {
8883 return $ this ->service ->decode ($ base58 );
8984 }
0 commit comments