Skip to content

Commit

Permalink
[fix] Implicitly nullable parameter declarations for PHP8.4 #1130
Browse files Browse the repository at this point in the history
  • Loading branch information
catfan committed Nov 28, 2024
1 parent 7775795 commit 6ef45a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
->setRules([
'@PSR2' => true,
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short']
'array_syntax' => ['syntax' => 'short'],
'nullable_type_declaration_for_default_null_value' => true
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
16 changes: 8 additions & 8 deletions src/Medoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,21 @@ class Medoo

/**
* Regular expression pattern for valid table names.
*
*
* @var string
*/
protected const TABLE_PATTERN = "[\p{L}_][\p{L}\p{N}@$#\-_]*";

/**
* Regular expression pattern for valid column names.
*
*
* @var string
*/
protected const COLUMN_PATTERN = "[\p{L}_][\p{L}\p{N}@$#\-_\.]*";

/**
* Regular expression pattern for valid alias names.
*
*
* @var string
*/
protected const ALIAS_PATTERN = "[\p{L}_][\p{L}\p{N}@$#\-_]*";
Expand Down Expand Up @@ -541,7 +541,7 @@ public function query(string $statement, array $map = []): ?PDOStatement
* @codeCoverageIgnore
* @return \PDOStatement|null
*/
public function exec(string $statement, array $map = [], callable $callback = null): ?PDOStatement
public function exec(string $statement, array $map = [], ?callable $callback = null): ?PDOStatement
{
$this->statement = null;
$this->errorInfo = null;
Expand Down Expand Up @@ -1425,7 +1425,7 @@ protected function dataMap(
array $columnMap,
array &$stack,
bool $root,
array &$result = null
?array &$result = null
): void {
if ($root) {
$columnsKey = array_keys($columns);
Expand Down Expand Up @@ -1697,7 +1697,7 @@ public function select(string $table, $join, $columns = null, $where = null): ?a
* @param string $primaryKey
* @return \PDOStatement|null
*/
public function insert(string $table, array $values, string $primaryKey = null): ?PDOStatement
public function insert(string $table, array $values, ?string $primaryKey = null): ?PDOStatement
{
$stack = [];
$columns = [];
Expand Down Expand Up @@ -2160,7 +2160,7 @@ public function action(callable $actions): void
* @codeCoverageIgnore
* @return string|null
*/
public function id(string $name = null): ?string
public function id(?string $name = null): ?string
{
$type = $this->type;

Expand Down

0 comments on commit 6ef45a5

Please sign in to comment.