Skip to content

Commit 1fcb150

Browse files
committed
fix: syntax error on < php 7.4
1 parent 6bf883c commit 1fcb150

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/CliApp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected function initCommandFlags(string $command, $handler): FlagsParser
302302
*
303303
* @return mixed
304304
*/
305-
public function runHandler($handler, FlagsParser $cFlags): mixed
305+
public function runHandler($handler, FlagsParser $cFlags)
306306
{
307307
// function name
308308
if (is_string($handler) && function_exists($handler)) {

test/CliAppTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Toolkit\PFlag\CliApp;
66
use Toolkit\Stdlib\Obj\DataObject;
7-
use const PHP_VERSION_ID;
87

98
/**
109
* class CliAppTest
@@ -17,18 +16,16 @@ private function initApp(CliApp $app): DataObject
1716
{
1817
$buf = DataObject::new();
1918

20-
if (PHP_VERSION_ID > 70400) {
21-
$app->add('test1', fn() => $buf->set('key', 'in test1'));
22-
} else {
23-
$app->add('test1', function() use($buf) {
24-
$buf->set('key', 'in test2');
25-
});
26-
}
19+
// php 7.4+
20+
// $app->add('test1', fn() => $buf->set('key', 'in test1'));
21+
$app->add('test1', function () use ($buf) {
22+
$buf->set('key', 'in test1');
23+
});
2724

2825
$app->addCommands([
2926
'test2' => [
30-
'desc' => 'desc for test2 command',
31-
'handler' => function() use($buf) {
27+
'desc' => 'desc for test2 command',
28+
'handler' => function () use ($buf) {
3229
$buf->set('key', 'in test2');
3330
},
3431
'options' => [

0 commit comments

Comments
 (0)