Laravel 5.6 updates

Travis config update

Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
Manish Verma
2018-08-06 20:08:55 +05:30
parent 126fbb0255
commit 1ac0f42a58
2464 changed files with 65239 additions and 46734 deletions

View File

@@ -0,0 +1,15 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-timer.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\Timer;
interface Exception
{
}

View File

@@ -0,0 +1,15 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-timer.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\Timer;
final class RuntimeException extends \RuntimeException implements Exception
{
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHP_Timer package.
* This file is part of phpunit/php-timer.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,61 +8,41 @@
* file that was distributed with this source code.
*/
/**
* Utility class for timing.
*/
class PHP_Timer
namespace SebastianBergmann\Timer;
final class Timer
{
/**
* @var array
*/
private static $times = array(
'hour' => 3600000,
'minute' => 60000,
'second' => 1000
);
private static $times = [
'hour' => 3600000,
'minute' => 60000,
'second' => 1000
];
/**
* @var array
*/
private static $startTimes = array();
private static $startTimes = [];
/**
* @var float
*/
public static $requestTime;
/**
* Starts the timer.
*/
public static function start()
public static function start(): void
{
array_push(self::$startTimes, microtime(true));
self::$startTimes[] = \microtime(true);
}
/**
* Stops the timer and returns the elapsed time.
*
* @return float
*/
public static function stop()
public static function stop(): float
{
return microtime(true) - array_pop(self::$startTimes);
return \microtime(true) - \array_pop(self::$startTimes);
}
/**
* Formats the elapsed time as a string.
*
* @param float $time
* @return string
*/
public static function secondsToTimeString($time)
public static function secondsToTimeString(float $time): string
{
$ms = round($time * 1000);
$ms = \round($time * 1000);
foreach (self::$times as $unit => $value) {
if ($ms >= $value) {
$time = floor($ms / $value * 100.0) / 100.0;
$time = \floor($ms / $value * 100.0) / 100.0;
return $time . ' ' . ($time == 1 ? $unit : $unit . 's');
}
@@ -72,34 +52,30 @@ class PHP_Timer
}
/**
* Formats the elapsed time since the start of the request as a string.
*
* @return string
* @throws RuntimeException
*/
public static function timeSinceStartOfRequest()
public static function timeSinceStartOfRequest(): string
{
return self::secondsToTimeString(microtime(true) - self::$requestTime);
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
$startOfRequest = $_SERVER['REQUEST_TIME_FLOAT'];
} elseif (isset($_SERVER['REQUEST_TIME'])) {
$startOfRequest = $_SERVER['REQUEST_TIME'];
} else {
throw new RuntimeException('Cannot determine time at which the request started');
}
return self::secondsToTimeString(\microtime(true) - $startOfRequest);
}
/**
* Returns the resources (time, memory) of the request as a string.
*
* @return string
* @throws RuntimeException
*/
public static function resourceUsage()
public static function resourceUsage(): string
{
return sprintf(
return \sprintf(
'Time: %s, Memory: %4.2fMB',
self::timeSinceStartOfRequest(),
memory_get_peak_usage(true) / 1048576
\memory_get_peak_usage(true) / 1048576
);
}
}
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
} elseif (isset($_SERVER['REQUEST_TIME'])) {
PHP_Timer::$requestTime = $_SERVER['REQUEST_TIME'];
} else {
PHP_Timer::$requestTime = microtime(true);
}