Skip to content

Commit 5d1c642

Browse files
committed
use array_intersect
1 parent 8e9a871 commit 5d1c642

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

api.include.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ public function withBody(StreamInterface $body): self
16851685
return $new;
16861686
}
16871687

1688-
private function setHeaders(array $headers): void
1688+
private function setHeaders(array $headers) /*:void*/
16891689
{
16901690
foreach ($headers as $header => $value) {
16911691
$value = $this->validateAndTrimHeader($header, $value);
@@ -1885,7 +1885,7 @@ public function withUri(UriInterface $uri, $preserveHost = false): self
18851885
return $new;
18861886
}
18871887

1888-
private function updateHostFromUri(): void
1888+
private function updateHostFromUri() /*:void*/
18891889
{
18901890
if ('' === $host = $this->uri->getHost()) {
18911891
return;
@@ -1923,7 +1923,7 @@ final class Response implements ResponseInterface
19231923
use MessageTrait;
19241924

19251925
/** @var array Map of standard HTTP status code/reason phrases */
1926-
private const PHRASES = [
1926+
/*private*/ const PHRASES = [
19271927
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
19281928
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
19291929
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
@@ -2187,7 +2187,7 @@ final class Stream implements StreamInterface
21872187
private $size;
21882188

21892189
/** @var array Hash of readable and writable stream types */
2190-
private const READ_WRITE_HASH = [
2190+
/*private*/ const READ_WRITE_HASH = [
21912191
'read' => [
21922192
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
21932193
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
@@ -2263,7 +2263,7 @@ public function __toString(): string
22632263
}
22642264
}
22652265

2266-
public function close(): void
2266+
public function close() /*:void*/
22672267
{
22682268
if (isset($this->stream)) {
22692269
if (\is_resource($this->stream)) {
@@ -2287,7 +2287,7 @@ public function detach()
22872287
return $result;
22882288
}
22892289

2290-
public function getSize(): ?int
2290+
public function getSize() /*:?int*/
22912291
{
22922292
if (null !== $this->size) {
22932293
return $this->size;
@@ -2331,7 +2331,7 @@ public function isSeekable(): bool
23312331
return $this->seekable;
23322332
}
23332333

2334-
public function seek($offset, $whence = \SEEK_SET): void
2334+
public function seek($offset, $whence = \SEEK_SET) /*:void*/
23352335
{
23362336
if (!$this->seekable) {
23372337
throw new \RuntimeException('Stream is not seekable');
@@ -2342,7 +2342,7 @@ public function seek($offset, $whence = \SEEK_SET): void
23422342
}
23432343
}
23442344

2345-
public function rewind(): void
2345+
public function rewind() /*:void*/
23462346
{
23472347
$this->seek(0);
23482348
}
@@ -2425,7 +2425,7 @@ public function getMetadata($key = null)
24252425
final class UploadedFile implements UploadedFileInterface
24262426
{
24272427
/** @var array */
2428-
private const ERRORS = [
2428+
/*private*/ const ERRORS = [
24292429
\UPLOAD_ERR_OK => 1,
24302430
\UPLOAD_ERR_INI_SIZE => 1,
24312431
\UPLOAD_ERR_FORM_SIZE => 1,
@@ -2504,7 +2504,7 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename
25042504
/**
25052505
* @throws \RuntimeException if is moved or not ok
25062506
*/
2507-
private function validateActive(): void
2507+
private function validateActive() /*:void*/
25082508
{
25092509
if (\UPLOAD_ERR_OK !== $this->error) {
25102510
throw new \RuntimeException('Cannot retrieve stream due to upload error');
@@ -2528,7 +2528,7 @@ public function getStream(): StreamInterface
25282528
return Stream::create($resource);
25292529
}
25302530

2531-
public function moveTo($targetPath): void
2531+
public function moveTo($targetPath) /*:void*/
25322532
{
25332533
$this->validateActive();
25342534

@@ -2570,12 +2570,12 @@ public function getError(): int
25702570
return $this->error;
25712571
}
25722572

2573-
public function getClientFilename(): ?string
2573+
public function getClientFilename() /*:?string*/
25742574
{
25752575
return $this->clientFilename;
25762576
}
25772577

2578-
public function getClientMediaType(): ?string
2578+
public function getClientMediaType() /*:?string*/
25792579
{
25802580
return $this->clientMediaType;
25812581
}
@@ -2598,11 +2598,11 @@ public function getClientMediaType(): ?string
25982598
*/
25992599
final class Uri implements UriInterface
26002600
{
2601-
private const SCHEMES = ['http' => 80, 'https' => 443];
2601+
/*private*/ const SCHEMES = ['http' => 80, 'https' => 443];
26022602

2603-
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
2603+
/*private*/ const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
26042604

2605-
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
2605+
/*private*/ const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
26062606

26072607
/** @var string Uri scheme. */
26082608
private $scheme = '';
@@ -2684,7 +2684,7 @@ public function getHost(): string
26842684
return $this->host;
26852685
}
26862686

2687-
public function getPort(): ?int
2687+
public function getPort() /*:?int*/
26882688
{
26892689
return $this->port;
26902690
}
@@ -2852,7 +2852,7 @@ private static function isNonStandardPort(string $scheme, int $port): bool
28522852
return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
28532853
}
28542854

2855-
private function filterPort($port): ?int
2855+
private function filterPort($port) /*:?int*/
28562856
{
28572857
if (null === $port) {
28582858
return null;

api.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ public function withBody(StreamInterface $body): self
16851685
return $new;
16861686
}
16871687

1688-
private function setHeaders(array $headers): void
1688+
private function setHeaders(array $headers) /*:void*/
16891689
{
16901690
foreach ($headers as $header => $value) {
16911691
$value = $this->validateAndTrimHeader($header, $value);
@@ -1885,7 +1885,7 @@ public function withUri(UriInterface $uri, $preserveHost = false): self
18851885
return $new;
18861886
}
18871887

1888-
private function updateHostFromUri(): void
1888+
private function updateHostFromUri() /*:void*/
18891889
{
18901890
if ('' === $host = $this->uri->getHost()) {
18911891
return;
@@ -1923,7 +1923,7 @@ final class Response implements ResponseInterface
19231923
use MessageTrait;
19241924

19251925
/** @var array Map of standard HTTP status code/reason phrases */
1926-
private const PHRASES = [
1926+
/*private*/ const PHRASES = [
19271927
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
19281928
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
19291929
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
@@ -2187,7 +2187,7 @@ final class Stream implements StreamInterface
21872187
private $size;
21882188

21892189
/** @var array Hash of readable and writable stream types */
2190-
private const READ_WRITE_HASH = [
2190+
/*private*/ const READ_WRITE_HASH = [
21912191
'read' => [
21922192
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
21932193
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
@@ -2263,7 +2263,7 @@ public function __toString(): string
22632263
}
22642264
}
22652265

2266-
public function close(): void
2266+
public function close() /*:void*/
22672267
{
22682268
if (isset($this->stream)) {
22692269
if (\is_resource($this->stream)) {
@@ -2287,7 +2287,7 @@ public function detach()
22872287
return $result;
22882288
}
22892289

2290-
public function getSize(): ?int
2290+
public function getSize() /*:?int*/
22912291
{
22922292
if (null !== $this->size) {
22932293
return $this->size;
@@ -2331,7 +2331,7 @@ public function isSeekable(): bool
23312331
return $this->seekable;
23322332
}
23332333

2334-
public function seek($offset, $whence = \SEEK_SET): void
2334+
public function seek($offset, $whence = \SEEK_SET) /*:void*/
23352335
{
23362336
if (!$this->seekable) {
23372337
throw new \RuntimeException('Stream is not seekable');
@@ -2342,7 +2342,7 @@ public function seek($offset, $whence = \SEEK_SET): void
23422342
}
23432343
}
23442344

2345-
public function rewind(): void
2345+
public function rewind() /*:void*/
23462346
{
23472347
$this->seek(0);
23482348
}
@@ -2425,7 +2425,7 @@ public function getMetadata($key = null)
24252425
final class UploadedFile implements UploadedFileInterface
24262426
{
24272427
/** @var array */
2428-
private const ERRORS = [
2428+
/*private*/ const ERRORS = [
24292429
\UPLOAD_ERR_OK => 1,
24302430
\UPLOAD_ERR_INI_SIZE => 1,
24312431
\UPLOAD_ERR_FORM_SIZE => 1,
@@ -2504,7 +2504,7 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename
25042504
/**
25052505
* @throws \RuntimeException if is moved or not ok
25062506
*/
2507-
private function validateActive(): void
2507+
private function validateActive() /*:void*/
25082508
{
25092509
if (\UPLOAD_ERR_OK !== $this->error) {
25102510
throw new \RuntimeException('Cannot retrieve stream due to upload error');
@@ -2528,7 +2528,7 @@ public function getStream(): StreamInterface
25282528
return Stream::create($resource);
25292529
}
25302530

2531-
public function moveTo($targetPath): void
2531+
public function moveTo($targetPath) /*:void*/
25322532
{
25332533
$this->validateActive();
25342534

@@ -2570,12 +2570,12 @@ public function getError(): int
25702570
return $this->error;
25712571
}
25722572

2573-
public function getClientFilename(): ?string
2573+
public function getClientFilename() /*:?string*/
25742574
{
25752575
return $this->clientFilename;
25762576
}
25772577

2578-
public function getClientMediaType(): ?string
2578+
public function getClientMediaType() /*:?string*/
25792579
{
25802580
return $this->clientMediaType;
25812581
}
@@ -2598,11 +2598,11 @@ public function getClientMediaType(): ?string
25982598
*/
25992599
final class Uri implements UriInterface
26002600
{
2601-
private const SCHEMES = ['http' => 80, 'https' => 443];
2601+
/*private*/ const SCHEMES = ['http' => 80, 'https' => 443];
26022602

2603-
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
2603+
/*private*/ const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
26042604

2605-
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
2605+
/*private*/ const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
26062606

26072607
/** @var string Uri scheme. */
26082608
private $scheme = '';
@@ -2684,7 +2684,7 @@ public function getHost(): string
26842684
return $this->host;
26852685
}
26862686

2687-
public function getPort(): ?int
2687+
public function getPort() /*:?int*/
26882688
{
26892689
return $this->port;
26902690
}
@@ -2852,7 +2852,7 @@ private static function isNonStandardPort(string $scheme, int $port): bool
28522852
return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
28532853
}
28542854

2855-
private function filterPort($port): ?int
2855+
private function filterPort($port) /*:?int*/
28562856
{
28572857
if (null === $port) {
28582858
return null;

0 commit comments

Comments
 (0)