Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Aug 23, 2024
2 parents 8678949 + 164f206 commit 679bb0c
Show file tree
Hide file tree
Showing 30 changed files with 208 additions and 208 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"require-dev": {
"ext-xdebug": "*",
"aplus/coding-standard": "^2.1",
"aplus/coding-standard": "^2.8",
"ergebnis/composer-normalize": "^2.25",
"jetbrains/phpstorm-attributes": "^1.0",
"phpmd/phpmd": "^2.13",
Expand Down
58 changes: 29 additions & 29 deletions src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public function __construct(
#[SensitiveParameter]
array | string $username,
#[SensitiveParameter]
string $password = null,
string $schema = null,
?string $password = null,
?string $schema = null,
string $host = 'localhost',
int $port = 3306,
Logger $logger = null,
DatabaseCollector $collector = null
?Logger $logger = null,
?DatabaseCollector $collector = null
) {
if ($collector) {
$this->setDebugCollector($collector);
Expand Down Expand Up @@ -187,8 +187,8 @@ protected function connect(
#[SensitiveParameter]
array | string $username,
#[SensitiveParameter]
string $password = null,
string $schema = null,
?string $password = null,
?string $schema = null,
string $host = 'localhost',
int $port = 3306
) : static {
Expand Down Expand Up @@ -415,7 +415,7 @@ public function use(string $schema) : static
*
* @return CreateSchema
*/
public function createSchema(string $schemaName = null) : CreateSchema
public function createSchema(?string $schemaName = null) : CreateSchema
{
$instance = new CreateSchema($this);
if ($schemaName !== null) {
Expand All @@ -431,7 +431,7 @@ public function createSchema(string $schemaName = null) : CreateSchema
*
* @return DropSchema
*/
public function dropSchema(string $schemaName = null) : DropSchema
public function dropSchema(?string $schemaName = null) : DropSchema
{
$instance = new DropSchema($this);
if ($schemaName !== null) {
Expand All @@ -447,7 +447,7 @@ public function dropSchema(string $schemaName = null) : DropSchema
*
* @return AlterSchema
*/
public function alterSchema(string $schemaName = null) : AlterSchema
public function alterSchema(?string $schemaName = null) : AlterSchema
{
$instance = new AlterSchema($this);
if ($schemaName !== null) {
Expand All @@ -463,7 +463,7 @@ public function alterSchema(string $schemaName = null) : AlterSchema
*
* @return CreateTable
*/
public function createTable(string $tableName = null) : CreateTable
public function createTable(?string $tableName = null) : CreateTable
{
$instance = new CreateTable($this);
if ($tableName !== null) {
Expand All @@ -480,7 +480,7 @@ public function createTable(string $tableName = null) : CreateTable
*
* @return DropTable
*/
public function dropTable(string $table = null, string ...$tables) : DropTable
public function dropTable(?string $table = null, string ...$tables) : DropTable
{
$instance = new DropTable($this);
if ($table !== null) {
Expand All @@ -496,7 +496,7 @@ public function dropTable(string $table = null, string ...$tables) : DropTable
*
* @return AlterTable
*/
public function alterTable(string $tableName = null) : AlterTable
public function alterTable(?string $tableName = null) : AlterTable
{
$instance = new AlterTable($this);
if ($tableName !== null) {
Expand All @@ -508,14 +508,14 @@ public function alterTable(string $tableName = null) : AlterTable
/**
* Call a DELETE statement.
*
* @param array<string,Closure|string>|Closure|string|null $reference
* @param array<string,Closure|string>|Closure|string ...$references
* @param Closure|array<string,Closure|string>|string|null $reference
* @param Closure|array<string,Closure|string>|string ...$references
*
* @return Delete
*/
public function delete(
array | Closure | string $reference = null,
array | Closure | string ...$references
Closure | array | string | null $reference = null,
Closure | array | string ...$references
) : Delete {
$instance = new Delete($this);
if ($reference !== null) {
Expand All @@ -531,7 +531,7 @@ public function delete(
*
* @return Insert
*/
public function insert(string $intoTable = null) : Insert
public function insert(?string $intoTable = null) : Insert
{
$instance = new Insert($this);
if ($intoTable !== null) {
Expand All @@ -547,7 +547,7 @@ public function insert(string $intoTable = null) : Insert
*
* @return LoadData
*/
public function loadData(string $intoTable = null) : LoadData
public function loadData(?string $intoTable = null) : LoadData
{
$instance = new LoadData($this);
if ($intoTable !== null) {
Expand All @@ -563,7 +563,7 @@ public function loadData(string $intoTable = null) : LoadData
*
* @return Replace
*/
public function replace(string $intoTable = null) : Replace
public function replace(?string $intoTable = null) : Replace
{
$instance = new Replace($this);
if ($intoTable !== null) {
Expand All @@ -575,14 +575,14 @@ public function replace(string $intoTable = null) : Replace
/**
* Call a SELECT statement.
*
* @param array<string,Closure|string>|Closure|string|null $reference
* @param array<string,Closure|string>|Closure|string ...$references
* @param Closure|array<string,Closure|string>|string|null $reference
* @param Closure|array<string,Closure|string>|string ...$references
*
* @return Select
*/
public function select(
array | Closure | string $reference = null,
array | Closure | string ...$references
Closure | array | string | null $reference = null,
Closure | array | string ...$references
) : Select {
$instance = new Select($this);
if ($reference !== null) {
Expand All @@ -594,14 +594,14 @@ public function select(
/**
* Call a UPDATE statement.
*
* @param array<string,Closure|string>|Closure|string|null $reference
* @param array<string,Closure|string>|Closure|string ...$references
* @param Closure|array<string,Closure|string>|string|null $reference
* @param Closure|array<string,Closure|string>|string ...$references
*
* @return Update
*/
public function update(
array | Closure | string $reference = null,
array | Closure | string ...$references
Closure | array | string | null $reference = null,
Closure | array | string ...$references
) : Update {
$instance = new Update($this);
if ($reference !== null) {
Expand Down Expand Up @@ -773,7 +773,7 @@ public function protectIdentifier(string $identifier) : string
* the word "NULL". If is false, "FALSE". If is true, "TRUE". If is a string,
* returns the quoted string. The types int or float returns the same input value.
*/
public function quote(float | bool | int | string | null $value) : float | int | string
public function quote(bool | float | int | string | null $value) : float | int | string
{
$type = \gettype($value);
if ($type === 'string') {
Expand Down Expand Up @@ -818,7 +818,7 @@ protected function addToDebug(Closure $function) : mixed

protected function finalizeAddToDebug(
float $start,
string|null $description = null
?string $description = null
) : void {
$end = \microtime(true);
$rows = $this->mysqli->affected_rows;
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/AlterSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function sql() : string
*
* @return int|string The number of affected rows
*/
public function run() : int|string
public function run() : int | string
{
return $this->database->exec($this->sql());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/AlterTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ protected function renderRenameKeys() : ?string
return \implode(',' . \PHP_EOL, $renames);
}

public function convertToCharset(string $charset, string $collation = null) : static
public function convertToCharset(string $charset, ?string $collation = null) : static
{
$this->sql['convert_to_charset'] = [
'charset' => $charset,
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/CreateSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function sql() : string
*
* @return int|string The number of affected rows
*/
public function run() : int|string
public function run() : int | string
{
return $this->database->exec($this->sql());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/CreateTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function sql() : string
*
* @return int|string The number of affected rows
*/
public function run() : int|string
public function run() : int | string
{
return $this->database->exec($this->sql());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/DropSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function sql() : string
*
* @return int|string The number of affected rows
*/
public function run() : int|string
public function run() : int | string
{
return $this->database->exec($this->sql());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/DropTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function sql() : string
*
* @return int|string The number of affected rows
*/
public function run() : int|string
public function run() : int | string
{
return $this->database->exec($this->sql());
}
Expand Down
6 changes: 3 additions & 3 deletions src/Definition/Table/Columns/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class Column extends DefinitionPart
protected bool $null = false;
protected bool $uniqueKey = false;
protected bool $primaryKey = false;
protected bool | Closure | float | int | string | null $default;
protected Closure | bool | float | int | string | null $default;
protected Closure $check;
protected ?string $comment;
protected bool $first = false;
Expand Down Expand Up @@ -108,11 +108,11 @@ protected function renderNull() : ?string
}

/**
* @param bool|Closure|float|int|string|null $default
* @param Closure|bool|float|int|string|null $default
*
* @return static
*/
public function default(bool | Closure | float | int | string | null $default) : static
public function default(Closure | bool | float | int | string | null $default) : static
{
$this->default = $default;
return $this;
Expand Down
22 changes: 11 additions & 11 deletions src/Definition/Table/Columns/ColumnDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,52 +66,52 @@ public function __construct(Database $database)
$this->database = $database;
}

public function int(int $maximum = null) : IntColumn
public function int(?int $maximum = null) : IntColumn
{
return $this->column = new IntColumn($this->database, $maximum);
}

public function bigint(int $maximum = null) : BigintColumn
public function bigint(?int $maximum = null) : BigintColumn
{
return $this->column = new BigintColumn($this->database, $maximum);
}

public function tinyint(int $maximum = null) : TinyintColumn
public function tinyint(?int $maximum = null) : TinyintColumn
{
return $this->column = new TinyintColumn($this->database, $maximum);
}

public function decimal(int $maximum = null, int $decimals = null) : DecimalColumn
public function decimal(?int $maximum = null, ?int $decimals = null) : DecimalColumn
{
return $this->column = new DecimalColumn($this->database, $maximum, $decimals);
}

public function float(int $maximum = null, int $decimals = null) : FloatColumn
public function float(?int $maximum = null, ?int $decimals = null) : FloatColumn
{
return $this->column = new FloatColumn($this->database, $maximum, $decimals);
}

public function mediumint(int $maximum = null) : MediumintColumn
public function mediumint(?int $maximum = null) : MediumintColumn
{
return $this->column = new MediumintColumn($this->database, $maximum);
}

public function smallint(int $maximum = null) : SmallintColumn
public function smallint(?int $maximum = null) : SmallintColumn
{
return $this->column = new SmallintColumn($this->database, $maximum);
}

public function boolean(int $maximum = null) : BooleanColumn
public function boolean(?int $maximum = null) : BooleanColumn
{
return $this->column = new BooleanColumn($this->database, $maximum);
}

public function varchar(int $maximum = null) : VarcharColumn
public function varchar(?int $maximum = null) : VarcharColumn
{
return $this->column = new VarcharColumn($this->database, $maximum);
}

public function char(int $maximum = null) : CharColumn
public function char(?int $maximum = null) : CharColumn
{
return $this->column = new CharColumn($this->database, $maximum);
}
Expand All @@ -126,7 +126,7 @@ public function set(string $value, string ...$values) : SetColumn
return $this->column = new SetColumn($this->database, $value, ...$values);
}

public function text(int $maximum = null) : TextColumn
public function text(?int $maximum = null) : TextColumn
{
return $this->column = new TextColumn($this->database, $maximum);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Definition/Table/Indexes/IndexDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class IndexDefinition extends DefinitionPart
protected ?string $name;
protected ?Index $index = null;

public function __construct(Database $database, string $name = null)
public function __construct(Database $database, ?string $name = null)
{
$this->database = $database;
$this->name = $name;
Expand Down
Loading

0 comments on commit 679bb0c

Please sign in to comment.