1 | <?php |
||
27 | class SubCommandConfig extends CommandConfig |
||
28 | { |
||
29 | /** |
||
30 | * @var CommandConfig |
||
31 | */ |
||
32 | private $parentConfig; |
||
33 | |||
34 | /** |
||
35 | * Creates a new configuration. |
||
36 | * |
||
37 | * @param string $name The name of the command. |
||
|
|||
38 | * @param CommandConfig $parentConfig The command configuration that |
||
39 | * contains this configuration. |
||
40 | */ |
||
41 | 85 | public function __construct($name = null, CommandConfig $parentConfig = null) |
|
42 | { |
||
43 | 85 | parent::__construct($name); |
|
44 | |||
45 | 85 | if ($parentConfig) { |
|
46 | 22 | $this->setParentConfig($parentConfig); |
|
47 | } |
||
48 | 85 | } |
|
49 | |||
50 | /** |
||
51 | * Returns the parent command configuration. |
||
52 | * |
||
53 | * @return CommandConfig The parent command configuration. |
||
54 | */ |
||
55 | 4 | public function getParentConfig() |
|
59 | |||
60 | /** |
||
61 | * Sets the parent command configuration. |
||
62 | * |
||
63 | * @param CommandConfig $parentConfig The parent command configuration. |
||
64 | */ |
||
65 | 50 | public function setParentConfig(CommandConfig $parentConfig) |
|
66 | { |
||
67 | 50 | $this->parentConfig = $parentConfig; |
|
68 | |||
69 | 50 | if ($parentConfig->getApplicationConfig()) { |
|
70 | 30 | $this->setApplicationConfig($parentConfig->getApplicationConfig()); |
|
71 | } |
||
72 | 50 | } |
|
73 | |||
74 | /** |
||
75 | * Ends the block when dynamically configuring a nested configuration. |
||
76 | * |
||
77 | * This method is usually used together with |
||
78 | * {@link CommandConfig::beginSubCommand()}, |
||
79 | * {@link CommandConfig::beginOptionCommand()} or |
||
80 | * {@link CommandConfig::beginDefaultCommand()}: |
||
81 | * |
||
82 | * ```php |
||
83 | * $config |
||
84 | * ->beginSubCommand('add') |
||
85 | * // ... |
||
86 | * ->end() |
||
87 | * |
||
88 | * // ... |
||
89 | * ; |
||
90 | * ``` |
||
91 | * |
||
92 | * @return CommandConfig|SubCommandConfig|OptionCommandConfig The parent command configuration. |
||
93 | */ |
||
94 | 14 | public function end() |
|
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | 1 | protected function getDefaultHelperSet() |
|
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | 1 | protected function getDefaultHandler() |
|
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | 5 | protected function getDefaultHandlerMethod() |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 127 | protected function getDefaultArgsParser() |
|
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 127 | protected function getDefaultLenientArgsParsing() |
|
148 | } |
||
149 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.