updated-packages
This commit is contained in:
@@ -36,32 +36,29 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $methods = array();
|
||||
private $methods = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $ips = array();
|
||||
private $ips = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $attributes = array();
|
||||
private $attributes = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $schemes = array();
|
||||
private $schemes = [];
|
||||
|
||||
/**
|
||||
* @param string|null $path
|
||||
* @param string|null $host
|
||||
* @param string|string[]|null $methods
|
||||
* @param string|string[]|null $ips
|
||||
* @param array $attributes
|
||||
* @param string|string[]|null $schemes
|
||||
*/
|
||||
public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, int $port = null)
|
||||
public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, int $port = null)
|
||||
{
|
||||
$this->matchPath($path);
|
||||
$this->matchHost($host);
|
||||
@@ -82,7 +79,7 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
*/
|
||||
public function matchScheme($scheme)
|
||||
{
|
||||
$this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array();
|
||||
$this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +97,7 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
*
|
||||
* @param int|null $port The port number to connect to
|
||||
*/
|
||||
public function matchPort(int $port = null)
|
||||
public function matchPort(?int $port)
|
||||
{
|
||||
$this->port = $port;
|
||||
}
|
||||
@@ -132,7 +129,7 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
*/
|
||||
public function matchIps($ips)
|
||||
{
|
||||
$this->ips = null !== $ips ? (array) $ips : array();
|
||||
$this->ips = null !== $ips ? (array) $ips : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +139,7 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
*/
|
||||
public function matchMethod($method)
|
||||
{
|
||||
$this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array();
|
||||
$this->methods = null !== $method ? array_map('strtoupper', (array) $method) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +167,11 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
}
|
||||
|
||||
foreach ($this->attributes as $key => $pattern) {
|
||||
if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) {
|
||||
$requestAttribute = $request->attributes->get($key);
|
||||
if (!\is_string($requestAttribute)) {
|
||||
return false;
|
||||
}
|
||||
if (!preg_match('{'.$pattern.'}', $requestAttribute)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user