@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | * @dataProvider padRightProvider() |
1002 | 1002 | */ |
1003 | 1003 | public function testPadRight($expected, $str, $length, $padStr = ' ', |
1004 | - $encoding = null) |
|
1004 | + $encoding = null) |
|
1005 | 1005 | { |
1006 | 1006 | $stringy = StringType::create($str, $encoding); |
1007 | 1007 | $result = $stringy->padRight($length, $padStr); |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | * @dataProvider startsWithProvider() |
1058 | 1058 | */ |
1059 | 1059 | public function testStartsWith($expected, $str, $substring, |
1060 | - $caseSensitive = true, $encoding = null) |
|
1060 | + $caseSensitive = true, $encoding = null) |
|
1061 | 1061 | { |
1062 | 1062 | $stringy = StringType::create($str, $encoding); |
1063 | 1063 | $result = $stringy->startsWith($substring, $caseSensitive); |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @dataProvider startsWithProviderAny() |
1088 | 1088 | */ |
1089 | 1089 | public function testStartsWithAny($expected, $str, $substrings, |
1090 | - $caseSensitive = true, $encoding = null) |
|
1090 | + $caseSensitive = true, $encoding = null) |
|
1091 | 1091 | { |
1092 | 1092 | $stringy = StringType::create($str, $encoding); |
1093 | 1093 | $result = $stringy->startsWithAny($substrings, $caseSensitive); |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * @dataProvider endsWithProvider() |
1119 | 1119 | */ |
1120 | 1120 | public function testEndsWith($expected, $str, $substring, |
1121 | - $caseSensitive = true, $encoding = null) |
|
1121 | + $caseSensitive = true, $encoding = null) |
|
1122 | 1122 | { |
1123 | 1123 | $stringy = StringType::create($str, $encoding); |
1124 | 1124 | $result = $stringy->endsWith($substring, $caseSensitive); |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | * @dataProvider containsProvider() |
1409 | 1409 | */ |
1410 | 1410 | public function testContains($expected, $haystack, $needle, |
1411 | - $caseSensitive = true, $encoding = null) |
|
1411 | + $caseSensitive = true, $encoding = null) |
|
1412 | 1412 | { |
1413 | 1413 | $stringy = StringType::create($haystack, $encoding); |
1414 | 1414 | $result = $stringy->contains($needle, $caseSensitive); |
@@ -1573,7 +1573,7 @@ discard block |
||
1573 | 1573 | * @dataProvider insertProvider() |
1574 | 1574 | */ |
1575 | 1575 | public function testInsert($expected, $str, $substring, $index, |
1576 | - $encoding = null) |
|
1576 | + $encoding = null) |
|
1577 | 1577 | { |
1578 | 1578 | $stringy = StringType::create($str, $encoding); |
1579 | 1579 | $result = $stringy->insert($substring, $index); |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | * @dataProvider truncateProvider() |
1601 | 1601 | */ |
1602 | 1602 | public function testTruncate($expected, $str, $length, $substring = '', |
1603 | - $encoding = null) |
|
1603 | + $encoding = null) |
|
1604 | 1604 | { |
1605 | 1605 | $stringy = StringType::create($str, $encoding); |
1606 | 1606 | $result = $stringy->truncate($length, $substring); |
@@ -1641,7 +1641,7 @@ discard block |
||
1641 | 1641 | * @dataProvider safeTruncateProvider() |
1642 | 1642 | */ |
1643 | 1643 | public function testSafeTruncate($expected, $str, $length, $substring = '', |
1644 | - $encoding = null) |
|
1644 | + $encoding = null) |
|
1645 | 1645 | { |
1646 | 1646 | $stringy = StringType::create($str, $encoding); |
1647 | 1647 | $result = $stringy->safeTruncate($length, $substring); |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | * @dataProvider trimLeftProvider() |
1793 | 1793 | */ |
1794 | 1794 | public function testTrimLeft($expected, $str, $chars = null, |
1795 | - $encoding = null) |
|
1795 | + $encoding = null) |
|
1796 | 1796 | { |
1797 | 1797 | $stringy = StringType::create($str, $encoding); |
1798 | 1798 | $result = $stringy->trimLeft($chars); |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | * @dataProvider trimRightProvider() |
1825 | 1825 | */ |
1826 | 1826 | public function testTrimRight($expected, $str, $chars = null, |
1827 | - $encoding = null) |
|
1827 | + $encoding = null) |
|
1828 | 1828 | { |
1829 | 1829 | $stringy = StringType::create($str, $encoding); |
1830 | 1830 | $result = $stringy->trimRight($chars); |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | * @dataProvider longestCommonSubstringProvider() |
1915 | 1915 | */ |
1916 | 1916 | public function testLongestCommonSubstring($expected, $str, $otherStr, |
1917 | - $encoding = null) |
|
1917 | + $encoding = null) |
|
1918 | 1918 | { |
1919 | 1919 | $stringy = StringType::create($str, $encoding); |
1920 | 1920 | $result = $stringy->longestCommonSubstring($otherStr); |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | * @dataProvider sliceProvider() |
1966 | 1966 | */ |
1967 | 1967 | public function testSlice($expected, $str, $start, $end = null, |
1968 | - $encoding = null) |
|
1968 | + $encoding = null) |
|
1969 | 1969 | { |
1970 | 1970 | $stringy = StringType::create($str, $encoding); |
1971 | 1971 | $result = $stringy->slice($start, $end); |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | * @dataProvider splitProvider() |
2001 | 2001 | */ |
2002 | 2002 | public function testSplit($expected, $str, $pattern, $limit = null, |
2003 | - $encoding = null) |
|
2003 | + $encoding = null) |
|
2004 | 2004 | { |
2005 | 2005 | $stringy = StringType::create($str, $encoding); |
2006 | 2006 | $result = $stringy->split($pattern, $limit); |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | * @dataProvider substrProvider() |
2075 | 2075 | */ |
2076 | 2076 | public function testSubstr($expected, $str, $start, $length = null, |
2077 | - $encoding = null) |
|
2077 | + $encoding = null) |
|
2078 | 2078 | { |
2079 | 2079 | $stringy = StringType::create($str, $encoding); |
2080 | 2080 | $result = $stringy->substr($start, $length); |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | * @dataProvider regexReplaceProvider() |
2697 | 2697 | */ |
2698 | 2698 | public function testregexReplace($expected, $str, $pattern, $replacement, |
2699 | - $options = 'msr', $encoding = null) |
|
2699 | + $options = 'msr', $encoding = null) |
|
2700 | 2700 | { |
2701 | 2701 | $stringy = StringType::create($str, $encoding); |
2702 | 2702 | $result = $stringy->regexReplace($pattern, $replacement, $options); |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | |
144 | 144 | $this->assertEquals( |
145 | 145 | new Collection(['this', 'is', 'my', 'list'], StringType::class), |
146 | - StringType::create(' this, is, my , list '.PHP_EOL)->explode(', ') |
|
146 | + StringType::create(' this, is, my , list ' . PHP_EOL)->explode(', ') |
|
147 | 147 | ); |
148 | 148 | |
149 | 149 | $this->assertEquals( |
150 | - new Collection([' this', 'is', 'my ', 'list '.PHP_EOL], StringType::class), |
|
151 | - StringType::create(' this, is, my , list '.PHP_EOL)->explode(', ', PHP_INT_MAX, false) |
|
150 | + new Collection([' this', 'is', 'my ', 'list ' . PHP_EOL], StringType::class), |
|
151 | + StringType::create(' this, is, my , list ' . PHP_EOL)->explode(', ', PHP_INT_MAX, false) |
|
152 | 152 | ); |
153 | 153 | } |
154 | 154 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @param string|null $encoding |
341 | 341 | */ |
342 | 342 | public function testIndexOf( |
343 | - bool|int $expected, |
|
343 | + bool | int $expected, |
|
344 | 344 | string $str, |
345 | 345 | string $subStr, |
346 | 346 | ?int $offset = 0, |
@@ -753,8 +753,8 @@ discard block |
||
753 | 753 | ['test=c=c=test', 'TestCCTest', '='], |
754 | 754 | ['string#>with1number', 'string_with1number', '#>'], |
755 | 755 | ['1test2case', '1test2case', '*'], |
756 | - ['test ύα σase', 'test Σase', ' ύα ', 'UTF-8',], |
|
757 | - ['στανιλαcase', 'Στανιλ case', 'α', 'UTF-8',], |
|
756 | + ['test ύα σase', 'test Σase', ' ύα ', 'UTF-8', ], |
|
757 | + ['στανιλαcase', 'Στανιλ case', 'α', 'UTF-8', ], |
|
758 | 758 | ['σashΘcase', 'Σash Case', 'Θ', 'UTF-8'] |
759 | 759 | ]; |
760 | 760 | } |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | { |
1422 | 1422 | return [ |
1423 | 1423 | [true, 'Str contains foo bar', 'foo bar'], |
1424 | - [true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%'], |
|
1424 | + [true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%'], |
|
1425 | 1425 | [true, 'Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'], |
1426 | 1426 | [true, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'å´¥©', true, 'UTF-8'], |
1427 | 1427 | [true, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'å˚ ∆', true, 'UTF-8'], |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | [false, 'Ο συγγραφέας είπε', ' συγγραφέας ', true, 'UTF-8'], |
1433 | 1433 | [false, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', ' ßå˚', true, 'UTF-8'], |
1434 | 1434 | [true, 'Str contains foo bar', 'Foo bar', false], |
1435 | - [true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%', false], |
|
1435 | + [true, '12398!@(*%!@# @!%#*&^%', ' @!%#*&^%', false], |
|
1436 | 1436 | [true, 'Ο συγγραφέας είπε', 'ΣΥΓΓΡΑΦΈΑΣ', false, 'UTF-8'], |
1437 | 1437 | [true, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'Å´¥©', false, 'UTF-8'], |
1438 | 1438 | [true, 'å´¥©¨ˆßå˚ ∆∂˙©å∑¥øœ¬', 'Å˚ ∆', false, 'UTF-8'], |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | public function containsAnyProvider() |
1461 | 1461 | { |
1462 | 1462 | // One needle |
1463 | - $singleNeedle = array_map(function ($array) { |
|
1463 | + $singleNeedle = array_map(function($array) { |
|
1464 | 1464 | $array[2] = [$array[2]]; |
1465 | 1465 | return $array; |
1466 | 1466 | }, $this->containsProvider()); |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | public function containsAllProvider() |
1512 | 1512 | { |
1513 | 1513 | // One needle |
1514 | - $singleNeedle = array_map(function ($array) { |
|
1514 | + $singleNeedle = array_map(function($array) { |
|
1515 | 1515 | $array[2] = [$array[2]]; |
1516 | 1516 | return $array; |
1517 | 1517 | }, $this->containsProvider()); |
@@ -2528,10 +2528,10 @@ discard block |
||
2528 | 2528 | return [ |
2529 | 2529 | [false, ' '], |
2530 | 2530 | [true, ''], |
2531 | - [true, base64_encode('FooBar') ], |
|
2532 | - [true, base64_encode(' ') ], |
|
2533 | - [true, base64_encode('FÒÔBÀŘ') ], |
|
2534 | - [true, base64_encode('συγγραφέας') ], |
|
2531 | + [true, base64_encode('FooBar')], |
|
2532 | + [true, base64_encode(' ')], |
|
2533 | + [true, base64_encode('FÒÔBÀŘ')], |
|
2534 | + [true, base64_encode('συγγραφέας')], |
|
2535 | 2535 | [false, 'Foobar'], |
2536 | 2536 | ]; |
2537 | 2537 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | { |
72 | 72 | $this->collection->add('one'); |
73 | 73 | $this->collection->add('two'); |
74 | - $exists = $this->collection->exists(static function ($k, $e) { |
|
74 | + $exists = $this->collection->exists(static function($k, $e) { |
|
75 | 75 | return $e === 'one'; |
76 | 76 | }); |
77 | 77 | self::assertTrue($exists); |
78 | - $exists = $this->collection->exists(static function ($k, $e) { |
|
78 | + $exists = $this->collection->exists(static function($k, $e) { |
|
79 | 79 | return $e === 'other'; |
80 | 80 | }); |
81 | 81 | self::assertFalse($exists); |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | $elements = [1, 'A' => 'a', 2, 'null' => null, 3, 'A2' => 'a', 'zero' => 0]; |
84 | 84 | $collection = $this->buildCollection($elements); |
85 | 85 | |
86 | - self::assertTrue($collection->exists(static function ($key, $element) { |
|
86 | + self::assertTrue($collection->exists(static function($key, $element) { |
|
87 | 87 | return $key === 'A' && $element === 'a'; |
88 | 88 | }), 'Element exists'); |
89 | 89 | |
90 | - self::assertFalse($collection->exists(static function ($key, $element) { |
|
90 | + self::assertFalse($collection->exists(static function($key, $element) { |
|
91 | 91 | return $key === 'non-existent' && $element === 'non-existent'; |
92 | 92 | }), 'Element not exists'); |
93 | 93 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $this->collection->add(1); |
98 | 98 | $this->collection->add(2); |
99 | - $res = $this->collection->map(static function ($e) { |
|
99 | + $res = $this->collection->map(static function($e) { |
|
100 | 100 | return $e * 2; |
101 | 101 | }); |
102 | 102 | self::assertEquals([2, 4], $res->toArray()); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->collection->add(1); |
108 | 108 | $this->collection->add('foo'); |
109 | 109 | $this->collection->add(3); |
110 | - $res = $this->collection->filter(static function ($e) { |
|
110 | + $res = $this->collection->filter(static function($e) { |
|
111 | 111 | return is_numeric($e); |
112 | 112 | }); |
113 | 113 | self::assertEquals([0 => 1, 2 => 3], $res->toArray()); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->collection->add(3); |
121 | 121 | $this->collection->add(4); |
122 | 122 | $this->collection->add(5); |
123 | - $res = $this->collection->filter(static function ($v, $k) { |
|
123 | + $res = $this->collection->filter(static function($v, $k) { |
|
124 | 124 | return is_numeric($v) && $k % 2 === 0; |
125 | 125 | }); |
126 | 126 | self::assertSame([0 => 1, 2 => 3, 4 => 5], $res->toArray()); |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | { |
181 | 181 | $this->collection[] = 'one'; |
182 | 182 | $this->collection[] = 'two'; |
183 | - self::assertEquals(true, $this->collection->forAll(static function ($k, $e) { |
|
183 | + self::assertEquals(true, $this->collection->forAll(static function($k, $e) { |
|
184 | 184 | return is_string($e); |
185 | 185 | })); |
186 | - self::assertEquals(false, $this->collection->forAll(static function ($k, $e) { |
|
186 | + self::assertEquals(false, $this->collection->forAll(static function($k, $e) { |
|
187 | 187 | return is_array($e); |
188 | 188 | })); |
189 | 189 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | $this->collection[] = true; |
195 | 195 | $this->collection[] = false; |
196 | - $partition = $this->collection->partition(static function ($k, $e) { |
|
196 | + $partition = $this->collection->partition(static function($k, $e) { |
|
197 | 197 | return $e === true; |
198 | 198 | }); |
199 | 199 | self::assertEquals(true, $partition[0][0]); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $collectionNext = $collection->next(); |
395 | 395 | $arrayNext = next($elements); |
396 | 396 | |
397 | - if (! $collectionNext || ! $arrayNext) { |
|
397 | + if (!$collectionNext || !$arrayNext) { |
|
398 | 398 | break; |
399 | 399 | } |
400 | 400 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | 'object2' => $object2, |
600 | 600 | ]); |
601 | 601 | |
602 | - if (! $this->isSelectable($collection)) { |
|
602 | + if (!$this->isSelectable($collection)) { |
|
603 | 603 | $this->markTestSkipped('Collection does not support Selectable interface'); |
604 | 604 | } |
605 | 605 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | 0 => ['foo' => 1, 'bar' => 2], |
629 | 629 | ]; |
630 | 630 | |
631 | - if (! $this->isSelectable($collection)) { |
|
631 | + if (!$this->isSelectable($collection)) { |
|
632 | 632 | $this->markTestSkipped('Collection does not support Selectable interface'); |
633 | 633 | } |
634 | 634 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | /** |
33 | 33 | * @var NumberValidatorInterface|Mock |
34 | 34 | */ |
35 | - private NumberValidatorInterface|Mock $numberValidator; |
|
35 | + private NumberValidatorInterface | Mock $numberValidator; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @var MathAdapterInterface |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param Exception|null $previous |
31 | 31 | */ |
32 | 32 | public function __construct( |
33 | - TypeInterface|NumberTypeInterface $typeFrom, |
|
33 | + TypeInterface | NumberTypeInterface $typeFrom, |
|
34 | 34 | ?Primitive $typeTo = null, |
35 | 35 | ?string $message = null, |
36 | 36 | ?int $code = 0, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function __construct(float $float, ?int $precision = null, MathAdapterInterface $mathAdapter = null) |
40 | 40 | { |
41 | 41 | /** @noinspection PhpNamedArgumentMightBeUnresolvedInspection */ |
42 | - parent::__construct(num: $float, precision: $precision, mathAdapter: $mathAdapter); |
|
42 | + parent::__construct(num : $float, precision : $precision, mathAdapter : $mathAdapter); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function getScalar(Primitive $primitive): string | int | float |
51 | 51 | { |
52 | - return match ((string) $primitive) { |
|
52 | + return match((string) $primitive) { |
|
53 | 53 | (string) Primitive::INT() => (int) $this->getScalarValue(), |
54 | 54 | (string) Primitive::STRING() => (string) $this->getScalarValue(), |
55 | 55 | default => throw new InvalidTypeCastException($this, $primitive), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return NumberTypeInterface |
61 | 61 | */ |
62 | - public function plus(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
62 | + public function plus(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
63 | 63 | { |
64 | 64 | return $this->getAdapterOperation('add', $num); |
65 | 65 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return NumberTypeInterface |
73 | 73 | */ |
74 | - public function minus(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
74 | + public function minus(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
75 | 75 | { |
76 | 76 | return $this->getAdapterOperation('subtract', $num); |
77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return NumberTypeInterface |
85 | 85 | */ |
86 | - public function multipliedBy(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
86 | + public function multipliedBy(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
87 | 87 | { |
88 | 88 | return $this->getAdapterOperation('multiply', $num); |
89 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return NumberTypeInterface |
97 | 97 | */ |
98 | - public function dividedBy(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
98 | + public function dividedBy(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
99 | 99 | { |
100 | 100 | return $this->getAdapterOperation('divide', $num); |
101 | 101 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return NumberTypeInterface |
110 | 110 | */ |
111 | - public function compare(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
111 | + public function compare(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
112 | 112 | { |
113 | 113 | return $this->getAdapterOperation(__FUNCTION__, $num); |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return NumberTypeInterface |
122 | 122 | */ |
123 | - public function modulus(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
123 | + public function modulus(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
124 | 124 | { |
125 | 125 | return $this->getAdapterOperation(__FUNCTION__, $num); |
126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return NumberTypeInterface |
134 | 134 | */ |
135 | - public function power(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
135 | + public function power(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
136 | 136 | { |
137 | 137 | return $this->getAdapterOperation(__FUNCTION__, $num); |
138 | 138 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return NumberTypeInterface |
201 | 201 | */ |
202 | - public function gcd(StringType|NumberTypeInterface|string|float|int $num): NumberTypeInterface |
|
202 | + public function gcd(StringType | NumberTypeInterface | string | float | int $num): NumberTypeInterface |
|
203 | 203 | { |
204 | 204 | return $this->getAdapterOperation(__FUNCTION__, $num); |
205 | 205 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ); |
286 | 286 | } |
287 | 287 | |
288 | - private function getTypeForOperand(mixed $operand): NumberTypeInterface|StringCastable |
|
288 | + private function getTypeForOperand(mixed $operand): NumberTypeInterface | StringCastable |
|
289 | 289 | { |
290 | 290 | if ($operand instanceof IntType) { |
291 | 291 | return new IntType($operand->getScalarValue(), $this->getMathAdapter()); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function __construct(array $elements = [], ?string $type = null) |
101 | 101 | { |
102 | 102 | $this->type = $type; |
103 | - $this->elements = array_map(function ($element) { |
|
103 | + $this->elements = array_map(function($element) { |
|
104 | 104 | return $this->getIntendedValue($element); |
105 | 105 | }, $elements); |
106 | 106 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * {@inheritdoc} |
175 | 175 | */ |
176 | - public function key(): int|string|null |
|
176 | + public function key(): int | string | null |
|
177 | 177 | { |
178 | 178 | return key($this->elements); |
179 | 179 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | /** |
306 | 306 | * {@inheritdoc} |
307 | 307 | */ |
308 | - public function indexOf($element): false|int|string |
|
308 | + public function indexOf($element): false | int | string |
|
309 | 309 | { |
310 | 310 | return array_search($element, $this->elements, true); |
311 | 311 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | public function forAll(Closure $p): bool |
415 | 415 | { |
416 | 416 | foreach ($this->elements as $key => $element) { |
417 | - if (! $p($key, $element)) { |
|
417 | + if (!$p($key, $element)) { |
|
418 | 418 | return false; |
419 | 419 | } |
420 | 420 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | */ |
506 | 506 | public function unique(): Collection |
507 | 507 | { |
508 | - $closure = function ($key, $value) { |
|
508 | + $closure = function($key, $value) { |
|
509 | 509 | // Uniqueness on a bool array would be pointless. |
510 | 510 | return is_scalar($value) && !is_bool($value); |
511 | 511 | }; |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param Primitive|null $primitive |
526 | 526 | * @return int|array|string |
527 | 527 | */ |
528 | - protected function getScalar(?Primitive $primitive = null): int|array|string |
|
528 | + protected function getScalar(?Primitive $primitive = null): int | array | string |
|
529 | 529 | { |
530 | 530 | $primitive = $primitive ?? Primitive::ARRAY(); |
531 | 531 | switch ((string) $primitive) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | } |
617 | 617 | |
618 | 618 | $type = strtolower(gettype($mixed)); |
619 | - return match ($type) { |
|
619 | + return match($type) { |
|
620 | 620 | 'integer', 'double', 'float', 'string', 'object', 'resource', 'boolean' => [$mixed], |
621 | 621 | 'array' => $mixed, |
622 | 622 | default => throw new InvalidTransformationException($type, static::class), |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $clone = clone $this; |
718 | 718 | |
719 | 719 | $types = $clone->map( |
720 | - function (mixed $element): string { |
|
720 | + function(mixed $element): string { |
|
721 | 721 | if (is_object($element)) { |
722 | 722 | return $element::class; |
723 | 723 | } |
@@ -527,7 +527,7 @@ |
||
527 | 527 | */ |
528 | 528 | protected function getScalar(?Primitive $primitive = null): int|array|string |
529 | 529 | { |
530 | - $primitive = $primitive ?? Primitive::ARRAY(); |
|
530 | + $primitive = $primitive ?? Primitive::array(); |
|
531 | 531 | switch ((string) $primitive) { |
532 | 532 | case (string) Primitive::INT(): |
533 | 533 | return $this->count(); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $endOfStr = mb_strtolower($endOfStr, $this->encoding); |
341 | 341 | } |
342 | 342 | |
343 | - return (string)$substring === $endOfStr; |
|
343 | + return (string) $substring === $endOfStr; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | * @param int $offset Offset from which to search |
520 | 520 | * @return int|bool The occurrence's index if found, otherwise false |
521 | 521 | */ |
522 | - public function indexOf(string $needle, $offset = 0): bool|int |
|
522 | + public function indexOf(string $needle, $offset = 0): bool | int |
|
523 | 523 | { |
524 | - return mb_strpos($this->str, (string)$needle, |
|
525 | - (int)$offset, $this->encoding); |
|
524 | + return mb_strpos($this->str, (string) $needle, |
|
525 | + (int) $offset, $this->encoding); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | * @param int $offset Offset from which to search |
536 | 536 | * @return int|bool The last occurrence's index if found, otherwise false |
537 | 537 | */ |
538 | - public function indexOfLast(string $needle, $offset = 0): bool|int |
|
538 | + public function indexOfLast(string $needle, $offset = 0): bool | int |
|
539 | 539 | { |
540 | - return mb_strrpos($this->str, (string)$needle, |
|
541 | - (int)$offset, $this->encoding); |
|
540 | + return mb_strrpos($this->str, (string) $needle, |
|
541 | + (int) $offset, $this->encoding); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | public function offsetExists(mixed $offset): bool |
825 | 825 | { |
826 | 826 | $length = $this->length(); |
827 | - $offset = (int)$offset; |
|
827 | + $offset = (int) $offset; |
|
828 | 828 | |
829 | 829 | if ($offset >= 0) { |
830 | 830 | return ($length > $offset); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | */ |
847 | 847 | public function offsetGet(mixed $offset): string |
848 | 848 | { |
849 | - $offset = (int)$offset; |
|
849 | + $offset = (int) $offset; |
|
850 | 850 | $length = $this->length(); |
851 | 851 | |
852 | 852 | if (($offset >= 0 && $length <= $offset) || $length < abs($offset)) { |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | "to be one of 'left', 'right' or 'both'"); |
905 | 905 | } |
906 | 906 | |
907 | - return match ($padType) { |
|
907 | + return match($padType) { |
|
908 | 908 | 'left' => $this->padLeft($length, $padStr), |
909 | 909 | 'right' => $this->padRight($length, $padStr), |
910 | 910 | default => $this->padBoth($length, $padStr), |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | $startOfStr = mb_strtolower($startOfStr, $this->encoding); |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - return (string)$substring === $startOfStr; |
|
1147 | + return (string) $substring === $startOfStr; |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | $encoding = $this->getEncoding(); |
1316 | 1316 | return static::create(preg_replace_callback( |
1317 | 1317 | '/[\S]/u', |
1318 | - function ($match) use ($encoding) { |
|
1318 | + function($match) use ($encoding) { |
|
1319 | 1319 | if ($match[0] == mb_strtoupper($match[0], $encoding)) { |
1320 | 1320 | return mb_strtolower($match[0], $encoding); |
1321 | 1321 | } |
@@ -1363,14 +1363,14 @@ discard block |
||
1363 | 1363 | $encoding = $this->getEncoding(); |
1364 | 1364 | return static::create(preg_replace_callback( |
1365 | 1365 | '/([\S]+)/u', |
1366 | - function ($match) use ($encoding, $ignore) { |
|
1366 | + function($match) use ($encoding, $ignore) { |
|
1367 | 1367 | if ($ignore && in_array($match[0], $ignore)) { |
1368 | 1368 | return $match[0]; |
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | $stringy = new static($match[0], $encoding); |
1372 | 1372 | |
1373 | - return (string)$stringy->toLowerCase()->upperCaseFirst(); |
|
1373 | + return (string) $stringy->toLowerCase()->upperCaseFirst(); |
|
1374 | 1374 | }, |
1375 | 1375 | $this->str |
1376 | 1376 | ))->trim(); |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | return (intval($this->str) > 0); |
1441 | 1441 | } |
1442 | 1442 | |
1443 | - return (bool)$this->regexReplace('[[:space:]]', '')->str; |
|
1443 | + return (bool) $this->regexReplace('[[:space:]]', '')->str; |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | /** |
@@ -1620,7 +1620,9 @@ |
||
1620 | 1620 | protected function charsArray() |
1621 | 1621 | { |
1622 | 1622 | static $charsArray; |
1623 | - if (isset($charsArray)) return $charsArray; |
|
1623 | + if (isset($charsArray)) { |
|
1624 | + return $charsArray; |
|
1625 | + } |
|
1624 | 1626 | |
1625 | 1627 | return $charsArray = [ |
1626 | 1628 | '0' => ['°', '₀', '۰', '0'], |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | - $pointer =& static::$manager->getPointer($this->referenceAddress); |
|
74 | + $pointer = & static::$manager->getPointer($this->referenceAddress); |
|
75 | 75 | |
76 | 76 | if ($pointer !== $this && $pointer !== null) { |
77 | 77 | try { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $value = $pointer; |
80 | 80 | // Clear pointer before attempting to box new value. |
81 | 81 | $pointer = null; |
82 | - $pointer = $value instanceof static? $value : static::createStatic($value); |
|
82 | + $pointer = $value instanceof static ? $value : static::createStatic($value); |
|
83 | 83 | // Box the new pointer. |
84 | 84 | static::box(pointer: $pointer, manager: static::$manager); |
85 | 85 | } catch (TypeError $e) { |