Skip to content

Commit 36b5dc5

Browse files
committed
removed PHP 5 code
1 parent cff320a commit 36b5dc5

15 files changed

Lines changed: 16 additions & 397 deletions

src/Tracy/Dumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private static function dumpDouble(&$var): string
175175
{
176176
$var = is_finite($var)
177177
? ($tmp = json_encode($var)) . (strpos($tmp, '.') === false ? '.0' : '')
178-
: str_replace('.0', '', var_export($var, true)); // workaround for PHP 7.0.2
178+
: var_export($var, true);
179179
return "<span class=\"tracy-dump-number\">$var</span>\n";
180180
}
181181

src/Tracy/assets/Bar/info.panel.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ if (class_exists('Composer\Autoload\ClassLoader', false)) {
5252
$lockFile = dirname((new \ReflectionClass('Composer\Autoload\ClassLoader'))->getFileName()) . '/../../composer.lock';
5353
$composer = @json_decode((string) file_get_contents($lockFile)); // @ may not exist or be valid
5454
list($packages, $devPackages) = [(array) @$composer->packages, (array) @$composer->{'packages-dev'}]; // @ keys may not exist
55-
$tmp = [&$packages, &$devPackages];
56-
foreach ($tmp as &$items) {
55+
foreach ([&$packages, &$devPackages] as &$items) {
5756
array_walk($items, function($package) {
5857
$package->hash = $package->source->reference ?? $package->dist->reference ?? null;
5958
}, $items);

tests/Tracy/Debugger.E_ERROR.console.phpt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,15 @@ $onFatalErrorCalled = false;
2626

2727
register_shutdown_function(function () use (&$onFatalErrorCalled) {
2828
Assert::true($onFatalErrorCalled);
29-
Assert::match(PHP_MAJOR_VERSION > 5 ?
29+
Assert::match(
3030
"Error: Call to undefined function missing_function() in %a%
3131
Stack trace:
3232
#0 %a%: third(Array)
3333
#1 %a%: second(true, false)
3434
#2 %a%: first(10, 'any string')
3535
#3 {main}
3636
Unable to log error: Logging directory is not specified.
37-
" : (extension_loaded('xdebug') ? '
38-
Fatal error: Call to undefined function missing_function() in %a%
39-
ErrorException: Call to undefined function missing_function() in %a%
40-
Stack trace:
41-
#0 %a%: third()
42-
#1 %a%: second()
43-
#2 %a%: first()
44-
#3 {main}
45-
Unable to log error: Logging directory is not specified.
46-
' : '
47-
Fatal error: Call to undefined function missing_function() in %a%
48-
ErrorException: Call to undefined function missing_function() in %a%
49-
Stack trace:
50-
#0 [internal function]: Tracy\\Debugger::shutdownHandler()
51-
#1 {main}
52-
Unable to log error: Logging directory is not specified.
53-
'), ob_get_clean());
37+
", ob_get_clean());
5438
echo 'OK!'; // prevents PHP bug #62725
5539
});
5640

tests/Tracy/Debugger.E_ERROR.html.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ register_shutdown_function(function () use (&$onFatalErrorCalled) {
3333
Assert::true($onFatalErrorCalled);
3434
$output = ob_get_clean();
3535
Assert::same(1, substr_count($output, '<!-- Tracy Debug Bar'));
36-
Assert::matchFile(__DIR__ . '/expected/Debugger.E_ERROR.html' . (PHP_MAJOR_VERSION > 5 ? '' : (extension_loaded('xdebug') ? '.xdebug' : '.php5')) . '.expect', $output);
36+
Assert::matchFile(__DIR__ . '/expected/Debugger.E_ERROR.html.expect', $output);
3737
echo 'OK!'; // prevents PHP bug #62725
3838
});
3939

tests/Tracy/Debugger.E_RECOVERABLE_ERROR.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ $obj = new TestClass;
4242
Assert::exception(function () use ($obj) {
4343
// Invalid argument #1
4444
$obj->test1('hello');
45-
}, PHP_MAJOR_VERSION < 7 ? 'ErrorException' : 'TypeError', 'Argument 1 passed to TestClass::test1() must be %a% array, string given, called in %a%');
45+
}, TypeError::class, 'Argument 1 passed to TestClass::test1() must be %a% array, string given, called in %a%');
4646

4747
Assert::exception(function () use ($obj) {
4848
// Invalid argument #2
4949
$obj->test2('hello');
50-
}, PHP_MAJOR_VERSION < 7 ? 'ErrorException' : 'TypeError', 'Argument 1 passed to TestClass::test2() must be an instance of TestClass, string given, called in %a%');
50+
}, TypeError::class, 'Argument 1 passed to TestClass::test2() must be an instance of TestClass, string given, called in %a%');
5151

5252
Assert::exception(function () use ($obj) {
5353
// Invalid toString
5454
echo $obj;
55-
}, 'ErrorException', 'Method TestClass::__toString() must return a string value');
55+
}, ErrorException::class, 'Method TestClass::__toString() must return a string value');

tests/Tracy/Debugger.scream.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ header('Content-Type: text/plain; charset=utf-8');
1919

2020
Debugger::enable();
2121

22-
@mktime(); // E_STRICT in PHP 5, E_DEPRECATED in PHP 7
23-
PHP_MAJOR_VERSION < 7 ? @mktime(0, 0, 0, 1, 23, 1978, 1) : @mktime(); // E_DEPRECATED
22+
@mktime(); // E_DEPRECATED
2423
@$x++; // E_NOTICE
2524
@min(1); // E_WARNING
2625
@require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING (not working)

tests/Tracy/Debugger.shut-up.warnings.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ header('Content-Type: text/plain; charset=utf-8');
1818

1919
Debugger::enable();
2020

21-
@mktime(); // E_STRICT in PHP 5, E_DEPRECATED in PHP 7
22-
PHP_MAJOR_VERSION < 7 ? @mktime(0, 0, 0, 1, 23, 1978, 1) : @mktime(); // E_DEPRECATED
21+
@mktime(); // E_DEPRECATED
2322
@$x++; // E_NOTICE
2423
@min(1); // E_WARNING
2524
@require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING

tests/Tracy/Debugger.warnings.console.phpt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ function second($arg1, $arg2)
3434

3535
function third($arg1)
3636
{
37-
mktime(); // E_STRICT in PHP 5, E_DEPRECATED in PHP 7
38-
PHP_MAJOR_VERSION < 7 ? mktime(0, 0, 0, 1, 23, 1978, 1) : mktime(); // E_DEPRECATED
37+
mktime(); // E_DEPRECATED
3938
$x++; // E_NOTICE
4039
min(1); // E_WARNING
4140
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING
@@ -44,9 +43,7 @@ function third($arg1)
4443

4544
first(10, 'any string');
4645
Assert::match("
47-
%a%: mktime(): You should be using the time() function instead in %a% on line %d%
48-
49-
Deprecated: mktime(): %a%
46+
Deprecated: mktime(): You should be using the time() function instead in %a% on line %d%
5047
5148
Notice: Undefined variable: x in %a% on line %d%
5249

tests/Tracy/Debugger.warnings.html.phpt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ Warning: Unsupported declare \'foo\' in %a% on line %d%%A%', $output);
3636
Assert::match('%A%<table>
3737
<tr>
3838
<td class="tracy-right">1%a%</td>
39-
<td><pre>PHP %a%: mktime(): You should be using the time() function instead in %a%:%d%</a></pre></td>
40-
</tr>
41-
<tr>
42-
<td class="tracy-right">1%a%</td>
43-
<td><pre>PHP Deprecated: mktime(): %a%</a></pre></td>
39+
<td><pre>PHP Deprecated: mktime(): You should be using the time() function instead in %a%:%d%</a></pre></td>
4440
</tr>
4541
<tr>
4642
<td class="tracy-right">1%a%</td>
@@ -70,8 +66,7 @@ function second($arg1, $arg2)
7066

7167
function third($arg1)
7268
{
73-
mktime(); // E_STRICT in PHP 5, E_DEPRECATED in PHP 7
74-
PHP_MAJOR_VERSION < 7 ? mktime(0, 0, 0, 1, 23, 1978, 1) : mktime(); // E_DEPRECATED
69+
mktime(); // E_DEPRECATED
7570
$x++; // E_NOTICE
7671
min(1); // E_WARNING
7772
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING

tests/Tracy/Debugger.warnings.production.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ Debugger::$productionMode = true;
1717

1818
Debugger::enable();
1919

20-
mktime(); // E_STRICT in PHP 5, E_DEPRECATED in PHP 7
21-
PHP_MAJOR_VERSION < 7 ? @mktime(0, 0, 0, 1, 23, 1978, 1) : @mktime(); // E_DEPRECATED
20+
mktime(); // E_DEPRECATED
2221
$x++; // E_NOTICE
2322
min(1); // E_WARNING
2423
require __DIR__ . '/fixtures/E_COMPILE_WARNING.php'; // E_COMPILE_WARNING

0 commit comments

Comments
 (0)