Skip to content

Commit 47a1689

Browse files
committed
add return statements to functionsList.php
1 parent bd3f11f commit 47a1689

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

generated/functionsList.php

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/src/Commands/GenerateCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9797
$fileCreator->generateVersionSplitters($moduleName, FileCreator::getSafeRootDir() . "/generated/", \array_keys($versions));
9898
$fileCreator->createExceptionFile((string) $moduleName);
9999
}
100-
$fileCreator->generateVersionSplitters("functionsList", FileCreator::getSafeRootDir() . "/generated/", \array_keys($versions));
100+
$fileCreator->generateVersionSplitters("functionsList", FileCreator::getSafeRootDir() . "/generated/", \array_keys($versions), true);
101101

102102
$this->runCsFix($output);
103103

generator/src/Generator/FileCreator.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,19 @@ public function generatePhpFile(array $functions, array $missingFunctions, strin
6868
/**
6969
* @param string[] $versions
7070
*/
71-
public function generateVersionSplitters(string $module, string $path, array $versions): void
71+
public function generateVersionSplitters(string $module, string $path, array $versions, bool $return = false): void
7272
{
7373
$lcModule = \lcfirst($module);
7474
$stream = \fopen($path.$lcModule.'.php', 'w');
7575
if ($stream === false) {
7676
throw new \RuntimeException('Unable to write to '.$path);
7777
}
78+
$return = $return ? "return " : "";
7879
\fwrite($stream, "<?php\n");
7980
foreach ($versions as $version) {
8081
if (file_exists("$path/$version/$lcModule.php")) {
8182
\fwrite($stream, "\nif (str_starts_with(PHP_VERSION, \"$version.\")) {");
82-
\fwrite($stream, "\n require_once __DIR__ . '/$version/$lcModule.php';");
83+
\fwrite($stream, "\n {$return}require_once __DIR__ . '/$version/$lcModule.php';");
8384
\fwrite($stream, "\n}");
8485
}
8586
}

0 commit comments

Comments
 (0)