updated-packages
This commit is contained in:
@@ -18,6 +18,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
* MemoryDataCollector.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
*/
|
||||
class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface
|
||||
{
|
||||
@@ -28,8 +30,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
{
|
||||
$this->updateMemoryUsage();
|
||||
}
|
||||
@@ -39,10 +43,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->data = array(
|
||||
$this->data = [
|
||||
'memory' => 0,
|
||||
'memory_limit' => $this->convertToBytes(ini_get('memory_limit')),
|
||||
);
|
||||
'memory_limit' => $this->convertToBytes(\ini_get('memory_limit')),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +93,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
return 'memory';
|
||||
}
|
||||
|
||||
private function convertToBytes($memoryLimit)
|
||||
/**
|
||||
* @return int|float
|
||||
*/
|
||||
private function convertToBytes(string $memoryLimit)
|
||||
{
|
||||
if ('-1' === $memoryLimit) {
|
||||
return -1;
|
||||
@@ -97,9 +104,9 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
$memoryLimit = strtolower($memoryLimit);
|
||||
$max = strtolower(ltrim($memoryLimit, '+'));
|
||||
if (0 === strpos($max, '0x')) {
|
||||
if (str_starts_with($max, '0x')) {
|
||||
$max = \intval($max, 16);
|
||||
} elseif (0 === strpos($max, '0')) {
|
||||
} elseif (str_starts_with($max, '0')) {
|
||||
$max = \intval($max, 8);
|
||||
} else {
|
||||
$max = (int) $max;
|
||||
|
Reference in New Issue
Block a user