Skip to content

Commit e923f80

Browse files
committed
typehint the port
1 parent 899547b commit e923f80

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ private function createExpression($container, $expression)
669669
return $this->expressions[$id] = new Reference($id);
670670
}
671671

672-
private function createRequestMatcher($container, $path = null, $host = null, $port = null, $methods = array(), $ip = null, array $attributes = array())
672+
private function createRequestMatcher($container, $path = null, $host = null, int $port = null, $methods = array(), $ip = null, array $attributes = array())
673673
{
674674
if ($methods) {
675675
$methods = array_map('strtoupper', (array) $methods);

src/Symfony/Component/HttpFoundation/RequestMatcher.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\HttpFoundation;
1313

14-
use function is_numeric;
15-
1614
/**
1715
* RequestMatcher compares a pre-defined set of checks against a Request instance.
1816
*
@@ -64,7 +62,7 @@ class RequestMatcher implements RequestMatcherInterface
6462
* @param array $attributes
6563
* @param string|string[]|null $schemes
6664
*/
67-
public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, $port = null)
65+
public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, int $port = null)
6866
{
6967
$this->matchPath($path);
7068
$this->matchHost($host);
@@ -103,11 +101,9 @@ public function matchHost($regexp)
103101
*
104102
* @param int|null $port The port number to connect to
105103
*/
106-
public function matchPort($port)
104+
public function matchPort(int $port): void
107105
{
108-
$portInt = (int) $port;
109-
110-
$this->port = is_numeric($port) || $port == $portInt ? $portInt : null;
106+
$this->port = $port;
111107
}
112108

113109
/**

0 commit comments

Comments
 (0)