Skip to content

Commit

Permalink
修复拼写错误和 php warning
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Dec 25, 2024
1 parent 3b231d8 commit 9af03c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions sapi/src/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Preprocessor
protected array $endCallbacks = [];
protected array $extCallbacks = [];
protected array $beforeConfigure = [];
protected string $configureVarables;
protected string $configureVariables;
protected string $buildType = 'release';
protected string $swooleBranch = 'master';
protected bool $inVirtualMachine = false;
Expand Down Expand Up @@ -238,12 +238,12 @@ public function setExtraCflags(string $flags)
$this->extraCflags = $flags;
}

public function setConfigureVarables(string $varables)
public function setConfigureVariables(string $variables): void
{
$this->configureVarables = $varables;
$this->configureVariables = $variables;
}

public function setExtraOptions(string $options)
public function setExtraOptions(string $options): void
{
$this->extraOptions = $options;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public function getBuildType(): string
return $this->buildType;
}

public function donotInstallLibrary()
public function doNotInstallLibrary(): void
{
$this->installLibrary = false;
}
Expand Down Expand Up @@ -635,7 +635,7 @@ protected function mkdirIfNotExists(string $dir, int $permissions = 0777, bool $
/**
* Scan and load config files in directory
*/
protected function scanConfigFiles(string $dir, array &$extAvailabled)
protected function scanConfigFiles(string $dir, array &$extAvailable): void
{
$files = scandir($dir);
foreach ($files as $f) {
Expand All @@ -644,14 +644,14 @@ protected function scanConfigFiles(string $dir, array &$extAvailabled)
}
$path = $dir . '/' . $f;
if (is_dir($path)) {
$this->scanConfigFiles($path, $extAvailabled);
$this->scanConfigFiles($path, $extAvailable);
} else {
$extAvailabled[basename($f, '.php')] = require $path;
$extAvailable[basename($f, '.php')] = require $path;
}
}
}

public function loadDependentExtension($extension_name)
public function loadDependentExtension($extension_name): void
{
if (!isset($this->extensionMap[$extension_name])) {
$file = realpath(__DIR__ . '/builder/extension/' . $extension_name . '.php');
Expand Down Expand Up @@ -721,14 +721,15 @@ public function execute(): void
$this->mkdirIfNotExists($this->extensionDir, 0777, true);
include __DIR__ . '/constants.php';

$currentSwooleBranch = trim(`cd {$this->rootDir}/ext/swoole && git branch --show-current`);
$out = `cd {$this->rootDir}/ext/swoole && git branch --show-current`;
$currentSwooleBranch = trim($out ?? $this->swooleBranch);
if ($currentSwooleBranch != $this->swooleBranch) {
`cd {$this->rootDir}/ext/swoole && git checkout {$this->swooleBranch}`;
echo "Switch swoole to {$this->swooleBranch} branch\n";
}

$extAvailabled = [];
$this->scanConfigFiles(__DIR__ . '/builder/extension', $extAvailabled);
$extAvailable = [];
$this->scanConfigFiles(__DIR__ . '/builder/extension', $extAvailable);

$confPath = $this->getInputOption('conf-path');
if ($confPath) {
Expand All @@ -737,17 +738,17 @@ public function execute(): void
if (!is_dir($dir)) {
continue;
}
$this->scanConfigFiles($dir, $extAvailabled);
$this->scanConfigFiles($dir, $extAvailable);
}
}

$this->extEnabled = array_unique($this->extEnabled);
foreach ($this->extEnabled as $ext) {
if (!isset($extAvailabled[$ext])) {
if (!isset($extAvailable[$ext])) {
echo "unsupported extension[$ext]\n";
continue;
}
($extAvailabled[$ext])($this);
($extAvailable[$ext])($this);
if (isset($this->extCallbacks[$ext])) {
($this->extCallbacks[$ext])($this);
}
Expand Down Expand Up @@ -802,7 +803,7 @@ public function execute(): void

if ($this->getInputOption('with-dependency-graph')) {
$this->generateFile(
__DIR__ . '/template/extension_ependency_graph.php',
__DIR__ . '/template/extension_dependency_graph.php',
$this->rootDir . '/bin/ext-dependency-graph.graphviz.dot'
);
}
Expand Down

0 comments on commit 9af03c1

Please sign in to comment.