Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3085,18 +3085,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Database/OCI8/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:\\$resetStmtId has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/OCI8/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:\\$validDSNs has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/OCI8/Connection.php',
];
$ignoreErrors[] = [
// identifier: method.childReturnType
'message' => '#^Return type \\(array\\{code\\: int\\|string\\|null, message\\: string\\|null\\}\\) of method CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:error\\(\\) should be covariant with return type \\(array\\<string, int\\|string\\>\\) of method CodeIgniter\\\\Database\\\\ConnectionInterface\\<resource,resource\\>\\:\\:error\\(\\)$#',
Expand Down Expand Up @@ -3325,30 +3313,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Database/Postgre/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$connect_timeout has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/Postgre/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$options has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/Postgre/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$service has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/Postgre/Connection.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$sslmode has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Database/Postgre/Connection.php',
];
$ignoreErrors[] = [
// identifier: method.childReturnType
'message' => '#^Return type \\(array\\<string, int\\|string\\>\\) of method CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:error\\(\\) should be covariant with return type \\(array\\{code\\: int\\|string\\|null, message\\: string\\|null\\}\\) of method CodeIgniter\\\\Database\\\\BaseConnection\\<PgSql\\\\Connection,PgSql\\\\Result\\>\\:\\:error\\(\\)$#',
Expand Down Expand Up @@ -9463,12 +9427,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockBuilder.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCLIConfig\\:\\:\\$CSRFExcludeURIs has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCLIConfig.php',
];
$ignoreErrors[] = [
// identifier: missingType.return
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:getBaseURI\\(\\) has no return type specified\\.$#',
Expand All @@ -9493,24 +9451,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
];
$ignoreErrors[] = [
// identifier: missingType.parameter
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:setOutput\\(\\) has parameter \\$output with no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:\\$curl_options has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:\\$output has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
];
$ignoreErrors[] = [
// identifier: missingType.iterableValue
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:getMetaData\\(\\) return type has no value type specified in iterable type array\\.$#',
Expand Down
9 changes: 7 additions & 2 deletions system/Database/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ class Connection extends BaseConnection
'rownum',
];

protected $validDSNs = [
/**
* Array of valid DSN patterns for different Oracle connections.
*
* @var array{tns: string,ec: string,in: string}
*/
protected array $validDSNs = [
// TNS
'tns' => '/^\(DESCRIPTION=(\(.+\)){2,}\)$/',
// Easy Connect string (Oracle 10g+).
Expand All @@ -79,7 +84,7 @@ class Connection extends BaseConnection
* Used by storedProcedure() to prevent execute() from
* re-setting the statement ID.
*/
protected $resetStmtId = true;
protected bool $resetStmtId = true;

/**
* Statement ID
Expand Down
26 changes: 21 additions & 5 deletions system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,22 @@ class Connection extends BaseConnection
*/
public $escapeChar = '"';

protected $connect_timeout;
protected $options;
protected $sslmode;
protected $service;
/**
* @var int Connection timeout in seconds
*/
protected int $connect_timeout;

/**
* @var string Connection options
*/
protected string $options;

/**
* @var string Possible values are: disable, allow, prefer, require, verify-ca, verify-full
*/
protected string $sslmode;

protected string $service;

/**
* Connect to the database.
Expand Down Expand Up @@ -546,7 +558,11 @@ protected function buildDSN()
// provided via string> Example:
//
// Postgre://username:password@localhost:5432/database?connect_timeout=5&sslmode=1
foreach (['connect_timeout', 'options', 'sslmode', 'service'] as $key) {
if (isset($this->connect_timeout)) {
$this->DSN .= "connect_timeout={$this->connect_timeout} ";
}

foreach (['options', 'sslmode', 'service'] as $key) {
if (isset($this->{$key}) && is_string($this->{$key}) && $this->{$key} !== '') {
$this->DSN .= "{$key}='{$this->{$key}}' ";
}
Expand Down
2 changes: 1 addition & 1 deletion system/Session/Handlers/ArrayHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in system/Session/Handlers/ArrayHandler.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Ignored error pattern #^Property CodeIgniter\\Session\\Handlers\\ArrayHandler\:\:\$cache has no type specified\.$# in path /home/runner/work/CodeIgniter4/CodeIgniter4/system/Session/Handlers/ArrayHandler.php was not matched in reported errors.

declare(strict_types=1);

Expand All @@ -21,7 +21,7 @@
*/
class ArrayHandler extends BaseHandler
{
protected static $cache = [];
protected static array $cache = [];

Check failure on line 24 in system/Session/Handlers/ArrayHandler.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Property CodeIgniter\Session\Handlers\ArrayHandler::$cache type has no value type specified in iterable type array.

/**
* Re-initialize existing session, or creates a new one.
Expand Down
21 changes: 13 additions & 8 deletions system/Test/Mock/MockCLIConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@

class MockCLIConfig extends App
{
public string $baseURL = 'http://example.com/';
public string $uriProtocol = 'REQUEST_URI';
public array $proxyIPs = [];
public string $CSRFTokenName = 'csrf_test_name';
public string $CSRFCookieName = 'csrf_cookie_name';
public int $CSRFExpire = 7200;
public bool $CSRFRegenerate = true;
public $CSRFExcludeURIs = ['http://example.com'];
public string $baseURL = 'http://example.com/';
public string $uriProtocol = 'REQUEST_URI';
public array $proxyIPs = [];
public string $CSRFTokenName = 'csrf_test_name';
public string $CSRFCookieName = 'csrf_cookie_name';
public int $CSRFExpire = 7200;
public bool $CSRFRegenerate = true;

/**
* @var list<string>
*/
public array $CSRFExcludeURIs = ['http://example.com'];

public string $CSRFSameSite = 'Lax';
public bool $CSPEnabled = false;
public string $defaultLocale = 'en';
Expand Down
6 changes: 3 additions & 3 deletions system/Test/Mock/MockCURLRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in system/Test/Mock/MockCURLRequest.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Ignored error pattern #^Method CodeIgniter\\Test\\Mock\\MockCURLRequest\:\:setOutput\(\) has no return type specified\.$# in path /home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Mock/MockCURLRequest.php was not matched in reported errors.

declare(strict_types=1);

Expand All @@ -24,10 +24,10 @@
*/
class MockCURLRequest extends CURLRequest
{
public $curl_options;
protected $output = '';
public array $curl_options;

Check failure on line 27 in system/Test/Mock/MockCURLRequest.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Property CodeIgniter\Test\Mock\MockCURLRequest::$curl_options type has no value type specified in iterable type array.
protected string $output = '';

public function setOutput($output)
public function setOutput(string $output): static
{
$this->output = $output;

Expand Down
Loading