Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Codeception/Lib/DbPopulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(array $config)
* @param string|null $dumpFile The dump file to build the command with.
* @return string The resulting command string after evaluating any configuration's key
*/
protected function buildCommand(string $command, string $dumpFile = null): string
protected function buildCommand(string $command, ?string $dumpFile = null): string
{
$dsn = $this->config['dsn'] ?? '';
$dsnVars = [];
Expand Down
6 changes: 3 additions & 3 deletions src/Codeception/Lib/Driver/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Db
*/
protected array $primaryKeys = [];

public static function connect(string $dsn, string $user = null, string $password = null, array $options = null): PDO
public static function connect(string $dsn, ?string $user = null, ?string $password = null, ?array $options = null): PDO
{
$dbh = new PDO($dsn, $user, $password, $options);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Expand All @@ -47,7 +47,7 @@ public static function connect(string $dsn, string $user = null, string $passwor
*
* @return Db|SqlSrv|MySql|Oci|PostgreSql|Sqlite
*/
public static function create(string $dsn, string $user = null, string $password = null, array $options = null): Db
public static function create(string $dsn, ?string $user = null, ?string $password = null, ?array $options = null): Db
{
$provider = self::getProvider($dsn);

Expand Down Expand Up @@ -78,7 +78,7 @@ public static function getProvider($dsn): string
* @see https://www.php.net/manual/en/pdo.construct.php
* @see https://www.php.net/manual/de/ref.pdo-mysql.php#pdo-mysql.constants
*/
public function __construct(string $dsn, string $user = null, string $password = null, array $options = null)
public function __construct(string $dsn, ?string $user = null, ?string $password = null, ?array $options = null)
{
$this->dbh = new PDO($dsn, $user, $password, $options);
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Expand Down
2 changes: 1 addition & 1 deletion src/Codeception/Lib/Driver/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Sqlite extends Db

protected string $filename = '';

public function __construct(string $dsn, string $user = null, string $password = null, array $options = null)
public function __construct(string $dsn, ?string $user = null, ?string $password = null, ?array $options = null)
{
$filename = substr($dsn, 7);
if ($filename === ':memory:') {
Expand Down
4 changes: 2 additions & 2 deletions src/Codeception/Module/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ protected function removeInserted($databaseKey = null): void
$this->insertedRows[$databaseKey] = [];
}

public function _cleanup(string $databaseKey = null, array $databaseConfig = null): void
public function _cleanup(?string $databaseKey = null, ?array $databaseConfig = null): void
{
$databaseKey = empty($databaseKey) ? self::DEFAULT_DATABASE : $databaseKey;
$databaseConfig = empty($databaseConfig) ? $this->config : $databaseConfig;
Expand Down Expand Up @@ -737,7 +737,7 @@ public function _isPopulated()
return $this->databasesPopulated[$this->currentDatabase];
}

public function _loadDump(string $databaseKey = null, array $databaseConfig = null): void
public function _loadDump(?string $databaseKey = null, ?array $databaseConfig = null): void
{
$databaseKey = empty($databaseKey) ? self::DEFAULT_DATABASE : $databaseKey;
$databaseConfig = empty($databaseConfig) ? $this->config : $databaseConfig;
Expand Down