File tree 4 files changed +15
-23
lines changed
4 files changed +15
-23
lines changed Original file line number Diff line number Diff line change @@ -71,22 +71,24 @@ class ListCommands extends BaseCommand
71
71
72
72
/**
73
73
* Displays the help for the spark cli script itself.
74
+ *
75
+ * @return int
74
76
*/
75
77
public function run (array $ params )
76
78
{
77
79
$ commands = $ this ->commands ->getCommands ();
78
80
ksort ($ commands );
79
81
80
82
// Check for 'simple' format
81
- return array_key_exists ('simple ' , $ params ) || CLI ::getOption ('simple ' )
83
+ return array_key_exists ('simple ' , $ params ) || CLI ::getOption ('simple ' ) === true
82
84
? $ this ->listSimple ($ commands )
83
85
: $ this ->listFull ($ commands );
84
86
}
85
87
86
88
/**
87
89
* Lists the commands with accompanying info.
88
90
*
89
- * @return void
91
+ * @return int
90
92
*/
91
93
protected function listFull (array $ commands )
92
94
{
@@ -124,17 +126,21 @@ protected function listFull(array $commands)
124
126
CLI ::newLine ();
125
127
}
126
128
}
129
+
130
+ return EXIT_SUCCESS ;
127
131
}
128
132
129
133
/**
130
134
* Lists the commands only.
131
135
*
132
- * @return void
136
+ * @return int
133
137
*/
134
138
protected function listSimple (array $ commands )
135
139
{
136
140
foreach (array_keys ($ commands ) as $ title ) {
137
141
CLI ::write ($ title );
138
142
}
143
+
144
+ return EXIT_SUCCESS ;
139
145
}
140
146
}
Original file line number Diff line number Diff line change 20
20
use CodeIgniter \Test \Mock \MockLogger as LoggerConfig ;
21
21
use Exception ;
22
22
use PHPUnit \Framework \Attributes \Group ;
23
+ use ReflectionMethod ;
24
+ use ReflectionNamedType ;
23
25
use Tests \Support \Log \Handlers \TestHandler ;
24
26
use TypeError ;
25
27
@@ -67,7 +69,10 @@ public function testLogAlwaysReturnsVoid(): void
67
69
68
70
$ logger = new Logger ($ config );
69
71
70
- $ this ->assertNull ($ logger ->log ('debug ' , '' ));
72
+ $ refMethod = new ReflectionMethod ($ logger , 'log ' );
73
+ $ this ->assertTrue ($ refMethod ->hasReturnType ());
74
+ $ this ->assertInstanceOf (ReflectionNamedType::class, $ refMethod ->getReturnType ());
75
+ $ this ->assertSame ('void ' , $ refMethod ->getReturnType ()->getName ());
71
76
}
72
77
73
78
public function testLogActuallyLogs (): void
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ includes:
37
37
- method.impossibleType.neon
38
38
- method.notFound.neon
39
39
- method.unused.neon
40
- - method.void.neon
41
40
- missingType.callable.neon
42
41
- missingType.iterableValue.neon
43
42
- missingType.parameter.neon
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments