Skip to content

Commit 14be3a2

Browse files
committed
Make linter happy.
1 parent b43efba commit 14be3a2

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

src/Hooks/Interacter.php

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Pantheon\Terminus\Session\SessionAwareInterface;
1616
use Pantheon\Terminus\Session\SessionAwareTrait;
1717

18-
1918
/**
2019
* Class Interacter
2120
* @package Pantheon\Terminus\Hooks
@@ -27,15 +26,15 @@ class Interacter implements ConfigAwareInterface, ContainerAwareInterface, Sessi
2726
use SessionAwareTrait;
2827

2928
/**
30-
* Gets required arguments in an interactive way.
29+
* Gets arguments and options in an interactive way.
3130
* The Annotated Commands hook manager will call this function during the interact phase
3231
* of any command that has an 'interact' annotation.
33-
*
32+
*
3433
* Possible tag values:
3534
* - only-required-arguments: Only required arguments will be asked for. (default)
3635
* - all-arguments: All arguments will be asked for.
3736
* - all: All arguments and options will be asked for.
38-
*
37+
*
3938
* Also configurable through the 'interact-options-exclude' tag to exclude presenting options for the excluded arguments/options.
4039
*
4140
* @hook interact @interact
@@ -99,7 +98,14 @@ public function interact(InputInterface $input, OutputInterface $output, Annotat
9998
// If the argument is already set, skip it.
10099
continue;
101100
}
102-
$value = $this->ask($io, $interact_options_exclude, false, $name, $argument->getDescription(), $argument->getDefault());
101+
$value = $this->ask(
102+
$io,
103+
$interact_options_exclude,
104+
false,
105+
$name,
106+
$argument->getDescription(),
107+
$argument->getDefault()
108+
);
103109
if (empty($value)) {
104110
continue;
105111
}
@@ -112,7 +118,14 @@ public function interact(InputInterface $input, OutputInterface $output, Annotat
112118
// If the option is already set, skip it.
113119
continue;
114120
}
115-
$value = $this->ask($io, $interact_options_exclude, true, $name, $option->getDescription(), $option->getDefault());
121+
$value = $this->ask(
122+
$io,
123+
$interact_options_exclude,
124+
true,
125+
$name,
126+
$option->getDescription(),
127+
$option->getDefault()
128+
);
116129
if (empty($value)) {
117130
continue;
118131
}
@@ -145,7 +158,14 @@ public function isInteractive(InputInterface $input): bool
145158
return stream_isatty(STDIN) && stream_isatty(STDOUT);
146159
}
147160

148-
protected function ask(SymfonyStyle $io, array $interact_options_exclude, bool $allow_empty, string $name, string $description, $default = null): ?string {
161+
protected function ask(
162+
SymfonyStyle $io,
163+
array $interact_options_exclude,
164+
bool $allow_empty,
165+
string $name,
166+
string $description,
167+
$default = null
168+
): ?string {
149169
$type = $this->inferTypeFromName($name);
150170

151171
switch ($type) {
@@ -174,7 +194,8 @@ protected function ask(SymfonyStyle $io, array $interact_options_exclude, bool $
174194
*
175195
* @return string The inferred type.
176196
*/
177-
public function inferTypeFromName(string $name): string {
197+
public function inferTypeFromName(string $name): string
198+
{
178199
switch ($name) {
179200
case 'org':
180201
case 'organization':
@@ -197,7 +218,8 @@ public function inferTypeFromName(string $name): string {
197218
}
198219
}
199220

200-
public function getOrganizationList($allow_empty = false): array {
221+
public function getOrganizationList($allow_empty = false): array
222+
{
201223
$organizations = [];
202224
if ($allow_empty) {
203225
$organizations[''] = 'None';
@@ -211,7 +233,8 @@ public function getOrganizationList($allow_empty = false): array {
211233
return $organizations;
212234
}
213235

214-
public function getRegionList($allow_empty = false): array {
236+
public function getRegionList($allow_empty = false): array
237+
{
215238
$regions = [];
216239
if ($allow_empty) {
217240
$regions[''] = 'None';
@@ -223,7 +246,8 @@ public function getRegionList($allow_empty = false): array {
223246
return $regions;
224247
}
225248

226-
public function getUpstreamList($allow_empty = false): array {
249+
public function getUpstreamList($allow_empty = false): array
250+
{
227251
$upstreams = [];
228252
if ($allow_empty) {
229253
$upstreams[''] = 'None';
@@ -239,5 +263,4 @@ public function getUpstreamList($allow_empty = false): array {
239263
}
240264
return $upstreams;
241265
}
242-
243266
}

tests/Functional/InteracterHookTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
use Symfony\Component\Console\Input\ArgvInput;
77
use Pantheon\Terminus\Config\TerminusConfig;
88

9-
109
/**
1110
* Class InteracterHookTest
1211
*
1312
* @package Pantheon\Terminus\Tests\Functional
1413
*/
1514
class InteracterHookTest extends TerminusTestBase
1615
{
17-
1816
/**
1917
* @var Pantheon\Terminus\Hooks\Interacter
2018
*/

0 commit comments

Comments
 (0)