@@ -30,7 +30,7 @@ class Ulid
3030 *
3131 * @return string The generated ULID.
3232 */
33- public static function generate (bool $ upperCase = true ): string
33+ public static function generate ($ upperCase = true )
3434 {
3535 $ time = self ::microtimeToUlidTime (\microtime (true ));
3636 $ timeChars = self ::encodeTime ($ time );
@@ -47,7 +47,7 @@ public static function generate(bool $upperCase = true): string
4747 *
4848 * @return string
4949 */
50- public static function encodeTime (int $ time ): string
50+ public static function encodeTime ($ time )
5151 {
5252 $ encodingCharsArray = str_split (self ::ENCODING_CHARS );
5353 $ timeChars = '' ;
@@ -59,7 +59,7 @@ public static function encodeTime(int $time): string
5959 return $ timeChars ;
6060 }
6161
62- public static function encodeRandomness (): string
62+ public static function encodeRandomness ()
6363 {
6464 $ encodingCharsArray = str_split (self ::ENCODING_CHARS );
6565 $ randomBytes = \random_bytes (10 ); // 80 bits
@@ -86,7 +86,7 @@ public static function encodeRandomness(): string
8686 *
8787 * @return array
8888 */
89- public static function decode (string $ ulid ): array
89+ public static function decode ($ ulid )
9090 {
9191 if (!self ::isValid ($ ulid )) {
9292 throw new \InvalidArgumentException ('Invalid ULID string ' );
@@ -106,7 +106,7 @@ public static function decode(string $ulid): array
106106 *
107107 * @return int
108108 */
109- public static function decodeTime (string $ ulid ): int
109+ public static function decodeTime ($ ulid )
110110 {
111111// $encodingCharsArray = str_split(self::ENCODING_CHARS);
112112
@@ -131,7 +131,7 @@ public static function decodeTime(string $ulid): int
131131 *
132132 * @return int
133133 */
134- public static function decodeRandomness (string $ ulid ): int
134+ public static function decodeRandomness ($ ulid )
135135 {
136136 if (26 !== strlen ($ ulid )) {
137137 throw new \InvalidArgumentException ('Invalid ULID length ' ); // Changed line
@@ -158,7 +158,7 @@ public static function decodeRandomness(string $ulid): int
158158 *
159159 * @return bool
160160 */
161- public static function isValid (string $ ulid ): bool
161+ public static function isValid ($ ulid )
162162 {
163163 // Check the length of the ULID string before throwing an exception.
164164 if (26 !== strlen ($ ulid )) {
@@ -180,14 +180,11 @@ public static function isValid(string $ulid): bool
180180 *
181181 * @return int
182182 */
183- public static function microtimeToUlidTime (float $ microtime ): int
183+ public static function microtimeToUlidTime ($ microtime )
184184 {
185185 $ timestamp = $ microtime * 1000000 ;
186186 $ unixEpoch = 946684800000000 ; // Microseconds since the Unix epoch.
187187
188188 return (int )($ timestamp - $ unixEpoch );
189189 }
190190}
191-
192-
193-
0 commit comments