Skip to content

Commit 3c3aead

Browse files
CS Fixer
1 parent 31a06c0 commit 3c3aead

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

src/Maker/MakeWebhook.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
*/
5555
final class MakeWebhook extends AbstractMaker implements InputAwareMakerInterface
5656
{
57-
5857
private const WEBHOOK_CONFIG_PATH = 'config/packages/webhook.yaml';
5958
private YamlSourceManipulator $ysm;
6059

@@ -77,14 +76,14 @@ public static function getCommandDescription(): string
7776
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
7877
{
7978
$command
80-
->addArgument('name', InputArgument::OPTIONAL, sprintf('Name of the webhook to create (e.g. <fg=yellow>github, stripe, ...</>)'))
81-
->setHelp(file_get_contents(__DIR__ . '/../Resources/help/MakeWebhook.txt'))
79+
->addArgument('name', InputArgument::OPTIONAL, 'Name of the webhook to create (e.g. <fg=yellow>github, stripe, ...</>)')
80+
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeWebhook.txt'))
8281
;
8382

8483
$inputConfig->setArgumentAsNonInteractive('name');
8584
}
8685

87-
public function configureDependencies(DependencyBuilder $dependencies, ?InputInterface $input = null)
86+
public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null)
8887
{
8988
$dependencies->addClassDependency(
9089
AbstractRequestParser::class,
@@ -132,11 +131,11 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
132131
{
133132
$webhookName = $input->getArgument('name');
134133
$requestParserDetails = $this->generator->createClassNameDetails(
135-
Str::asClassName($webhookName . 'RequestParser'),
134+
Str::asClassName($webhookName.'RequestParser'),
136135
'Webhook\\'
137136
);
138137
$remoteEventHandlerDetails = $this->generator->createClassNameDetails(
139-
Str::asClassName($webhookName . 'WebhookHandler'),
138+
Str::asClassName($webhookName.'WebhookHandler'),
140139
'RemoteEvent\\'
141140
);
142141

@@ -165,7 +164,7 @@ private function addToYamlConfig(string $webhookName, ClassNameDetails $requestP
165164
}
166165
$this->ysm = new YamlSourceManipulator($yamlConfig);
167166
$arrayConfig = $this->ysm->getData();
168-
if (key_exists($webhookName, $arrayConfig['framework']['webhook']['routing'] ?? [])) {
167+
if (\array_key_exists($webhookName, $arrayConfig['framework']['webhook']['routing'] ?? [])) {
169168
throw new \InvalidArgumentException('A webhook with this name already exists');
170169
}
171170

@@ -179,9 +178,6 @@ private function addToYamlConfig(string $webhookName, ClassNameDetails $requestP
179178
}
180179

181180
/**
182-
* @param ConsoleStyle $io
183-
* @param ClassNameDetails $requestParserDetails
184-
* @return void
185181
* @throws \Exception
186182
*/
187183
public function generateRequestParser(ConsoleStyle $io, ClassNameDetails $requestParserDetails): void
@@ -253,6 +249,7 @@ private function askForNextRequestMatcher(ConsoleStyle $io, array $addedMatchers
253249
return null;
254250
}
255251
}
252+
256253
return $matcherName;
257254
}
258255

tests/Maker/MakeWebhookTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function getTestDetails(): \Generator
143143
);
144144
$this->assertStringContainsString(
145145
<<<EOF
146-
return new ChainRequestMatcher([
147-
new IsJsonRequestMatcher(),
148-
new PortRequestMatcher(443),
149-
]);
150-
EOF,
146+
return new ChainRequestMatcher([
147+
new IsJsonRequestMatcher(),
148+
new PortRequestMatcher(443),
149+
]);
150+
EOF,
151151
$requestParserSource
152152
);
153153
}),
@@ -156,7 +156,6 @@ public function getTestDetails(): \Generator
156156
yield 'it_makes_webhook_with_expression_language_injection' => [$this->createMakerTest()
157157
->addExtraDependencies('symfony/expression-language')
158158
->run(function (MakerTestRunner $runner) {
159-
160159
$output = $runner->runMaker([
161160
// webhook name
162161
'remote_service',
@@ -190,11 +189,11 @@ public function getTestDetails(): \Generator
190189
);
191190
$this->assertStringContainsString(
192191
<<<EOF
193-
return new ChainRequestMatcher([
194-
new IsJsonRequestMatcher(),
195-
new ExpressionRequestMatcher(new ExpressionLanguage(), new Expression('expression')),
196-
]);
197-
EOF,
192+
return new ChainRequestMatcher([
193+
new IsJsonRequestMatcher(),
194+
new ExpressionRequestMatcher(new ExpressionLanguage(), new Expression('expression')),
195+
]);
196+
EOF,
198197
$requestParserSource
199198
);
200199
}),

0 commit comments

Comments
 (0)