Skip to content

Commit

Permalink
drop phpstan phpdoc-tag prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Mar 8, 2024
1 parent 754b20e commit 94b3a6e
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 173 deletions.
2 changes: 1 addition & 1 deletion src/Bridges/NetteDI/DbalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function loadConfiguration(): void


/**
* @phpstan-param array<mixed> $config
* @param array<mixed> $config
*/
protected function setupConnection(array $config): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/NetteTracy/BluescreenQueryPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class BluescreenQueryPanel
{
/**
* @phpstan-return array{tab: string, panel: string}|null
* @return array{tab: string, panel: string}|null
*/
public static function renderBluescreenPanel(?\Throwable $exception): ?array
{
Expand Down
4 changes: 1 addition & 3 deletions src/Bridges/NetteTracy/ConnectionPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class ConnectionPanel implements IBarPanel, ILogger

private float $totalTime = 0; // @phpstan-ignore-line

/**
* @phpstan-var array<array{IConnection, string, float, ?int}>
*/
/** @var array<array{IConnection, string, float, ?int}> */
private array $queries = [];

private readonly IConnection $connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class QueryDataCollector extends DataCollector implements ILogger
{
private readonly bool $explain;

/**
* @phpstan-var array<array{string, float, ?int}>
*/
/** @var array<array{string, float, ?int}> */
private array $queries = [];


Expand Down
3 changes: 1 addition & 2 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class Connection implements IConnection


/**
* @param array $config see drivers for supported options
* @phpstan-param array<string, mixed> $config
* @param array<string, mixed> $config see drivers for supported options
*/
public function __construct(private array $config)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/IDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ interface IDriver


/**
* Connects the driver to database.
* @phpstan-param array<string, mixed> $params
* Connects the driver to a database.
* @param array<string, mixed> $params
* @internal
*/
public function connect(array $params, ILogger $logger): void;
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/Mysqli/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function rollbackSavepoint(string|Fqn $name): void


/**
* @phpstan-param array<string, mixed> $params
* @param array<string, mixed> $params
*/
protected function setupSsl(array $params): void
{
Expand Down Expand Up @@ -300,7 +300,7 @@ protected function setupSsl(array $params): void


/**
* @phpstan-param array<string, mixed> $params
* @param array<string, mixed> $params
*/
protected function processInitialSettings(array $params): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/Mysqli/MysqliResultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class MysqliResultAdapter implements IResultAdapter


/**
* @phpstan-param mysqli_result<array<mixed>> $result
* @param mysqli_result<array<mixed>> $result
*/
public function __construct(
/**
* @phpstan-var mysqli_result<array<mixed>>
* @var mysqli_result<array<mixed>>
*/
private readonly mysqli_result $result,
private readonly MysqliResultNormalizerFactory $normalizerFactory,
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/PdoMysql/PdoMysqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function createException(string $error, int $errorNo, string $sqlState


/**
* @phpstan-param array<string, mixed> $params
* @param array<string, mixed> $params
*/
protected function processInitialSettings(array $params): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/PdoPgsql/PdoPgsqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function createException(string $error, int $errorNo, string $sqlState


/**
* @phpstan-param array<string, mixed> $params
* @param array<string, mixed> $params
*/
protected function processInitialSettings(array $params): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Drivers/Pgsql/PgsqlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ protected function loggedQuery(string $sql): Result


/**
* @phpstan-param array<string, mixed> $params
* @phpstan-return array<string, mixed>
* @param array<string, mixed> $params
* @return array<string, mixed>
*/
private function processConfig(array $params): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Pgsql/PgsqlResultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function fetch(): ?array

public function getRowsCount(): int
{
/** @phpstan-var int<-1, max> $count */
/** @var int<-1, max> $count */
$count = pg_num_rows($this->result);
return $count === -1 ? 0 : $count;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Sqlsrv/SqlsrvResultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function fetch(): ?array

public function getRowsCount(): int
{
/** @phpstan-var int<0, max>|false $count */
/** @var int<0, max>|false $count */
$count = sqlsrv_num_rows($this->statement);
return $count === false ? 0 : $count;
}
Expand Down
17 changes: 7 additions & 10 deletions src/IConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function reconnect(): void;

/**
* Reconnects to a database with new configuration. Unchanged configuration is reused.
* @phpstan-param array<string, mixed> $config
* @param array<string, mixed> $config
*/
public function reconnectWithConfig(array $config): void;

Expand All @@ -52,7 +52,7 @@ public function getDriver(): IDriver;

/**
* Returns connection configuration.
* @phpstan-return array<string, mixed>
* @return array<string, mixed>
*/
public function getConfig(): array;

Expand All @@ -66,17 +66,16 @@ public function getConfig(): array;
* ```php
* $connection->query('SELECT * FROM books WHERE id = %i', $id);
* ```
* @phpstan-param literal-string $expression
* @param literal-string $expression
* @param mixed ...$args
* @phpstan-param mixed ...$args
* @throws QueryException
*/
public function query(string $expression, mixed ...$args): Result;


/**
* @phpstan-param string|array<mixed> $query
* @phpstan-param array<mixed> $args
* @param string|array<mixed> $query
* @param array<mixed> $args
* @throws QueryException
*/
public function queryArgs(string|array $query, array $args = []): Result;
Expand Down Expand Up @@ -109,11 +108,9 @@ public function setTransactionIsolationLevel(int $level): void;

/**
* Performs operation in a transaction.
* @param callable $callback function(Connection $conn): mixed
* @return mixed value returned by callback
* @template T
* @phpstan-param callable(Connection):T $callback
* @phpstan-return T
* @param callable(Connection):T $callback
* @return T value returned by callback
* @throws \Exception
*/
public function transactional(callable $callback): mixed;
Expand Down
5 changes: 1 addition & 4 deletions src/Platforms/Data/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ public function __construct(
public readonly bool $isAutoincrement,
public readonly bool $isUnsigned,
public readonly bool $isNullable,
/**
* @var mixed[]
* @phpstan-var array<string, mixed>
*/
/** @var array<string, mixed> */
public readonly array $meta = [],
)
{
Expand Down
11 changes: 4 additions & 7 deletions src/Platforms/IPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ public function getName(): string;

/**
* Returns list of tables names indexed by fully qualified unescaped table name.
* If no schema is provided, uses current schema name (search path).
* @return Table[]
* @phpstan-return array<string, Table>
* If no schema is provided, it uses the current schema name (search path).
* @return array<string, Table>
*/
public function getTables(?string $schema = null): array;


/**
* Returns list of table columns metadata, indexed by column name.
* @return Column[]
* @phpstan-return array<string, Column>
* @return array<string, Column>
*/
public function getColumns(string $table, ?string $schema = null): array;


/**
* Returns list of table foreign keys, indexed by column name.
* @return ForeignKey[]
* @phpstan-return array<string, ForeignKey>
* @return array<string, ForeignKey>
*/
public function getForeignKeys(string $table, ?string $schema = null): array;

Expand Down
Loading

0 comments on commit 94b3a6e

Please sign in to comment.