Skip to content

Commit 3fd1e57

Browse files
Remove unused code in run-tests.php (php#12553)
* chore: remove unused code in run-tests.php * chore: remove unused code in run-tests.php --------- Co-authored-by: Marcos Marcolin <[email protected]>
1 parent 3481f5d commit 3fd1e57

File tree

1 file changed

+5
-39
lines changed

1 file changed

+5
-39
lines changed

Diff for: run-tests.php

+5-39
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ function main(): void
471471
$cfg['keep'][$file] = true;
472472
}
473473
break;
474-
//case 'l'
475474
case 'm':
476475
$valgrind = new RuntestsValgrind($environment);
477476
break;
@@ -520,7 +519,6 @@ function main(): void
520519
putenv('NO_INTERACTION=1');
521520
$environment['NO_INTERACTION'] = 1;
522521
break;
523-
//case 'r'
524522
case 's':
525523
$output_file = $argv[++$i];
526524
$just_save_results = true;
@@ -594,7 +592,6 @@ function main(): void
594592
case '--bless':
595593
$bless = true;
596594
break;
597-
//case 'w'
598595
case '-':
599596
// repeat check with full switch
600597
$switch = $argv[$i];
@@ -1813,7 +1810,8 @@ function show_file_block(string $file, string $block, ?string $section = null):
18131810
}
18141811
}
18151812

1816-
function skip_test(string $tested, string $tested_file, string $shortname, string $reason) {
1813+
function skip_test(string $tested, string $tested_file, string $shortname, string $reason): string
1814+
{
18171815
global $junit;
18181816

18191817
show_result('SKIP', $tested, $tested_file, "reason: $reason");
@@ -2204,7 +2202,6 @@ function run_test(string $php, $file, array $env): string
22042202
return 'SKIPPED';
22052203
}
22062204

2207-
22082205
if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) {
22092206
$info = " (info: $m[1])";
22102207
} elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s+(.+)/i', $output, $m)) {
@@ -2935,8 +2932,7 @@ function generate_diff(string $wanted, ?string $wanted_re, string $output): stri
29352932
$regex = '/^' . expectf_to_regex($expected). '$/s';
29362933
return preg_match($regex, $new);
29372934
});
2938-
$result = $differ->diff($w, $o);
2939-
return $result;
2935+
return $differ->diff($w, $o);
29402936
}
29412937

29422938
function error(string $message): void
@@ -3358,7 +3354,7 @@ public function saveXML(): void
33583354
fwrite($this->fp, $xml);
33593355
}
33603356

3361-
private function getSuitesXML(string $suite_name = '')
3357+
private function getSuitesXML(string $suite_name = ''): string
33623358
{
33633359
// FIXME: $suite_name gets overwritten
33643360
$result = '';
@@ -3649,17 +3645,6 @@ public function getExtensions(string $php): array
36493645

36503646
return $result;
36513647
}
3652-
3653-
// public function __destruct()
3654-
// {
3655-
// echo "Skips: {$this->hits} hits, {$this->misses} misses.\n";
3656-
// echo "Extensions: {$this->extHits} hits, {$this->extMisses} misses.\n";
3657-
// echo "Cache distribution:\n";
3658-
//
3659-
// foreach ($this->skips as $php => $cache) {
3660-
// echo "$php: " . count($cache) . "\n";
3661-
// }
3662-
// }
36633648
}
36643649

36653650
class RuntestsValgrind
@@ -3669,11 +3654,6 @@ class RuntestsValgrind
36693654
protected $version_3_8_0 = false;
36703655
protected $tool = null;
36713656

3672-
public function getVersion(): string
3673-
{
3674-
return $this->version;
3675-
}
3676-
36773657
public function getHeader(): string
36783658
{
36793659
return $this->header;
@@ -3746,17 +3726,6 @@ public function hasSection(string $name): bool
37463726
return isset($this->sections[$name]);
37473727
}
37483728

3749-
public function hasAllSections(string ...$names): bool
3750-
{
3751-
foreach ($names as $section) {
3752-
if (!isset($this->sections[$section])) {
3753-
return false;
3754-
}
3755-
}
3756-
3757-
return true;
3758-
}
3759-
37603729
public function hasAnySections(string ...$names): bool
37613730
{
37623731
foreach ($names as $section) {
@@ -3981,7 +3950,7 @@ final class Differ
39813950
public const OLD = 0;
39823951
public const ADDED = 1;
39833952
public const REMOVED = 2;
3984-
private $outputBuilder;
3953+
private DiffOutputBuilder $outputBuilder;
39853954
private $isEqual;
39863955

39873956
public function __construct(callable $isEqual)
@@ -4043,8 +4012,6 @@ public function diffToArray(array $from, array $to): array
40434012

40444013
foreach ($end as $token) {
40454014
$diff[] = [$token, self::OLD];
4046-
$fromLine++;
4047-
$toLine++;
40484015
}
40494016

40504017
return $diff;
@@ -4163,7 +4130,6 @@ public function getDiff(array $diffs): string
41634130
{
41644131
global $context_line_count;
41654132
$i = 0;
4166-
$string = '';
41674133
$number_len = max(3, strlen((string)count($diffs)));
41684134
$line_number_spec = '%0' . $number_len . 'd';
41694135
$buffer = fopen('php://memory', 'r+b');

0 commit comments

Comments
 (0)