mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
fix(test): fix redundant terminal output during phpunit (#1194)
This commit is contained in:
@@ -54,6 +54,10 @@ abstract class BaseCommand extends Command
|
||||
}
|
||||
|
||||
set_error_handler(static function ($error_no, $error_msg, $error_file, $error_line) {
|
||||
// Respect the @ suppression operator (error_reporting() returns 0 when @ is used)
|
||||
if (error_reporting() === 0) {
|
||||
return true;
|
||||
}
|
||||
$tips = [
|
||||
E_WARNING => ['PHP Warning: ', 'warning'],
|
||||
E_NOTICE => ['PHP Notice: ', 'notice'],
|
||||
|
||||
@@ -38,7 +38,7 @@ class ArtifactConfig
|
||||
*/
|
||||
public static function loadFromFile(string $file, string $registry_name): string
|
||||
{
|
||||
$content = file_get_contents($file);
|
||||
$content = @file_get_contents($file);
|
||||
if ($content === false) {
|
||||
throw new WrongUsageException("Failed to read artifact config file: {$file}");
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class PackageConfig
|
||||
*/
|
||||
public static function loadFromFile(string $file, string $registry_name): string
|
||||
{
|
||||
$content = file_get_contents($file);
|
||||
$content = @file_get_contents($file);
|
||||
if ($content === false) {
|
||||
throw new WrongUsageException("Failed to read package config file: {$file}");
|
||||
}
|
||||
|
||||
@@ -370,7 +370,10 @@ class PackageLoader
|
||||
// match condition
|
||||
$installer = ApplicationContext::get(PackageInstaller::class);
|
||||
$stages = self::$before_stages[$package_name][$stage] ?? [];
|
||||
foreach ($stages as [$callback, $only_when_package_resolved, $conditionals]) {
|
||||
foreach ($stages as $entry) {
|
||||
$callback = $entry[0];
|
||||
$only_when_package_resolved = $entry[1] ?? null;
|
||||
$conditionals = $entry[2] ?? [];
|
||||
if ($only_when_package_resolved !== null && !$installer->isPackageResolved($only_when_package_resolved)) {
|
||||
continue;
|
||||
}
|
||||
@@ -389,7 +392,10 @@ class PackageLoader
|
||||
$installer = ApplicationContext::get(PackageInstaller::class);
|
||||
$stages = self::$after_stages[$package_name][$stage] ?? [];
|
||||
$result = [];
|
||||
foreach ($stages as [$callback, $only_when_package_resolved, $conditionals]) {
|
||||
foreach ($stages as $entry) {
|
||||
$callback = $entry[0];
|
||||
$only_when_package_resolved = $entry[1] ?? null;
|
||||
$conditionals = $entry[2] ?? [];
|
||||
if ($only_when_package_resolved !== null && !$installer->isPackageResolved($only_when_package_resolved)) {
|
||||
continue;
|
||||
}
|
||||
@@ -433,7 +439,9 @@ class PackageLoader
|
||||
}
|
||||
$pkg = self::getPackage($package_name);
|
||||
foreach ($stages as $stage_name => $before_events) {
|
||||
foreach ($before_events as [$event_callable, $only_when_package_resolved, $conditionals]) {
|
||||
foreach ($before_events as $entry) {
|
||||
$event_callable = $entry[0];
|
||||
$only_when_package_resolved = $entry[1] ?? null;
|
||||
// check only_when_package_resolved package exists
|
||||
if ($only_when_package_resolved !== null && !self::hasPackage($only_when_package_resolved)) {
|
||||
throw new RegistryException("{$event_name} event in package [{$package_name}] for stage [{$stage_name}] has unknown only_when_package_resolved package [{$only_when_package_resolved}].");
|
||||
|
||||
Reference in New Issue
Block a user