File tree Expand file tree Collapse file tree 4 files changed +15
-23
lines changed Expand file tree Collapse file tree 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
7171
7272 /**
7373 * Displays the help for the spark cli script itself.
74+ *
75+ * @return int
7476 */
7577 public function run (array $ params )
7678 {
7779 $ commands = $ this ->commands ->getCommands ();
7880 ksort ($ commands );
7981
8082 // 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
8284 ? $ this ->listSimple ($ commands )
8385 : $ this ->listFull ($ commands );
8486 }
8587
8688 /**
8789 * Lists the commands with accompanying info.
8890 *
89- * @return void
91+ * @return int
9092 */
9193 protected function listFull (array $ commands )
9294 {
@@ -124,17 +126,21 @@ protected function listFull(array $commands)
124126 CLI ::newLine ();
125127 }
126128 }
129+
130+ return EXIT_SUCCESS ;
127131 }
128132
129133 /**
130134 * Lists the commands only.
131135 *
132- * @return void
136+ * @return int
133137 */
134138 protected function listSimple (array $ commands )
135139 {
136140 foreach (array_keys ($ commands ) as $ title ) {
137141 CLI ::write ($ title );
138142 }
143+
144+ return EXIT_SUCCESS ;
139145 }
140146}
Original file line number Diff line number Diff line change 2020use CodeIgniter \Test \Mock \MockLogger as LoggerConfig ;
2121use Exception ;
2222use PHPUnit \Framework \Attributes \Group ;
23+ use ReflectionMethod ;
24+ use ReflectionNamedType ;
2325use Tests \Support \Log \Handlers \TestHandler ;
2426use TypeError ;
2527
@@ -67,7 +69,10 @@ public function testLogAlwaysReturnsVoid(): void
6769
6870 $ logger = new Logger ($ config );
6971
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 ());
7176 }
7277
7378 public function testLogActuallyLogs (): void
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ includes:
3737 - method.impossibleType.neon
3838 - method.notFound.neon
3939 - method.unused.neon
40- - method.void.neon
4140 - missingType.callable.neon
4241 - missingType.iterableValue.neon
4342 - missingType.parameter.neon
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments