@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'secondBooleanItem' => false, |
79 | 79 | 'thirdNullItem' => null, |
80 | 80 | 'fourthArrayItem' => [ |
81 | - 1, // index 0 |
|
82 | - 'two', // index 1 |
|
83 | - true, // index 2 |
|
81 | + 1, // index 0 |
|
82 | + 'two', // index 1 |
|
83 | + true, // index 2 |
|
84 | 84 | ['ABC'], // index 3 |
85 | 85 | 'key' => 'value' // index 'key', |
86 | 86 | ] |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Original cookies |
103 | 103 | [ |
104 | 104 | 'dateTimeObject' => new \DateTime(), |
105 | - 'function' => function () { |
|
105 | + 'function' => function() { |
|
106 | 106 | }, |
107 | 107 | ], |
108 | 108 | // Serialized string |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $stmt = $conn->createStatement(); |
76 | 76 | $rs = $stmt->executeQuery('select * from product_category_translation limit 1000'); |
77 | 77 | |
78 | - $list = $ba->java('java.util.LinkedList'); // 1 round trip (ArrayList is possible) |
|
78 | + $list = $ba->java('java.util.LinkedList'); // 1 round trip (ArrayList is possible) |
|
79 | 79 | |
80 | 80 | while ($rs->next()) { |
81 | 81 | $list->add($rs->getString('title')); // Data is set in the JVM only |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $stmt = $conn->createStatement(); |
110 | 110 | $rs = $stmt->executeQuery('select * from product_category limit 1000'); |
111 | 111 | |
112 | - $list = $ba->java('java.util.HashMap'); // 1 round trip |
|
112 | + $list = $ba->java('java.util.HashMap'); // 1 round trip |
|
113 | 113 | |
114 | 114 | while ($rs->next()) { |
115 | 115 | $list->put($rs->getString('reference'), $rs->getString('title')); // Data is set in the JVM only |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $bm->time( |
59 | 59 | 'New java(`java.lang.String`, "One")', |
60 | - function ($iterations) use ($ba) { |
|
60 | + function($iterations) use ($ba) { |
|
61 | 61 | for ($i = 0; $i < $iterations; ++$i) { |
62 | 62 | $ba->java('java.lang.String', 'One'); |
63 | 63 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $bm->time( |
68 | 68 | 'New java(`java.math.BigInteger`, 1)', |
69 | - function ($iterations) use ($ba) { |
|
69 | + function($iterations) use ($ba) { |
|
70 | 70 | for ($i = 0; $i < $iterations; ++$i) { |
71 | 71 | $ba->java('java.math.BigInteger', $i); |
72 | 72 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $bm->time( |
77 | 77 | 'javaClass(`java.sql.DriverManager`)', |
78 | - function ($iterations) use ($ba) { |
|
78 | + function($iterations) use ($ba) { |
|
79 | 79 | for ($i = 0; $i < $iterations; ++$i) { |
80 | 80 | $ba->javaClass('java.sql.DriverManager'); |
81 | 81 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $bm->time( |
88 | 88 | 'Enums on javaClass', |
89 | - function ($iterations) use ($ba, $formatStyle) { |
|
89 | + function($iterations) use ($ba, $formatStyle) { |
|
90 | 90 | for ($i = 0; $i < $iterations; ++$i) { |
91 | 91 | $style = $formatStyle->LONG; |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $jString = $ba->java('java.lang.String', 'Hello world'); |
97 | 97 | $bm->time( |
98 | 98 | 'Method call `java.lang.String->length()`', |
99 | - function ($iterations) use ($ba, $jString) { |
|
99 | + function($iterations) use ($ba, $jString) { |
|
100 | 100 | for ($i = 0; $i < $iterations; ++$i) { |
101 | 101 | $len = $jString->length(); |
102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $jString = $ba->java('java.lang.String', 'Hello world'); |
107 | 107 | $bm->time( |
108 | 108 | 'Method call `String->concat("hello")`', |
109 | - function ($iterations) use ($ba, $jString) { |
|
109 | + function($iterations) use ($ba, $jString) { |
|
110 | 110 | for ($i = 0; $i < $iterations; ++$i) { |
111 | 111 | $jString->concat('hello'); |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $jString = $ba->java('java.lang.String', 'Hello world'); |
117 | 117 | $bm->time( |
118 | 118 | "\$a = `...String->concat('hello')` . ' world'", |
119 | - function ($iterations) use ($ba, $jString) { |
|
119 | + function($iterations) use ($ba, $jString) { |
|
120 | 120 | for ($i = 0; $i < $iterations; ++$i) { |
121 | 121 | $a = $jString->concat('hello').' world'; |
122 | 122 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $bm->time( |
131 | 131 | 'New java(`java.util.HashMap`, $arr)', |
132 | - function ($iterations) use ($ba, $arr) { |
|
132 | + function($iterations) use ($ba, $arr) { |
|
133 | 133 | for ($i = 0; $i < $iterations; ++$i) { |
134 | 134 | $ba->java('java.util.HashMap', $arr); |
135 | 135 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $hashMap = $ba->java('java.util.HashMap', $arr); |
140 | 140 | $bm->time( |
141 | 141 | 'Method call `HashMap->get(\'arrKey\')`', |
142 | - function ($iterations) use ($ba, $hashMap) { |
|
142 | + function($iterations) use ($ba, $hashMap) { |
|
143 | 143 | for ($i = 0; $i < $iterations; ++$i) { |
144 | 144 | $phpArray = $hashMap->get('arrKey'); |
145 | 145 | // $arr is a 'io.soluble.pjb.bridge.PhpArray' |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $hashMap = $ba->java('java.util.HashMap', $arr); |
154 | 154 | $bm->time( |
155 | 155 | 'Call `(string) HashMap->get(\'arrKey\')[0]`', |
156 | - function ($iterations) use ($ba, $hashMap) { |
|
156 | + function($iterations) use ($ba, $hashMap) { |
|
157 | 157 | for ($i = 0; $i < $iterations; ++$i) { |
158 | 158 | $phpArray = $hashMap->get('arrKey'); |
159 | 159 | $str = (string) $phpArray[0]; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $hashMap = $ba->java('java.util.HashMap', $arr); |
165 | 165 | $bm->time( |
166 | 166 | 'Iterate HashMap->get(\'arrKey\')[0]`', |
167 | - function ($iterations) use ($ba, $hashMap) { |
|
167 | + function($iterations) use ($ba, $hashMap) { |
|
168 | 168 | for ($i = 0; $i < $iterations; ++$i) { |
169 | 169 | $phpArray = $hashMap->get('arrKey'); |
170 | 170 | foreach ($phpArray as $value) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $hashMap = $ba->java('java.util.HashMap', $arr); |
178 | 178 | $bm->time( |
179 | 179 | 'GetValues on `HashMap`', |
180 | - function ($iterations) use ($ba, $hashMap) { |
|
180 | + function($iterations) use ($ba, $hashMap) { |
|
181 | 181 | for ($i = 0; $i < $iterations; ++$i) { |
182 | 182 | $vals = $ba->values($hashMap); |
183 | 183 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $bigArray = array_fill(0, 100, true); |
188 | 188 | $bm->time( |
189 | 189 | 'New `java(HashMap(array_fill(0, 100, true)))`', |
190 | - function ($iterations) use ($ba, $bigArray) { |
|
190 | + function($iterations) use ($ba, $bigArray) { |
|
191 | 191 | for ($i = 0; $i < $iterations; ++$i) { |
192 | 192 | $ba->java('java.util.HashMap', $bigArray); |
193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $bm->time( |
198 | 198 | 'Pure PHP: call PHP strlen() method', |
199 | - function ($iterations) { |
|
199 | + function($iterations) { |
|
200 | 200 | for ($i = 0; $i < $iterations; ++$i) { |
201 | 201 | strlen('Hello World'); |
202 | 202 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $phpString = 'Hello world'; |
207 | 207 | $bm->time( |
208 | 208 | 'Pure PHP: concat \'$string . "hello"\' ', |
209 | - function ($iterations) use (&$phpString) { |
|
209 | + function($iterations) use (&$phpString) { |
|
210 | 210 | for ($i = 0; $i < $iterations; ++$i) { |
211 | 211 | $phpString = $phpString.'Hello World'; |
212 | 212 | } |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | public function time($name, callable $fn) |
245 | 245 | { |
246 | 246 | if (!$this->tableHeaderPrinted) { |
247 | - echo '| Benchmark name | '.implode('|', array_map(function ($iter) { |
|
247 | + echo '| Benchmark name | '.implode('|', array_map(function($iter) { |
|
248 | 248 | return " x$iter "; |
249 | 249 | }, $this->iterations)).'| Average | Memory |'.PHP_EOL; |
250 | - echo '|----| '.implode('|', array_map(function ($iter) { |
|
250 | + echo '|----| '.implode('|', array_map(function($iter) { |
|
251 | 251 | return '----:'; |
252 | 252 | }, $this->iterations)).'|-------:|----:| '.PHP_EOL; |
253 | 253 | $this->tableHeaderPrinted = true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $ttime = array_sum($times); |
273 | 273 | echo number_format($ttime * 1000, 2); |
274 | 274 | */ |
275 | - echo "| $name | ".implode('| ', array_map(function ($time) { |
|
275 | + echo "| $name | ".implode('| ', array_map(function($time) { |
|
276 | 276 | return number_format($time * 1000, 2).'ms'; |
277 | 277 | }, $times)).'| '. |
278 | 278 | number_format($avg * 1000, 2).'ms| '. |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * Soluble Japha |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * Soluble Japha |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * Soluble Japha |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * soluble-japha / PHPJavaBridge driver client. |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Soluble Japha / PhpJavaBridge. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return PjbProxyClient |
160 | 160 | */ |
161 | - public static function getInstance(?array $options = null, ?LoggerInterface $logger = null): PjbProxyClient |
|
161 | + public static function getInstance(? array $options = null, ?LoggerInterface $logger = null) : PjbProxyClient |
|
162 | 162 | { |
163 | 163 | if (self::$instance === null) { |
164 | 164 | if ($options === null) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | /** |
5 | 5 | * soluble-japha / PHPJavaBridge driver client. |
6 | 6 | * |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * |
647 | 647 | * @param int $object object identifier |
648 | 648 | */ |
649 | - public function unref(?int $object): void |
|
649 | + public function unref(?int $object) : void |
|
650 | 650 | { |
651 | 651 | if (isset($this->protocol)) { |
652 | 652 | $this->protocol->writeUnref($object); |