migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -19,11 +19,13 @@ use Symfony\Component\Stopwatch\StopwatchEvent;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class TimeDataCollector extends DataCollector implements LateDataCollectorInterface
{
protected $kernel;
protected $stopwatch;
private $kernel;
private $stopwatch;
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
{
@@ -34,7 +36,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
if (null !== $this->kernel) {
$startTime = $this->kernel->getStartTime();
@@ -43,7 +45,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
}
$this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'token' => $request->attributes->get('_stopwatch_token'),
'start_time' => $startTime * 1000,
'events' => [],
'stopwatch_installed' => class_exists(Stopwatch::class, false),
@@ -74,8 +76,6 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
}
/**
* Sets the request events.
*
* @param StopwatchEvent[] $events The request events
*/
public function setEvents(array $events)
@@ -88,21 +88,17 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
}
/**
* Gets the request events.
*
* @return StopwatchEvent[] The request events
* @return StopwatchEvent[]
*/
public function getEvents()
public function getEvents(): array
{
return $this->data['events'];
}
/**
* Gets the request elapsed time.
*
* @return float The elapsed time
*/
public function getDuration()
public function getDuration(): float
{
if (!isset($this->data['events']['__section__'])) {
return 0;
@@ -117,10 +113,8 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
* Gets the initialization time.
*
* This is the time spent until the beginning of the request handling.
*
* @return float The elapsed time
*/
public function getInitTime()
public function getInitTime(): float
{
if (!isset($this->data['events']['__section__'])) {
return 0;
@@ -129,20 +123,12 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
return $this->data['events']['__section__']->getOrigin() - $this->getStartTime();
}
/**
* Gets the request time.
*
* @return float
*/
public function getStartTime()
public function getStartTime(): float
{
return $this->data['start_time'];
}
/**
* @return bool whether or not the stopwatch component is installed
*/
public function isStopwatchInstalled()
public function isStopwatchInstalled(): bool
{
return $this->data['stopwatch_installed'];
}
@@ -150,7 +136,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return 'time';
}