Skip to content

Commit

Permalink
feat: use expected type for Connection::__construct() to bypass phpst…
Browse files Browse the repository at this point in the history
…an errors (#255)
  • Loading branch information
taka-oyama authored Jan 7, 2025
1 parent afbf238 commit fd45164
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ parameters:
- '#^Return type \(void\) of method .*? should be compatible with return type \(.*?\) of method .*?$#'
- message: '#^Method Colopl\\Spanner\\Connection::runPartitionedDml\(\) should return int but returns mixed\.$#'
path: src/Concerns/ManagesPartitionedDml.php
- message: '#^Parameter \#1 \$pdo of method Illuminate\\Database\\Connection::__construct\(\) expects Closure|PDO, null given\.$#'
path: src/Connection.php
- message: '#^Method Colopl\\Spanner\\Connection::selectWithOptions\(\) should return array<int, array> but returns mixed\.$#'
path: src/Connection.php
- message: "#^Return type \\(Generator\\<int, array, mixed, mixed\\>\\) of method Colopl\\\\Spanner\\\\Connection\\:\\:cursor\\(\\) should be compatible with return type \\(Generator\\<int, stdClass, mixed, mixed\\>\\) of method Illuminate\\\\Database\\\\Connection\\:\\:cursor\\(\\)$#"
Expand Down
8 changes: 7 additions & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ public function __construct(
$this->instanceId = $instanceId;
$this->authCache = $authCache;
$this->sessionPool = $sessionPool;
parent::__construct(null, $database, $tablePrefix, $config);
parent::__construct(
// TODO: throw error after v9
static fn() => null,
$database,
$tablePrefix,
$config,
);
}

/**
Expand Down

0 comments on commit fd45164

Please sign in to comment.