Skip to content

Commit 2d8a584

Browse files
authored
Merge pull request #39 from szepeviktor/pls-run-phpstan
Fix major errors found by PHPStan
2 parents 288d4b0 + b907844 commit 2d8a584

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Commands/Deploy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
100100
$region = $this->selectAwsRegion();
101101
IO::spin('deploying');
102102
$config['region'] = $region;
103-
$deployment = $brefCloud->createDeployment($environment, $config, $gitRef, $gitMessage, $awsAccountName, $region);
103+
$deployment = $brefCloud->createDeployment($environment, $config, $gitRef, $gitMessage, $awsAccountName);
104104
} else {
105105
IO::spinError();
106106
throw $e;
@@ -253,7 +253,7 @@ private function getGitDetails(): array
253253
$gitMessage = explode("\n", $gitMessage)[0];
254254

255255
IO::verbose('Git ref: ' . $gitRef);
256-
$gitMessageLog = explode("\n", $gitMessage)[0] ?? '';
256+
$gitMessageLog = explode("\n", $gitMessage)[0];
257257
IO::verbose(sprintf(
258258
'Git commit message: "%s%s"',
259259
substr($gitMessageLog, 0, 80),

src/Components/ServerlessFramework.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,23 +185,26 @@ private function retrieveOutputs(string $environment, array $awsCredentials, ?st
185185
// If plugins add extra output afterward, it should be ignored.
186186
$outputsResults = preg_match('/Stack Outputs:\n(( {2}[ \S]+\n)+)/', $infoOutput, $matches);
187187
// Also try to extract the stack name and region
188-
$stackResults = preg_match('/stack: (.*)\n/', $infoOutput, $matches);
189-
$regionResults = preg_match('/region: (.*)\n/', $infoOutput, $matches);
188+
$stackResults = preg_match('/stack: (.*)\n/', $infoOutput, $stackMatches);
189+
$regionResults = preg_match('/region: (.*)\n/', $infoOutput, $regionMatches);
190190
if ($outputsResults && $stackResults && $regionResults) {
191191
try {
192192
$stackOutputs = Yaml::parse($matches[1]);
193193
if (! is_array($stackOutputs)) {
194194
throw new Exception('Invalid stack outputs in the "serverless info" output');
195195
}
196196
$stackOutputs = $this->cleanupCfOutputs($stackOutputs);
197-
$stackName = $matches[2];
197+
198+
$stackName = $stackMatches[1];
198199
if (! is_string($stackName)) {
199200
throw new Exception('Invalid stack name in the "serverless info" output');
200201
}
201-
$region = $matches[3];
202+
203+
$region = $regionMatches[1];
202204
if (! is_string($region)) {
203205
throw new Exception('Invalid region in the "serverless info" output');
204206
}
207+
205208
return array_merge([
206209
'stack' => $stackName,
207210
'region' => $region,

0 commit comments

Comments
 (0)