Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to PHP 8.1 syntax via Rector #5546

Merged
merged 1 commit into from
Jul 28, 2022
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
6 changes: 3 additions & 3 deletions src/Cache/QueryCacheProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
class QueryCacheProfile
{
public function __construct(
private int $lifetime = 0,
private ?string $cacheKey = null,
private ?CacheItemPoolInterface $resultCache = null
private readonly int $lifetime = 0,
private readonly ?string $cacheKey = null,
private readonly ?CacheItemPoolInterface $resultCache = null
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ class Connection implements ServerVersionProvider
/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
*/
public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;
final public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;

/**
* Represents an array of strings to be expanded by Doctrine SQL parsing.
*/
public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;
final public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;

/**
* Represents an array of ascii strings to be expanded by Doctrine SQL parsing.
*/
public const PARAM_ASCII_STR_ARRAY = ParameterType::ASCII + self::ARRAY_PARAM_OFFSET;
final public const PARAM_ASCII_STR_ARRAY = ParameterType::ASCII + self::ARRAY_PARAM_OFFSET;

/**
* Offset by which PARAM_* constants are detected as arrays of the param type.
*/
public const ARRAY_PARAM_OFFSET = 100;
final public const ARRAY_PARAM_OFFSET = 100;

/**
* The wrapped driver connection.
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/StaticServerVersionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class StaticServerVersionProvider implements ServerVersionProvider
{
public function __construct(private string $version)
public function __construct(private readonly string $version)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/AbstractException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class AbstractException extends BaseException implements Exception
*/
public function __construct(
string $message,
private ?string $sqlState = null,
private readonly ?string $sqlState = null,
int $code = 0,
?Throwable $previous = null
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/AbstractOracleDriver/EasyConnectString.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class EasyConnectString
{
private function __construct(private string $string)
private function __construct(private readonly string $string)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/IBMDB2/DataSourceName.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
final class DataSourceName
{
private function __construct(private string $string)
private function __construct(private readonly string $string)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Middleware/AbstractConnectionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

abstract class AbstractConnectionMiddleware implements Connection
{
public function __construct(private Connection $wrappedConnection)
public function __construct(private readonly Connection $wrappedConnection)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Middleware/AbstractDriverMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

abstract class AbstractDriverMiddleware implements Driver
{
public function __construct(private Driver $wrappedDriver)
public function __construct(private readonly Driver $wrappedDriver)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Middleware/AbstractResultMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

abstract class AbstractResultMiddleware implements Result
{
public function __construct(private Result $wrappedResult)
public function __construct(private readonly Result $wrappedResult)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Middleware/AbstractStatementMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

abstract class AbstractStatementMiddleware implements Statement
{
public function __construct(private Statement $wrappedStatement)
public function __construct(private readonly Statement $wrappedStatement)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Connection implements ConnectionInterface
/**
* @internal The connection can be only instantiated by its driver.
*/
public function __construct(private mysqli $connection)
public function __construct(private readonly mysqli $connection)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/Initializer/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class Charset implements Initializer
{
public function __construct(private string $charset)
public function __construct(private readonly string $charset)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/Initializer/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Options implements Initializer
/**
* @param array<int,mixed> $options
*/
public function __construct(private array $options)
public function __construct(private readonly array $options)
{
}

Expand Down
10 changes: 5 additions & 5 deletions src/Driver/Mysqli/Initializer/Secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
final class Secure implements Initializer
{
public function __construct(
private string $key,
private string $cert,
private string $ca,
private string $capath,
private string $cipher
private readonly string $key,
private readonly string $cert,
private readonly string $ca,
private readonly string $capath,
private readonly string $cipher
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class Result implements ResultInterface
*
* @throws Exception
*/
public function __construct(private mysqli_stmt $statement)
public function __construct(private readonly mysqli_stmt $statement)
{
$meta = $statement->result_metadata();

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class Statement implements StatementInterface
/**
* @internal The statement can be only instantiated by its driver connection.
*/
public function __construct(private mysqli_stmt $stmt)
public function __construct(private readonly mysqli_stmt $stmt)
{
$paramCount = $this->stmt->param_count;
$this->types = str_repeat('s', $paramCount);
Expand Down
4 changes: 2 additions & 2 deletions src/Driver/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

final class Connection implements ConnectionInterface
{
private Parser $parser;
private ExecutionMode $executionMode;
private readonly Parser $parser;
private readonly ExecutionMode $executionMode;

/**
* @internal The connection can be only instantiated by its driver.
Expand Down
4 changes: 2 additions & 2 deletions src/Driver/OCI8/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ final class Statement implements StatementInterface
public function __construct(
private $connection,
private $statement,
private array $parameterMap,
private ExecutionMode $executionMode
private readonly array $parameterMap,
private readonly ExecutionMode $executionMode
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/PDO/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final class Connection implements ConnectionInterface
{
private PDO $connection;
private readonly PDO $connection;

/**
* @internal The connection can be only instantiated by its driver.
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/PDO/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Result implements ResultInterface
/**
* @internal The result can be only instantiated by its driver connection or statement.
*/
public function __construct(private PDOStatement $statement)
public function __construct(private readonly PDOStatement $statement)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/PDO/SQLSrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class Connection extends AbstractConnectionMiddleware
{
private PDOConnection $connection;
private readonly PDOConnection $connection;

public function __construct(PDOConnection $connection)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/PDO/SQLSrv/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class Statement extends AbstractStatementMiddleware
{
private PDOStatement $statement;
private readonly PDOStatement $statement;

/**
* @internal The statement can be only instantiated by its driver connection.
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/PDO/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Statement implements StatementInterface
/**
* @internal The statement can be only instantiated by its driver connection.
*/
public function __construct(private PDOStatement $stmt)
public function __construct(private readonly PDOStatement $stmt)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/ConnectionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class ConnectionEventArgs extends EventArgs
{
public function __construct(private Connection $connection)
public function __construct(private readonly Connection $connection)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/SchemaAlterTableAddColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
private array $sql = [];

public function __construct(
private Column $column,
private TableDiff $tableDiff,
private AbstractPlatform $platform
private readonly Column $column,
private readonly TableDiff $tableDiff,
private readonly AbstractPlatform $platform
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/SchemaAlterTableChangeColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
private array $sql = [];

public function __construct(
private ColumnDiff $columnDiff,
private TableDiff $tableDiff,
private AbstractPlatform $platform
private readonly ColumnDiff $columnDiff,
private readonly TableDiff $tableDiff,
private readonly AbstractPlatform $platform
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/SchemaAlterTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
/** @var array<int, string> */
private array $sql = [];

public function __construct(private TableDiff $tableDiff, private AbstractPlatform $platform)
public function __construct(private readonly TableDiff $tableDiff, private readonly AbstractPlatform $platform)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/SchemaAlterTableRemoveColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
private array $sql = [];

public function __construct(
private Column $column,
private TableDiff $tableDiff,
private AbstractPlatform $platform
private readonly Column $column,
private readonly TableDiff $tableDiff,
private readonly AbstractPlatform $platform
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Event/SchemaAlterTableRenameColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
private array $sql = [];

public function __construct(
private string $oldColumnName,
private Column $column,
private TableDiff $tableDiff,
private AbstractPlatform $platform
private readonly string $oldColumnName,
private readonly Column $column,
private readonly TableDiff $tableDiff,
private readonly AbstractPlatform $platform
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Event/SchemaColumnDefinitionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
* @param array<string, mixed> $tableColumn
*/
public function __construct(
private array $tableColumn,
private string $table,
private string $database,
private Connection $connection
private readonly array $tableColumn,
private readonly string $table,
private readonly string $database,
private readonly Connection $connection
) {
}

Expand Down
7 changes: 5 additions & 2 deletions src/Event/SchemaCreateTableColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
/** @var array<int, string> */
private array $sql = [];

public function __construct(private Column $column, private Table $table, private AbstractPlatform $platform)
{
public function __construct(
private readonly Column $column,
private readonly Table $table,
private readonly AbstractPlatform $platform
) {
}

public function getColumn(): Column
Expand Down
8 changes: 4 additions & 4 deletions src/Event/SchemaCreateTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
* @param array<string, mixed> $options
*/
public function __construct(
private Table $table,
private array $columns,
private array $options,
private AbstractPlatform $platform
private readonly Table $table,
private readonly array $columns,
private readonly array $options,
private readonly AbstractPlatform $platform
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/SchemaDropTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SchemaDropTableEventArgs extends SchemaEventArgs
{
private ?string $sql = null;

public function __construct(private string $table, private AbstractPlatform $platform)
public function __construct(private readonly string $table, private readonly AbstractPlatform $platform)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/SchemaIndexDefinitionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
* @param array<string, mixed> $tableIndex
*/
public function __construct(
private array $tableIndex,
private string $table,
private Connection $connection
private readonly array $tableIndex,
private readonly string $table,
private readonly Connection $connection
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TransactionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

abstract class TransactionEventArgs extends EventArgs
{
public function __construct(private Connection $connection)
public function __construct(private readonly Connection $connection)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/DriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DriverException extends Exception implements Driver\Exception
/**
* The query that triggered the exception, if any.
*/
private ?Query $query;
private readonly ?Query $query;

/**
* @internal
Expand Down
Loading