Skip to content

Declare missing types and other minor improvements in run-tests.php #12573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

/* Temporary variables while this file is being refactored. */
/** @var ?JUnit */
/** @var ?JUnit $junit */
$junit = null;

/* End temporary variables. */
Expand Down Expand Up @@ -166,7 +166,7 @@ function main(): void
global $context_line_count;

// Temporary for the duration of refactoring
/** @var JUnit */
/** @var JUnit $junit */
global $junit;

define('IS_WINDOWS', substr(PHP_OS, 0, 3) == "WIN");
Expand Down Expand Up @@ -465,7 +465,6 @@ function main(): void
case 'g':
$SHOW_ONLY_GROUPS = explode(",", $argv[++$i]);
break;
//case 'h'
case '--keep-all':
foreach ($cfgfiles as $file) {
$cfg['keep'][$file] = true;
Expand Down Expand Up @@ -1842,7 +1841,7 @@ function run_test(string $php, $file, array $env): string
global $show_progress;

// Temporary
/** @var JUnit */
/** @var JUnit $junit */
global $junit;

static $skipCache;
Expand Down Expand Up @@ -3354,9 +3353,8 @@ public function saveXML(): void
fwrite($this->fp, $xml);
}

private function getSuitesXML(string $suite_name = ''): string
private function getSuitesXML(): string
{
// FIXME: $suite_name gets overwritten
$result = '';

foreach ($this->suites as $suite_name => $suite) {
Expand Down Expand Up @@ -3650,9 +3648,9 @@ public function getExtensions(string $php): array
class RuntestsValgrind
{
protected $version = '';
protected $header = '';
protected string $header = '';
protected $version_3_8_0 = false;
protected $tool = null;
protected string $tool = '';

public function getHeader(): string
{
Expand All @@ -3665,7 +3663,7 @@ public function __construct(array $environment, string $tool = 'memcheck')
$header = system_with_timeout("valgrind --tool={$this->tool} --version", $environment);
if (!$header) {
error("Valgrind returned no version info for {$this->tool}, cannot proceed.\n".
"Please check if Valgrind is installed and the tool is named correctly.");
"Please check if Valgrind is installed and the tool is named correctly.");
}
$count = 0;
$version = preg_replace("/valgrind-(\d+)\.(\d+)\.(\d+)([.\w_-]+)?(\s+)/", '$1.$2.$3', $header, 1, $count);
Expand Down