Skip to content

Commit 229a94f

Browse files
committed
3666: Ensure symfony data cleanup if result change
1 parent 76c42ae commit 229a94f

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

src/Handler/SymfonyHandler.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,19 @@ public function handleResult(DetectionResult $detectionResult): void
3838
$installation = $this->installationFactory->getInstallation($detectionResult);
3939
$installation->setType(FrameworkTypes::SYMFONY);
4040

41-
if (isset($data->composerVersion)) {
42-
$installation->setComposerVersion($data->composerVersion);
43-
}
44-
if (isset($data->symfony->version)) {
45-
$installation->setFrameworkVersion($data->symfony->version);
46-
}
47-
if (isset($data->symfony->eof)) {
48-
$installation->setEol($data->symfony->eof);
49-
}
41+
$installation->setComposerVersion($data->composerVersion ?? null);
42+
$installation->setFrameworkVersion($data->symfony->version ?? null);
43+
$installation->setEol($data->symfony->eof ?? '');
5044
if (isset($data->symfony->lts)) {
5145
$lts = 'Yes' === $data->symfony->lts;
5246
$installation->setLts($lts);
5347
}
54-
if (isset($data->symfony->phpVersion)) {
55-
$installation->setPhpVersion($data->symfony->phpVersion);
56-
}
48+
$installation->setPhpVersion($data->symfony->phpVersion ?? null);
5749

5850
if (isset($data->packages->installed)) {
5951
$this->packageVersionFactory->setPackageVersions($installation, $data->packages->installed);
52+
} else {
53+
$this->packageVersionFactory->setPackageVersions($installation, []);
6054
}
6155
} catch (\JsonException) {
6256
// @TODO log exceptions

0 commit comments

Comments
 (0)