upgraded dependencies
This commit is contained in:
@@ -47,7 +47,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null): array
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, string $statusCode = null): array
|
||||
{
|
||||
$file = $this->getIndexFilename();
|
||||
|
||||
@@ -113,7 +113,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($token): ?Profile
|
||||
public function read(string $token): ?Profile
|
||||
{
|
||||
return $this->doRead($token);
|
||||
}
|
||||
@@ -191,11 +191,9 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* Gets filename to store data, associated to the token.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return string The profile filename
|
||||
* @return string
|
||||
*/
|
||||
protected function getFilename($token)
|
||||
protected function getFilename(string $token)
|
||||
{
|
||||
// Uses 4 last characters, because first are mostly the same.
|
||||
$folderA = substr($token, -2, 2);
|
||||
@@ -207,7 +205,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* Gets the index filename.
|
||||
*
|
||||
* @return string The index filename
|
||||
* @return string
|
||||
*/
|
||||
protected function getIndexFilename()
|
||||
{
|
||||
@@ -221,7 +219,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
*
|
||||
* @param resource $file The file resource, with the pointer placed at the end of the line to read
|
||||
*
|
||||
* @return mixed A string representing the line or null if beginning of file is reached
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readLineFromFile($file)
|
||||
{
|
||||
@@ -261,7 +259,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
return '' === $line ? null : $line;
|
||||
}
|
||||
|
||||
protected function createProfileFromData($token, $data, $parent = null)
|
||||
protected function createProfileFromData(string $token, array $data, Profile $parent = null)
|
||||
{
|
||||
$profile = new Profile($token);
|
||||
$profile->setIp($data['ip']);
|
||||
|
59
vendor/symfony/http-kernel/Profiler/Profile.php
vendored
59
vendor/symfony/http-kernel/Profiler/Profile.php
vendored
@@ -48,12 +48,7 @@ class Profile
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token.
|
||||
*
|
||||
* @param string $token The token
|
||||
*/
|
||||
public function setToken($token)
|
||||
public function setToken(string $token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
@@ -61,7 +56,7 @@ class Profile
|
||||
/**
|
||||
* Gets the token.
|
||||
*
|
||||
* @return string The token
|
||||
* @return string
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
@@ -79,7 +74,7 @@ class Profile
|
||||
/**
|
||||
* Returns the parent profile.
|
||||
*
|
||||
* @return self
|
||||
* @return self|null
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
@@ -89,7 +84,7 @@ class Profile
|
||||
/**
|
||||
* Returns the parent token.
|
||||
*
|
||||
* @return string|null The parent token
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParentToken()
|
||||
{
|
||||
@@ -99,19 +94,14 @@ class Profile
|
||||
/**
|
||||
* Returns the IP.
|
||||
*
|
||||
* @return string|null The IP
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIp()
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the IP.
|
||||
*
|
||||
* @param string $ip
|
||||
*/
|
||||
public function setIp($ip)
|
||||
public function setIp(?string $ip)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
}
|
||||
@@ -119,14 +109,14 @@ class Profile
|
||||
/**
|
||||
* Returns the request method.
|
||||
*
|
||||
* @return string|null The request method
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
public function setMethod($method)
|
||||
public function setMethod(string $method)
|
||||
{
|
||||
$this->method = $method;
|
||||
}
|
||||
@@ -134,43 +124,32 @@ class Profile
|
||||
/**
|
||||
* Returns the URL.
|
||||
*
|
||||
* @return string|null The URL
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*/
|
||||
public function setUrl($url)
|
||||
public function setUrl(?string $url)
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time.
|
||||
*
|
||||
* @return int The time
|
||||
* @return int
|
||||
*/
|
||||
public function getTime()
|
||||
{
|
||||
return $this->time ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $time The time
|
||||
*/
|
||||
public function setTime($time)
|
||||
public function setTime(int $time)
|
||||
{
|
||||
$this->time = $time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $statusCode
|
||||
*/
|
||||
public function setStatusCode($statusCode)
|
||||
public function setStatusCode(int $statusCode)
|
||||
{
|
||||
$this->statusCode = $statusCode;
|
||||
}
|
||||
@@ -229,13 +208,11 @@ class Profile
|
||||
/**
|
||||
* Gets a Collector by name.
|
||||
*
|
||||
* @param string $name A collector name
|
||||
*
|
||||
* @return DataCollectorInterface A DataCollectorInterface instance
|
||||
* @return DataCollectorInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException if the collector does not exist
|
||||
*/
|
||||
public function getCollector($name)
|
||||
public function getCollector(string $name)
|
||||
{
|
||||
if (!isset($this->collectors[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
|
||||
@@ -276,13 +253,9 @@ class Profile
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a Collector for the given name exists.
|
||||
*
|
||||
* @param string $name A collector name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCollector($name)
|
||||
public function hasCollector(string $name)
|
||||
{
|
||||
return isset($this->collectors[$name]);
|
||||
}
|
||||
|
46
vendor/symfony/http-kernel/Profiler/Profiler.php
vendored
46
vendor/symfony/http-kernel/Profiler/Profiler.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\HttpKernel\Profiler;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -64,7 +63,7 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Loads the Profile for the given Response.
|
||||
*
|
||||
* @return Profile|null A Profile instance
|
||||
* @return Profile|null
|
||||
*/
|
||||
public function loadProfileFromResponse(Response $response)
|
||||
{
|
||||
@@ -78,11 +77,9 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Loads the Profile for the given token.
|
||||
*
|
||||
* @param string $token A token
|
||||
*
|
||||
* @return Profile|null A Profile instance
|
||||
* @return Profile|null
|
||||
*/
|
||||
public function loadProfile($token)
|
||||
public function loadProfile(string $token)
|
||||
{
|
||||
return $this->storage->read($token);
|
||||
}
|
||||
@@ -119,19 +116,15 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Finds profiler tokens for the given criteria.
|
||||
*
|
||||
* @param string $ip The IP
|
||||
* @param string $url The URL
|
||||
* @param string $limit The maximum number of tokens to return
|
||||
* @param string $method The request method
|
||||
* @param string $start The start date to search from
|
||||
* @param string $end The end date to search to
|
||||
* @param string $statusCode The request status code
|
||||
* @param string|null $limit The maximum number of tokens to return
|
||||
* @param string|null $start The start date to search from
|
||||
* @param string|null $end The end date to search to
|
||||
*
|
||||
* @return array An array of tokens
|
||||
* @return array
|
||||
*
|
||||
* @see https://php.net/datetime.formats for the supported date/time formats
|
||||
*/
|
||||
public function find($ip, $url, $limit, $method, $start, $end, $statusCode = null)
|
||||
public function find(?string $ip, ?string $url, ?string $limit, ?string $method, ?string $start, ?string $end, string $statusCode = null)
|
||||
{
|
||||
return $this->storage->find($ip, $url, $limit, $method, $this->getTimestamp($start), $this->getTimestamp($end), $statusCode);
|
||||
}
|
||||
@@ -139,14 +132,10 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Collects data for the given Response.
|
||||
*
|
||||
* @param \Throwable|null $exception
|
||||
*
|
||||
* @return Profile|null A Profile instance or null if the profiler is disabled
|
||||
* @return Profile|null
|
||||
*/
|
||||
public function collect(Request $request, Response $response/* , \Throwable $exception = null */)
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$exception = 2 < \func_num_args() ? func_get_arg(2) : null;
|
||||
|
||||
if (false === $this->enabled) {
|
||||
return null;
|
||||
}
|
||||
@@ -168,14 +157,9 @@ class Profiler implements ResetInterface
|
||||
|
||||
$response->headers->set('X-Debug-Token', $profile->getToken());
|
||||
|
||||
$wrappedException = null;
|
||||
foreach ($this->collectors as $collector) {
|
||||
if (($e = $exception) instanceof \Error) {
|
||||
$r = new \ReflectionMethod($collector, 'collect');
|
||||
$e = 2 >= $r->getNumberOfParameters() || !($p = $r->getParameters()[2])->hasType() || \Exception::class !== $p->getType()->getName() ? $e : ($wrappedException ?? $wrappedException = new FatalThrowableError($e));
|
||||
}
|
||||
$collector->collect($request, $response, $exception);
|
||||
|
||||
$collector->collect($request, $response, $e);
|
||||
// we need to clone for sub-requests
|
||||
$profile->addCollector(clone $collector);
|
||||
}
|
||||
@@ -194,7 +178,7 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Gets the Collectors associated with this profiler.
|
||||
*
|
||||
* @return array An array of collectors
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
@@ -229,7 +213,7 @@ class Profiler implements ResetInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
public function has(string $name)
|
||||
{
|
||||
return isset($this->collectors[$name]);
|
||||
}
|
||||
@@ -239,11 +223,11 @@ class Profiler implements ResetInterface
|
||||
*
|
||||
* @param string $name A collector name
|
||||
*
|
||||
* @return DataCollectorInterface A DataCollectorInterface instance
|
||||
* @return DataCollectorInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException if the collector does not exist
|
||||
*/
|
||||
public function get($name)
|
||||
public function get(string $name)
|
||||
{
|
||||
if (!isset($this->collectors[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
|
||||
|
@@ -20,7 +20,7 @@ namespace Symfony\Component\HttpKernel\Profiler;
|
||||
* As the profiler must only be used on non-production servers, the file storage
|
||||
* is more than enough and no other implementations will ever be supported.
|
||||
*
|
||||
* @internal since 4.2
|
||||
* @internal
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
@@ -29,32 +29,21 @@ interface ProfilerStorageInterface
|
||||
/**
|
||||
* Finds profiler tokens for the given criteria.
|
||||
*
|
||||
* @param string $ip The IP
|
||||
* @param string $url The URL
|
||||
* @param string $limit The maximum number of tokens to return
|
||||
* @param string $method The request method
|
||||
* @param int|null $start The start date to search from
|
||||
* @param int|null $end The end date to search to
|
||||
*
|
||||
* @return array An array of tokens
|
||||
* @param int|null $limit The maximum number of tokens to return
|
||||
* @param int|null $start The start date to search from
|
||||
* @param int|null $end The end date to search to
|
||||
*/
|
||||
public function find($ip, $url, $limit, $method, $start = null, $end = null): array;
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null): array;
|
||||
|
||||
/**
|
||||
* Reads data associated with the given token.
|
||||
*
|
||||
* The method returns false if the token does not exist in the storage.
|
||||
*
|
||||
* @param string $token A token
|
||||
*
|
||||
* @return Profile|null The profile associated with token
|
||||
*/
|
||||
public function read($token): ?Profile;
|
||||
public function read(string $token): ?Profile;
|
||||
|
||||
/**
|
||||
* Saves a Profile.
|
||||
*
|
||||
* @return bool Write operation successful
|
||||
*/
|
||||
public function write(Profile $profile): bool;
|
||||
|
||||
|
Reference in New Issue
Block a user