@@ -20,86 +20,86 @@ |
||
20 | 20 | */ |
21 | 21 | final class Php80 |
22 | 22 | { |
23 | - public static function fdiv(float $dividend, float $divisor): float |
|
24 | - { |
|
25 | - return @($dividend / $divisor); |
|
26 | - } |
|
23 | + public static function fdiv(float $dividend, float $divisor): float |
|
24 | + { |
|
25 | + return @($dividend / $divisor); |
|
26 | + } |
|
27 | 27 | |
28 | - public static function get_debug_type($value): string |
|
29 | - { |
|
30 | - switch (true) { |
|
31 | - case null === $value: return 'null'; |
|
32 | - case \is_bool($value): return 'bool'; |
|
33 | - case \is_string($value): return 'string'; |
|
34 | - case \is_array($value): return 'array'; |
|
35 | - case \is_int($value): return 'int'; |
|
36 | - case \is_float($value): return 'float'; |
|
37 | - case \is_object($value): break; |
|
38 | - case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class'; |
|
39 | - default: |
|
40 | - if (null === $type = @get_resource_type($value)) { |
|
41 | - return 'unknown'; |
|
42 | - } |
|
28 | + public static function get_debug_type($value): string |
|
29 | + { |
|
30 | + switch (true) { |
|
31 | + case null === $value: return 'null'; |
|
32 | + case \is_bool($value): return 'bool'; |
|
33 | + case \is_string($value): return 'string'; |
|
34 | + case \is_array($value): return 'array'; |
|
35 | + case \is_int($value): return 'int'; |
|
36 | + case \is_float($value): return 'float'; |
|
37 | + case \is_object($value): break; |
|
38 | + case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class'; |
|
39 | + default: |
|
40 | + if (null === $type = @get_resource_type($value)) { |
|
41 | + return 'unknown'; |
|
42 | + } |
|
43 | 43 | |
44 | - if ('Unknown' === $type) { |
|
45 | - $type = 'closed'; |
|
46 | - } |
|
44 | + if ('Unknown' === $type) { |
|
45 | + $type = 'closed'; |
|
46 | + } |
|
47 | 47 | |
48 | - return "resource ($type)"; |
|
49 | - } |
|
48 | + return "resource ($type)"; |
|
49 | + } |
|
50 | 50 | |
51 | - $class = \get_class($value); |
|
51 | + $class = \get_class($value); |
|
52 | 52 | |
53 | - if (false === strpos($class, '@')) { |
|
54 | - return $class; |
|
55 | - } |
|
53 | + if (false === strpos($class, '@')) { |
|
54 | + return $class; |
|
55 | + } |
|
56 | 56 | |
57 | - return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; |
|
58 | - } |
|
57 | + return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; |
|
58 | + } |
|
59 | 59 | |
60 | - public static function get_resource_id($res): int |
|
61 | - { |
|
62 | - if (!\is_resource($res) && null === @get_resource_type($res)) { |
|
63 | - throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res))); |
|
64 | - } |
|
60 | + public static function get_resource_id($res): int |
|
61 | + { |
|
62 | + if (!\is_resource($res) && null === @get_resource_type($res)) { |
|
63 | + throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res))); |
|
64 | + } |
|
65 | 65 | |
66 | - return (int) $res; |
|
67 | - } |
|
66 | + return (int) $res; |
|
67 | + } |
|
68 | 68 | |
69 | - public static function preg_last_error_msg(): string |
|
70 | - { |
|
71 | - switch (preg_last_error()) { |
|
72 | - case \PREG_INTERNAL_ERROR: |
|
73 | - return 'Internal error'; |
|
74 | - case \PREG_BAD_UTF8_ERROR: |
|
75 | - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
76 | - case \PREG_BAD_UTF8_OFFSET_ERROR: |
|
77 | - return 'The offset did not correspond to the beginning of a valid UTF-8 code point'; |
|
78 | - case \PREG_BACKTRACK_LIMIT_ERROR: |
|
79 | - return 'Backtrack limit exhausted'; |
|
80 | - case \PREG_RECURSION_LIMIT_ERROR: |
|
81 | - return 'Recursion limit exhausted'; |
|
82 | - case \PREG_JIT_STACKLIMIT_ERROR: |
|
83 | - return 'JIT stack limit exhausted'; |
|
84 | - case \PREG_NO_ERROR: |
|
85 | - return 'No error'; |
|
86 | - default: |
|
87 | - return 'Unknown error'; |
|
88 | - } |
|
89 | - } |
|
69 | + public static function preg_last_error_msg(): string |
|
70 | + { |
|
71 | + switch (preg_last_error()) { |
|
72 | + case \PREG_INTERNAL_ERROR: |
|
73 | + return 'Internal error'; |
|
74 | + case \PREG_BAD_UTF8_ERROR: |
|
75 | + return 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
76 | + case \PREG_BAD_UTF8_OFFSET_ERROR: |
|
77 | + return 'The offset did not correspond to the beginning of a valid UTF-8 code point'; |
|
78 | + case \PREG_BACKTRACK_LIMIT_ERROR: |
|
79 | + return 'Backtrack limit exhausted'; |
|
80 | + case \PREG_RECURSION_LIMIT_ERROR: |
|
81 | + return 'Recursion limit exhausted'; |
|
82 | + case \PREG_JIT_STACKLIMIT_ERROR: |
|
83 | + return 'JIT stack limit exhausted'; |
|
84 | + case \PREG_NO_ERROR: |
|
85 | + return 'No error'; |
|
86 | + default: |
|
87 | + return 'Unknown error'; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - public static function str_contains(string $haystack, string $needle): bool |
|
92 | - { |
|
93 | - return '' === $needle || false !== strpos($haystack, $needle); |
|
94 | - } |
|
91 | + public static function str_contains(string $haystack, string $needle): bool |
|
92 | + { |
|
93 | + return '' === $needle || false !== strpos($haystack, $needle); |
|
94 | + } |
|
95 | 95 | |
96 | - public static function str_starts_with(string $haystack, string $needle): bool |
|
97 | - { |
|
98 | - return 0 === strncmp($haystack, $needle, \strlen($needle)); |
|
99 | - } |
|
96 | + public static function str_starts_with(string $haystack, string $needle): bool |
|
97 | + { |
|
98 | + return 0 === strncmp($haystack, $needle, \strlen($needle)); |
|
99 | + } |
|
100 | 100 | |
101 | - public static function str_ends_with(string $haystack, string $needle): bool |
|
102 | - { |
|
103 | - return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle))); |
|
104 | - } |
|
101 | + public static function str_ends_with(string $haystack, string $needle): bool |
|
102 | + { |
|
103 | + return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle))); |
|
104 | + } |
|
105 | 105 | } |
@@ -20,55 +20,55 @@ discard block |
||
20 | 20 | */ |
21 | 21 | final class Php80 |
22 | 22 | { |
23 | - public static function fdiv(float $dividend, float $divisor): float |
|
23 | + public static function fdiv( float $dividend, float $divisor ): float |
|
24 | 24 | { |
25 | - return @($dividend / $divisor); |
|
25 | + return @( $dividend / $divisor ); |
|
26 | 26 | } |
27 | 27 | |
28 | - public static function get_debug_type($value): string |
|
28 | + public static function get_debug_type( $value ): string |
|
29 | 29 | { |
30 | - switch (true) { |
|
30 | + switch ( true ) { |
|
31 | 31 | case null === $value: return 'null'; |
32 | - case \is_bool($value): return 'bool'; |
|
33 | - case \is_string($value): return 'string'; |
|
34 | - case \is_array($value): return 'array'; |
|
35 | - case \is_int($value): return 'int'; |
|
36 | - case \is_float($value): return 'float'; |
|
37 | - case \is_object($value): break; |
|
32 | + case \is_bool( $value ): return 'bool'; |
|
33 | + case \is_string( $value ): return 'string'; |
|
34 | + case \is_array( $value ): return 'array'; |
|
35 | + case \is_int( $value ): return 'int'; |
|
36 | + case \is_float( $value ): return 'float'; |
|
37 | + case \is_object( $value ): break; |
|
38 | 38 | case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class'; |
39 | 39 | default: |
40 | - if (null === $type = @get_resource_type($value)) { |
|
40 | + if ( null === $type = @get_resource_type( $value ) ) { |
|
41 | 41 | return 'unknown'; |
42 | 42 | } |
43 | 43 | |
44 | - if ('Unknown' === $type) { |
|
44 | + if ( 'Unknown' === $type ) { |
|
45 | 45 | $type = 'closed'; |
46 | 46 | } |
47 | 47 | |
48 | 48 | return "resource ($type)"; |
49 | 49 | } |
50 | 50 | |
51 | - $class = \get_class($value); |
|
51 | + $class = \get_class( $value ); |
|
52 | 52 | |
53 | - if (false === strpos($class, '@')) { |
|
53 | + if ( false === strpos( $class, '@' ) ) { |
|
54 | 54 | return $class; |
55 | 55 | } |
56 | 56 | |
57 | - return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; |
|
57 | + return ( get_parent_class( $class ) ?: key( class_implements( $class ) ) ?: 'class' ) . '@anonymous'; |
|
58 | 58 | } |
59 | 59 | |
60 | - public static function get_resource_id($res): int |
|
60 | + public static function get_resource_id( $res ): int |
|
61 | 61 | { |
62 | - if (!\is_resource($res) && null === @get_resource_type($res)) { |
|
63 | - throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res))); |
|
62 | + if ( ! \is_resource( $res ) && null === @get_resource_type( $res ) ) { |
|
63 | + throw new \TypeError( sprintf( 'Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type( $res ) ) ); |
|
64 | 64 | } |
65 | 65 | |
66 | - return (int) $res; |
|
66 | + return (int)$res; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public static function preg_last_error_msg(): string |
70 | 70 | { |
71 | - switch (preg_last_error()) { |
|
71 | + switch ( preg_last_error() ) { |
|
72 | 72 | case \PREG_INTERNAL_ERROR: |
73 | 73 | return 'Internal error'; |
74 | 74 | case \PREG_BAD_UTF8_ERROR: |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - public static function str_contains(string $haystack, string $needle): bool |
|
91 | + public static function str_contains( string $haystack, string $needle ): bool |
|
92 | 92 | { |
93 | - return '' === $needle || false !== strpos($haystack, $needle); |
|
93 | + return '' === $needle || false !== strpos( $haystack, $needle ); |
|
94 | 94 | } |
95 | 95 | |
96 | - public static function str_starts_with(string $haystack, string $needle): bool |
|
96 | + public static function str_starts_with( string $haystack, string $needle ): bool |
|
97 | 97 | { |
98 | - return 0 === strncmp($haystack, $needle, \strlen($needle)); |
|
98 | + return 0 === strncmp( $haystack, $needle, \strlen( $needle ) ); |
|
99 | 99 | } |
100 | 100 | |
101 | - public static function str_ends_with(string $haystack, string $needle): bool |
|
101 | + public static function str_ends_with( string $haystack, string $needle ): bool |
|
102 | 102 | { |
103 | - return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle))); |
|
103 | + return '' === $needle || ( '' !== $haystack && 0 === substr_compare( $haystack, $needle, -\strlen( $needle ) ) ); |
|
104 | 104 | } |
105 | 105 | } |
@@ -18,8 +18,7 @@ |
||
18 | 18 | * |
19 | 19 | * @internal |
20 | 20 | */ |
21 | -final class Php80 |
|
22 | -{ |
|
21 | +final class Php80 { |
|
23 | 22 | public static function fdiv(float $dividend, float $divisor): float |
24 | 23 | { |
25 | 24 | return @($dividend / $divisor); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (\PHP_VERSION_ID < 80000) { |
4 | - interface Stringable |
|
5 | - { |
|
6 | - /** |
|
7 | - * @return string |
|
8 | - */ |
|
9 | - public function __toString(); |
|
10 | - } |
|
4 | + interface Stringable |
|
5 | + { |
|
6 | + /** |
|
7 | + * @return string |
|
8 | + */ |
|
9 | + public function __toString(); |
|
10 | + } |
|
11 | 11 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (\PHP_VERSION_ID < 80000) { |
|
3 | +if ( \PHP_VERSION_ID < 80000 ) { |
|
4 | 4 | interface Stringable |
5 | 5 | { |
6 | 6 | /** |
@@ -1,8 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (\PHP_VERSION_ID < 80000) { |
4 | - interface Stringable |
|
5 | - { |
|
4 | + interface Stringable { |
|
6 | 5 | /** |
7 | 6 | * @return string |
8 | 7 | */ |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ValueError extends Error |
|
4 | -{ |
|
3 | +class ValueError extends Error { |
|
5 | 4 | } |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class UnhandledMatchError extends Error |
|
4 | -{ |
|
3 | +class UnhandledMatchError extends Error { |
|
5 | 4 | } |
@@ -3,20 +3,20 @@ |
||
3 | 3 | #[Attribute(Attribute::TARGET_CLASS)] |
4 | 4 | final class Attribute |
5 | 5 | { |
6 | - public const TARGET_CLASS = 1; |
|
7 | - public const TARGET_FUNCTION = 2; |
|
8 | - public const TARGET_METHOD = 4; |
|
9 | - public const TARGET_PROPERTY = 8; |
|
10 | - public const TARGET_CLASS_CONSTANT = 16; |
|
11 | - public const TARGET_PARAMETER = 32; |
|
12 | - public const TARGET_ALL = 63; |
|
13 | - public const IS_REPEATABLE = 64; |
|
6 | + public const TARGET_CLASS = 1; |
|
7 | + public const TARGET_FUNCTION = 2; |
|
8 | + public const TARGET_METHOD = 4; |
|
9 | + public const TARGET_PROPERTY = 8; |
|
10 | + public const TARGET_CLASS_CONSTANT = 16; |
|
11 | + public const TARGET_PARAMETER = 32; |
|
12 | + public const TARGET_ALL = 63; |
|
13 | + public const IS_REPEATABLE = 64; |
|
14 | 14 | |
15 | - /** @var int */ |
|
16 | - public $flags; |
|
15 | + /** @var int */ |
|
16 | + public $flags; |
|
17 | 17 | |
18 | - public function __construct(int $flags = self::TARGET_ALL) |
|
19 | - { |
|
20 | - $this->flags = $flags; |
|
21 | - } |
|
18 | + public function __construct(int $flags = self::TARGET_ALL) |
|
19 | + { |
|
20 | + $this->flags = $flags; |
|
21 | + } |
|
22 | 22 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** @var int */ |
16 | 16 | public $flags; |
17 | 17 | |
18 | - public function __construct(int $flags = self::TARGET_ALL) |
|
18 | + public function __construct( int $flags = self::TARGET_ALL ) |
|
19 | 19 | { |
20 | 20 | $this->flags = $flags; |
21 | 21 | } |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | #[Attribute(Attribute::TARGET_CLASS)] |
4 | -final class Attribute |
|
5 | -{ |
|
4 | +final class Attribute { |
|
6 | 5 | public const TARGET_CLASS = 1; |
7 | 6 | public const TARGET_FUNCTION = 2; |
8 | 7 | public const TARGET_METHOD = 4; |
@@ -15,8 +14,7 @@ discard block |
||
15 | 14 | /** @var int */ |
16 | 15 | public $flags; |
17 | 16 | |
18 | - public function __construct(int $flags = self::TARGET_ALL) |
|
19 | - { |
|
17 | + public function __construct(int $flags = self::TARGET_ALL) { |
|
20 | 18 | $this->flags = $flags; |
21 | 19 | } |
22 | 20 | } |
@@ -12,20 +12,20 @@ |
||
12 | 12 | use Symfony\Polyfill\Php73 as p; |
13 | 13 | |
14 | 14 | if (\PHP_VERSION_ID >= 70300) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if (!function_exists('is_countable')) { |
19 | - function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; } |
|
19 | + function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; } |
|
20 | 20 | } |
21 | 21 | if (!function_exists('hrtime')) { |
22 | - require_once __DIR__.'/Php73.php'; |
|
23 | - p\Php73::$startAt = (int) microtime(true); |
|
24 | - function hrtime($as_number = false) { return p\Php73::hrtime($as_number); } |
|
22 | + require_once __DIR__.'/Php73.php'; |
|
23 | + p\Php73::$startAt = (int) microtime(true); |
|
24 | + function hrtime($as_number = false) { return p\Php73::hrtime($as_number); } |
|
25 | 25 | } |
26 | 26 | if (!function_exists('array_key_first')) { |
27 | - function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } } |
|
27 | + function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } } |
|
28 | 28 | } |
29 | 29 | if (!function_exists('array_key_last')) { |
30 | - function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); } |
|
30 | + function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); } |
|
31 | 31 | } |
@@ -11,21 +11,21 @@ |
||
11 | 11 | |
12 | 12 | use Symfony\Polyfill\Php73 as p; |
13 | 13 | |
14 | -if (\PHP_VERSION_ID >= 70300) { |
|
14 | +if ( \PHP_VERSION_ID >= 70300 ) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | -if (!function_exists('is_countable')) { |
|
19 | - function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; } |
|
18 | +if ( ! function_exists( 'is_countable' ) ) { |
|
19 | + function is_countable( $value ) { return is_array( $value ) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; } |
|
20 | 20 | } |
21 | -if (!function_exists('hrtime')) { |
|
22 | - require_once __DIR__.'/Php73.php'; |
|
23 | - p\Php73::$startAt = (int) microtime(true); |
|
24 | - function hrtime($as_number = false) { return p\Php73::hrtime($as_number); } |
|
21 | +if ( ! function_exists( 'hrtime' ) ) { |
|
22 | + require_once __DIR__ . '/Php73.php'; |
|
23 | + p\Php73::$startAt = (int)microtime( true ); |
|
24 | + function hrtime( $as_number = false ) { return p\Php73::hrtime( $as_number ); } |
|
25 | 25 | } |
26 | -if (!function_exists('array_key_first')) { |
|
27 | - function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } } |
|
26 | +if ( ! function_exists( 'array_key_first' ) ) { |
|
27 | + function array_key_first( array $array ) { foreach ( $array as $key => $value ) { return $key; } } |
|
28 | 28 | } |
29 | -if (!function_exists('array_key_last')) { |
|
30 | - function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); } |
|
29 | +if ( ! function_exists( 'array_key_last' ) ) { |
|
30 | + function array_key_last( array $array ) { return key( array_slice( $array, -1, 1, true ) ); } |
|
31 | 31 | } |
@@ -19,25 +19,25 @@ |
||
19 | 19 | */ |
20 | 20 | final class Php73 |
21 | 21 | { |
22 | - public static $startAt = 1533462603; |
|
22 | + public static $startAt = 1533462603; |
|
23 | 23 | |
24 | - /** |
|
25 | - * @param bool $asNum |
|
26 | - * |
|
27 | - * @return array|float|int |
|
28 | - */ |
|
29 | - public static function hrtime($asNum = false) |
|
30 | - { |
|
31 | - $ns = microtime(false); |
|
32 | - $s = substr($ns, 11) - self::$startAt; |
|
33 | - $ns = 1E9 * (float) $ns; |
|
24 | + /** |
|
25 | + * @param bool $asNum |
|
26 | + * |
|
27 | + * @return array|float|int |
|
28 | + */ |
|
29 | + public static function hrtime($asNum = false) |
|
30 | + { |
|
31 | + $ns = microtime(false); |
|
32 | + $s = substr($ns, 11) - self::$startAt; |
|
33 | + $ns = 1E9 * (float) $ns; |
|
34 | 34 | |
35 | - if ($asNum) { |
|
36 | - $ns += $s * 1E9; |
|
35 | + if ($asNum) { |
|
36 | + $ns += $s * 1E9; |
|
37 | 37 | |
38 | - return \PHP_INT_SIZE === 4 ? $ns : (int) $ns; |
|
39 | - } |
|
38 | + return \PHP_INT_SIZE === 4 ? $ns : (int) $ns; |
|
39 | + } |
|
40 | 40 | |
41 | - return [$s, (int) $ns]; |
|
42 | - } |
|
41 | + return [$s, (int) $ns]; |
|
42 | + } |
|
43 | 43 | } |
@@ -26,18 +26,18 @@ |
||
26 | 26 | * |
27 | 27 | * @return array|float|int |
28 | 28 | */ |
29 | - public static function hrtime($asNum = false) |
|
29 | + public static function hrtime( $asNum = false ) |
|
30 | 30 | { |
31 | - $ns = microtime(false); |
|
32 | - $s = substr($ns, 11) - self::$startAt; |
|
33 | - $ns = 1E9 * (float) $ns; |
|
31 | + $ns = microtime( false ); |
|
32 | + $s = substr( $ns, 11 ) - self::$startAt; |
|
33 | + $ns = 1E9 * (float)$ns; |
|
34 | 34 | |
35 | - if ($asNum) { |
|
35 | + if ( $asNum ) { |
|
36 | 36 | $ns += $s * 1E9; |
37 | 37 | |
38 | - return \PHP_INT_SIZE === 4 ? $ns : (int) $ns; |
|
38 | + return \PHP_INT_SIZE === 4 ? $ns : (int)$ns; |
|
39 | 39 | } |
40 | 40 | |
41 | - return [$s, (int) $ns]; |
|
41 | + return [ $s, (int)$ns ]; |
|
42 | 42 | } |
43 | 43 | } |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @internal |
19 | 19 | */ |
20 | -final class Php73 |
|
21 | -{ |
|
20 | +final class Php73 { |
|
22 | 21 | public static $startAt = 1533462603; |
23 | 22 | |
24 | 23 | /** |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | * |
27 | 26 | * @return array|float|int |
28 | 27 | */ |
29 | - public static function hrtime($asNum = false) |
|
30 | - { |
|
28 | + public static function hrtime($asNum = false) { |
|
31 | 29 | $ns = microtime(false); |
32 | 30 | $s = substr($ns, 11) - self::$startAt; |
33 | 31 | $ns = 1E9 * (float) $ns; |
@@ -9,6 +9,5 @@ |
||
9 | 9 | * file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -class JsonException extends Exception |
|
13 | -{ |
|
12 | +class JsonException extends Exception { |
|
14 | 13 | } |
@@ -12,47 +12,47 @@ |
||
12 | 12 | use Symfony\Polyfill\Intl\Grapheme as p; |
13 | 13 | |
14 | 14 | if (extension_loaded('intl')) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if (\PHP_VERSION_ID >= 80000) { |
19 | - return require __DIR__.'/bootstrap80.php'; |
|
19 | + return require __DIR__.'/bootstrap80.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (!defined('GRAPHEME_EXTR_COUNT')) { |
23 | - define('GRAPHEME_EXTR_COUNT', 0); |
|
23 | + define('GRAPHEME_EXTR_COUNT', 0); |
|
24 | 24 | } |
25 | 25 | if (!defined('GRAPHEME_EXTR_MAXBYTES')) { |
26 | - define('GRAPHEME_EXTR_MAXBYTES', 1); |
|
26 | + define('GRAPHEME_EXTR_MAXBYTES', 1); |
|
27 | 27 | } |
28 | 28 | if (!defined('GRAPHEME_EXTR_MAXCHARS')) { |
29 | - define('GRAPHEME_EXTR_MAXCHARS', 2); |
|
29 | + define('GRAPHEME_EXTR_MAXCHARS', 2); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if (!function_exists('grapheme_extract')) { |
33 | - function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); } |
|
33 | + function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); } |
|
34 | 34 | } |
35 | 35 | if (!function_exists('grapheme_stripos')) { |
36 | - function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); } |
|
36 | + function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); } |
|
37 | 37 | } |
38 | 38 | if (!function_exists('grapheme_stristr')) { |
39 | - function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); } |
|
39 | + function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); } |
|
40 | 40 | } |
41 | 41 | if (!function_exists('grapheme_strlen')) { |
42 | - function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); } |
|
42 | + function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); } |
|
43 | 43 | } |
44 | 44 | if (!function_exists('grapheme_strpos')) { |
45 | - function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); } |
|
45 | + function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); } |
|
46 | 46 | } |
47 | 47 | if (!function_exists('grapheme_strripos')) { |
48 | - function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); } |
|
48 | + function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); } |
|
49 | 49 | } |
50 | 50 | if (!function_exists('grapheme_strrpos')) { |
51 | - function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); } |
|
51 | + function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); } |
|
52 | 52 | } |
53 | 53 | if (!function_exists('grapheme_strstr')) { |
54 | - function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); } |
|
54 | + function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); } |
|
55 | 55 | } |
56 | 56 | if (!function_exists('grapheme_substr')) { |
57 | - function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); } |
|
57 | + function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); } |
|
58 | 58 | } |
@@ -11,48 +11,48 @@ |
||
11 | 11 | |
12 | 12 | use Symfony\Polyfill\Intl\Grapheme as p; |
13 | 13 | |
14 | -if (extension_loaded('intl')) { |
|
14 | +if ( extension_loaded( 'intl' ) ) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | -if (\PHP_VERSION_ID >= 80000) { |
|
19 | - return require __DIR__.'/bootstrap80.php'; |
|
18 | +if ( \PHP_VERSION_ID >= 80000 ) { |
|
19 | + return require __DIR__ . '/bootstrap80.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | -if (!defined('GRAPHEME_EXTR_COUNT')) { |
|
23 | - define('GRAPHEME_EXTR_COUNT', 0); |
|
22 | +if ( ! defined( 'GRAPHEME_EXTR_COUNT' ) ) { |
|
23 | + define( 'GRAPHEME_EXTR_COUNT', 0 ); |
|
24 | 24 | } |
25 | -if (!defined('GRAPHEME_EXTR_MAXBYTES')) { |
|
26 | - define('GRAPHEME_EXTR_MAXBYTES', 1); |
|
25 | +if ( ! defined( 'GRAPHEME_EXTR_MAXBYTES' ) ) { |
|
26 | + define( 'GRAPHEME_EXTR_MAXBYTES', 1 ); |
|
27 | 27 | } |
28 | -if (!defined('GRAPHEME_EXTR_MAXCHARS')) { |
|
29 | - define('GRAPHEME_EXTR_MAXCHARS', 2); |
|
28 | +if ( ! defined( 'GRAPHEME_EXTR_MAXCHARS' ) ) { |
|
29 | + define( 'GRAPHEME_EXTR_MAXCHARS', 2 ); |
|
30 | 30 | } |
31 | 31 | |
32 | -if (!function_exists('grapheme_extract')) { |
|
33 | - function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); } |
|
32 | +if ( ! function_exists( 'grapheme_extract' ) ) { |
|
33 | + function grapheme_extract( $haystack, $size, $type = 0, $start = 0, &$next = 0 ) { return p\Grapheme::grapheme_extract( $haystack, $size, $type, $start, $next ); } |
|
34 | 34 | } |
35 | -if (!function_exists('grapheme_stripos')) { |
|
36 | - function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); } |
|
35 | +if ( ! function_exists( 'grapheme_stripos' ) ) { |
|
36 | + function grapheme_stripos( $haystack, $needle, $offset = 0 ) { return p\Grapheme::grapheme_stripos( $haystack, $needle, $offset ); } |
|
37 | 37 | } |
38 | -if (!function_exists('grapheme_stristr')) { |
|
39 | - function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); } |
|
38 | +if ( ! function_exists( 'grapheme_stristr' ) ) { |
|
39 | + function grapheme_stristr( $haystack, $needle, $beforeNeedle = false ) { return p\Grapheme::grapheme_stristr( $haystack, $needle, $beforeNeedle ); } |
|
40 | 40 | } |
41 | -if (!function_exists('grapheme_strlen')) { |
|
42 | - function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); } |
|
41 | +if ( ! function_exists( 'grapheme_strlen' ) ) { |
|
42 | + function grapheme_strlen( $input ) { return p\Grapheme::grapheme_strlen( $input ); } |
|
43 | 43 | } |
44 | -if (!function_exists('grapheme_strpos')) { |
|
45 | - function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); } |
|
44 | +if ( ! function_exists( 'grapheme_strpos' ) ) { |
|
45 | + function grapheme_strpos( $haystack, $needle, $offset = 0 ) { return p\Grapheme::grapheme_strpos( $haystack, $needle, $offset ); } |
|
46 | 46 | } |
47 | -if (!function_exists('grapheme_strripos')) { |
|
48 | - function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); } |
|
47 | +if ( ! function_exists( 'grapheme_strripos' ) ) { |
|
48 | + function grapheme_strripos( $haystack, $needle, $offset = 0 ) { return p\Grapheme::grapheme_strripos( $haystack, $needle, $offset ); } |
|
49 | 49 | } |
50 | -if (!function_exists('grapheme_strrpos')) { |
|
51 | - function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); } |
|
50 | +if ( ! function_exists( 'grapheme_strrpos' ) ) { |
|
51 | + function grapheme_strrpos( $haystack, $needle, $offset = 0 ) { return p\Grapheme::grapheme_strrpos( $haystack, $needle, $offset ); } |
|
52 | 52 | } |
53 | -if (!function_exists('grapheme_strstr')) { |
|
54 | - function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); } |
|
53 | +if ( ! function_exists( 'grapheme_strstr' ) ) { |
|
54 | + function grapheme_strstr( $haystack, $needle, $beforeNeedle = false ) { return p\Grapheme::grapheme_strstr( $haystack, $needle, $beforeNeedle ); } |
|
55 | 55 | } |
56 | -if (!function_exists('grapheme_substr')) { |
|
57 | - function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); } |
|
56 | +if ( ! function_exists( 'grapheme_substr' ) ) { |
|
57 | + function grapheme_substr( $string, $offset, $length = null ) { return p\Grapheme::grapheme_substr( $string, $offset, $length ); } |
|
58 | 58 | } |