Skip to content

Commit 0bcb907

Browse files
committed
Fix for #822
1 parent 7b7e76d commit 0bcb907

File tree

4 files changed

+66
-64
lines changed

4 files changed

+66
-64
lines changed

api.include.php

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ public function withBody(StreamInterface $body): self
16871687
return $new;
16881688
}
16891689

1690-
private function setHeaders(array $headers) /*:void*/
1690+
private function setHeaders(array $headers): void
16911691
{
16921692
foreach ($headers as $header => $value) {
16931693
if (\is_int($header)) {
@@ -1894,7 +1894,7 @@ public function withUri(UriInterface $uri, $preserveHost = false): self
18941894
return $new;
18951895
}
18961896

1897-
private function updateHostFromUri() /*:void*/
1897+
private function updateHostFromUri(): void
18981898
{
18991899
if ('' === $host = $this->uri->getHost()) {
19001900
return;
@@ -1934,7 +1934,7 @@ class Response implements ResponseInterface
19341934
use MessageTrait;
19351935

19361936
/** @var array Map of standard HTTP status code/reason phrases */
1937-
/*private*/ const PHRASES = [
1937+
private const PHRASES = [
19381938
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
19391939
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',
19401940
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
@@ -2204,7 +2204,7 @@ class Stream implements StreamInterface
22042204
private $size;
22052205

22062206
/** @var array Hash of readable and writable stream types */
2207-
/*private*/ const READ_WRITE_HASH = [
2207+
private const READ_WRITE_HASH = [
22082208
'read' => [
22092209
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
22102210
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
@@ -2293,7 +2293,7 @@ public function __toString()
22932293
}
22942294
}
22952295

2296-
public function close() /*:void*/
2296+
public function close(): void
22972297
{
22982298
if (isset($this->stream)) {
22992299
if (\is_resource($this->stream)) {
@@ -2326,7 +2326,7 @@ private function getUri()
23262326
return $this->uri;
23272327
}
23282328

2329-
public function getSize() /*:?int*/
2329+
public function getSize(): ?int
23302330
{
23312331
if (null !== $this->size) {
23322332
return $this->size;
@@ -2370,7 +2370,7 @@ public function isSeekable(): bool
23702370
return $this->seekable;
23712371
}
23722372

2373-
public function seek($offset, $whence = \SEEK_SET) /*:void*/
2373+
public function seek($offset, $whence = \SEEK_SET): void
23742374
{
23752375
if (!$this->seekable) {
23762376
throw new \RuntimeException('Stream is not seekable');
@@ -2381,7 +2381,7 @@ public function seek($offset, $whence = \SEEK_SET) /*:void*/
23812381
}
23822382
}
23832383

2384-
public function rewind() /*:void*/
2384+
public function rewind(): void
23852385
{
23862386
$this->seek(0);
23872387
}
@@ -2470,7 +2470,7 @@ public function getMetadata($key = null)
24702470
class UploadedFile implements UploadedFileInterface
24712471
{
24722472
/** @var array */
2473-
/*private*/ const ERRORS = [
2473+
private const ERRORS = [
24742474
\UPLOAD_ERR_OK => 1,
24752475
\UPLOAD_ERR_INI_SIZE => 1,
24762476
\UPLOAD_ERR_FORM_SIZE => 1,
@@ -2549,7 +2549,7 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename
25492549
/**
25502550
* @throws \RuntimeException if is moved or not ok
25512551
*/
2552-
private function validateActive() /*:void*/
2552+
private function validateActive(): void
25532553
{
25542554
if (\UPLOAD_ERR_OK !== $this->error) {
25552555
throw new \RuntimeException('Cannot retrieve stream due to upload error');
@@ -2573,7 +2573,7 @@ public function getStream(): StreamInterface
25732573
return Stream::create($resource);
25742574
}
25752575

2576-
public function moveTo($targetPath) /*:void*/
2576+
public function moveTo($targetPath): void
25772577
{
25782578
$this->validateActive();
25792579

@@ -2615,12 +2615,12 @@ public function getError(): int
26152615
return $this->error;
26162616
}
26172617

2618-
public function getClientFilename() /*:?string*/
2618+
public function getClientFilename(): ?string
26192619
{
26202620
return $this->clientFilename;
26212621
}
26222622

2623-
public function getClientMediaType() /*:?string*/
2623+
public function getClientMediaType(): ?string
26242624
{
26252625
return $this->clientMediaType;
26262626
}
@@ -2645,11 +2645,11 @@ public function getClientMediaType() /*:?string*/
26452645
*/
26462646
class Uri implements UriInterface
26472647
{
2648-
/*private*/ const SCHEMES = ['http' => 80, 'https' => 443];
2648+
private const SCHEMES = ['http' => 80, 'https' => 443];
26492649

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

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

26542654
/** @var string Uri scheme. */
26552655
private $scheme = '';
@@ -2731,7 +2731,7 @@ public function getHost(): string
27312731
return $this->host;
27322732
}
27332733

2734-
public function getPort() /*:?int*/
2734+
public function getPort(): ?int
27352735
{
27362736
return $this->port;
27372737
}
@@ -2899,7 +2899,7 @@ private static function isNonStandardPort(string $scheme, int $port): bool
28992899
return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
29002900
}
29012901

2902-
private function filterPort($port) /*:?int*/
2902+
private function filterPort($port): ?int
29032903
{
29042904
if (null === $port) {
29052905
return null;
@@ -3011,7 +3011,7 @@ public function fromGlobals(): ServerRequestInterface
30113011
/**
30123012
* {@inheritdoc}
30133013
*/
3014-
public function fromArrays(array $server, array $headers = [], array $cookie = [], array $get = [], /*?array*/ $post = null, array $files = [], $body = null): ServerRequestInterface
3014+
public function fromArrays(array $server, array $headers = [], array $cookie = [], array $get = [], ?array $post = null, array $files = [], $body = null): ServerRequestInterface
30153015
{
30163016
$method = $this->getMethodFromEnv($server);
30173017
$uri = $this->getUriFromEnvWithHTTP($server);
@@ -3280,7 +3280,8 @@ public function fromArrays(
32803280
array $server,
32813281
array $headers = [],
32823282
array $cookie = [],
3283-
array $get = [], /*?array*/ $post = null,
3283+
array $get = [],
3284+
?array $post = null,
32843285
array $files = [],
32853286
$body = null
32863287
): ServerRequestInterface;
@@ -6326,7 +6327,7 @@ private function getTablesSQL(): string
63266327
case 'sqlsrv':
63276328
return 'SELECT o.name as "TABLE_NAME", o.xtype as "TABLE_TYPE" FROM sysobjects o WHERE o.xtype IN (\'U\', \'V\') ORDER BY "TABLE_NAME"';
63286329
case 'sqlite':
6329-
return 'SELECT t.name as "TABLE_NAME", t.type as "TABLE_TYPE" FROM sqlite_master t WHERE t.type IN (\'table\', \'view\') AND \'\' <> ? ORDER BY "TABLE_NAME"';
6330+
return 'SELECT t.name as "TABLE_NAME", t.type as "TABLE_TYPE" FROM sqlite_master t WHERE t.type IN (\'table\', \'view\') AND \'\' IN (\'\', ?) ORDER BY "TABLE_NAME"';
63306331
}
63316332
}
63326333

@@ -6340,7 +6341,7 @@ private function getTableColumnsSQL(): string
63406341
case 'sqlsrv':
63416342
return 'SELECT c.name AS "COLUMN_NAME", c.is_nullable AS "IS_NULLABLE", t.Name AS "DATA_TYPE", (c.max_length/2) AS "CHARACTER_MAXIMUM_LENGTH", c.precision AS "NUMERIC_PRECISION", c.scale AS "NUMERIC_SCALE", \'\' AS "COLUMN_TYPE" FROM sys.columns c INNER JOIN sys.types t ON c.user_type_id = t.user_type_id WHERE c.object_id = OBJECT_ID(?) AND \'\' <> ? ORDER BY c.column_id';
63426343
case 'sqlite':
6343-
return 'SELECT "name" AS "COLUMN_NAME", case when "notnull"==1 then \'no\' else \'yes\' end as "IS_NULLABLE", lower("type") AS "DATA_TYPE", 2147483647 AS "CHARACTER_MAXIMUM_LENGTH", 0 AS "NUMERIC_PRECISION", 0 AS "NUMERIC_SCALE", \'\' AS "COLUMN_TYPE" FROM pragma_table_info(?) WHERE \'\' <> ? ORDER BY "cid"';
6344+
return 'SELECT "name" AS "COLUMN_NAME", case when "notnull"==1 then \'no\' else \'yes\' end as "IS_NULLABLE", lower("type") AS "DATA_TYPE", 2147483647 AS "CHARACTER_MAXIMUM_LENGTH", 0 AS "NUMERIC_PRECISION", 0 AS "NUMERIC_SCALE", \'\' AS "COLUMN_TYPE" FROM pragma_table_info(?) WHERE \'\' IN (\'\', ?) ORDER BY "cid"';
63446345
}
63456346
}
63466347

@@ -6354,7 +6355,7 @@ private function getTablePrimaryKeysSQL(): string
63546355
case 'sqlsrv':
63556356
return 'SELECT c.NAME as "COLUMN_NAME" FROM sys.key_constraints kc inner join sys.objects t on t.object_id = kc.parent_object_id INNER JOIN sys.index_columns ic ON kc.parent_object_id = ic.object_id and kc.unique_index_id = ic.index_id INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id WHERE kc.type = \'PK\' and t.object_id = OBJECT_ID(?) and \'\' <> ?';
63566357
case 'sqlite':
6357-
return 'SELECT "name" as "COLUMN_NAME" FROM pragma_table_info(?) WHERE "pk"=1 AND \'\' <> ?';
6358+
return 'SELECT "name" as "COLUMN_NAME" FROM pragma_table_info(?) WHERE "pk"=1 AND \'\' IN (\'\', ?)';
63586359
}
63596360
}
63606361

@@ -6368,7 +6369,7 @@ private function getTableForeignKeysSQL(): string
63686369
case 'sqlsrv':
63696370
return 'SELECT COL_NAME(fc.parent_object_id, fc.parent_column_id) AS "COLUMN_NAME", OBJECT_NAME (f.referenced_object_id) AS "REFERENCED_TABLE_NAME" FROM sys.foreign_keys AS f INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id WHERE f.parent_object_id = OBJECT_ID(?) and \'\' <> ?';
63706371
case 'sqlite':
6371-
return 'SELECT "from" AS "COLUMN_NAME", "table" AS "REFERENCED_TABLE_NAME" FROM pragma_foreign_key_list(?) WHERE \'\' <> ?';
6372+
return 'SELECT "from" AS "COLUMN_NAME", "table" AS "REFERENCED_TABLE_NAME" FROM pragma_foreign_key_list(?) WHERE \'\' IN (\'\', ?)';
63726373
}
63736374
}
63746375

@@ -11510,11 +11511,11 @@ class Config
1151011511
{
1151111512
private $values = [
1151211513
'driver' => null,
11513-
'address' => 'localhost',
11514+
'address' => null,
1151411515
'port' => null,
11515-
'username' => null,
11516-
'password' => null,
11517-
'database' => null,
11516+
'username' => '',
11517+
'password' => '',
11518+
'database' => '',
1151811519
'tables' => '',
1151911520
'middlewares' => 'cors,errors',
1152011521
'controllers' => 'records,geojson,openapi,status',

0 commit comments

Comments
 (0)