Skip to content

Commit 1dbdb51

Browse files
committed
AC-9619::SVC false-positive: materializing a virtual type
1 parent 3d2e6e5 commit 1dbdb51

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Console/Command/CompareSourceCommand.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ protected function execute(InputInterface $input, OutputInterface $cliOutput)
151151
$versionReport = $semanticVersionChecker->loadVersionReport();
152152
$changedFiles = $semanticVersionChecker->loadChangedFiles();
153153

154+
if ($this->areFilesPresentLocally($changedFiles, $sourceAfterDir)) {
155+
$versionIncrease =Level::PATCH; // Set to "Patch"
156+
$versionIncWord = strtoupper($this->changeLevels[$versionIncrease]);
157+
}
154158
foreach ($changedFiles as &$file) {
155159
if (substr($file, 0, strlen($sourceBeforeDir)) == $sourceBeforeDir) {
156160
$file = substr($file, strlen($sourceBeforeDir));
@@ -237,6 +241,24 @@ protected function execute(InputInterface $input, OutputInterface $cliOutput)
237241
return self::SUCCESS_EXIT_CODE;
238242
}
239243

244+
/**
245+
* Method to check if file exist.
246+
*
247+
* @param array $changedFiles
248+
* @param string $sourceAfterDir
249+
* @return bool
250+
*/
251+
private function areFilesPresentLocally(array $changedFiles, string $sourceAfterDir): bool
252+
{
253+
foreach ($changedFiles as $file) {
254+
$localFilePath = $sourceAfterDir;
255+
if (file_exists($localFilePath)) {
256+
return true;
257+
}
258+
}
259+
return false;
260+
}
261+
240262
/**
241263
* Method to validate allowed level.
242264
*

0 commit comments

Comments
 (0)