1 | <?php |
||||
2 | /** |
||||
3 | * This file is part of the O2System Framework package. |
||||
4 | * |
||||
5 | * For the full copyright and license information, please view the LICENSE |
||||
6 | * file that was distributed with this source code. |
||||
7 | * |
||||
8 | * @author Steeve Andrian Salim |
||||
9 | * @copyright Copyright (c) Steeve Andrian Salim |
||||
10 | */ |
||||
11 | |||||
12 | // ------------------------------------------------------------------------ |
||||
13 | |||||
14 | namespace O2System\Kernel\Cli; |
||||
15 | |||||
16 | // ------------------------------------------------------------------------ |
||||
17 | |||||
18 | use O2System\Kernel\Cli\Abstracts\AbstractCommander; |
||||
19 | use O2System\Kernel\Cli\Writers\Format; |
||||
20 | |||||
21 | /** |
||||
22 | * Class Commander |
||||
23 | * |
||||
24 | * @package O2System\Framework\Abstracts |
||||
25 | */ |
||||
26 | abstract class Commander extends AbstractCommander |
||||
27 | { |
||||
28 | /** |
||||
29 | * Commander::$app |
||||
30 | * |
||||
31 | * Commander cli-app. |
||||
32 | * |
||||
33 | * @var App |
||||
34 | */ |
||||
35 | protected $app; |
||||
36 | |||||
37 | // ------------------------------------------------------------------------ |
||||
38 | |||||
39 | /** |
||||
40 | * Commander::setApp |
||||
41 | * |
||||
42 | * @param \O2System\Kernel\Cli\App $app |
||||
43 | */ |
||||
44 | public function setApp(App $app) |
||||
45 | { |
||||
46 | $this->app = $app; |
||||
47 | } |
||||
48 | |||||
49 | // ------------------------------------------------------------------------ |
||||
50 | |||||
51 | /** |
||||
52 | * Commander::optionVersion |
||||
53 | * |
||||
54 | * Option version method, write commander version string. |
||||
55 | * |
||||
56 | * @return void |
||||
57 | */ |
||||
58 | public function optionVersion() |
||||
59 | { |
||||
60 | if (property_exists($this, 'commandVersion')) { |
||||
61 | if ( ! empty($this->commandVersion)) { |
||||
62 | // Show Name & Version Line |
||||
63 | output()->write( |
||||
0 ignored issues
–
show
|
|||||
64 | (new Format()) |
||||
65 | ->setString($this->optionVersion() . ucfirst($this->commandName) . ' v' . $this->commandVersion) |
||||
0 ignored issues
–
show
Are you sure the usage of
$this->optionVersion() targeting O2System\Kernel\Cli\Commander::optionVersion() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() Are you sure
$this->optionVersion() of type void can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
66 | ->setNewLinesAfter(1) |
||||
67 | ); |
||||
68 | } |
||||
69 | } |
||||
70 | } |
||||
71 | |||||
72 | // ------------------------------------------------------------------------ |
||||
73 | |||||
74 | /** |
||||
75 | * Commander::__call |
||||
76 | * |
||||
77 | * @param string $method |
||||
78 | * @param array $args |
||||
79 | * |
||||
80 | * @return mixed |
||||
81 | */ |
||||
82 | public function __call($method, array $args = []) |
||||
83 | { |
||||
84 | if (method_exists($this, $method)) { |
||||
85 | return call_user_func_array([$this, $method], $args); |
||||
86 | } |
||||
87 | } |
||||
88 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.