Skip to content

Commit

Permalink
Merge pull request #5877 from derrabus/improvement/psalm-assert
Browse files Browse the repository at this point in the history
Use psalm-assert to get rid of `assert()` calls
  • Loading branch information
greg0ire authored Jan 28, 2023
2 parents e4f65b5 + 1944474 commit a340f1f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Connection
/**
* The wrapped driver connection.
*
* @var \Doctrine\DBAL\Driver\Connection|null
* @var DriverConnection|null
*/
protected $_conn;

Expand Down Expand Up @@ -336,6 +336,8 @@ public function getExpressionBuilder()
* the connection is already open.
*
* @throws Exception
*
* @psalm-assert !null $this->_conn
*/
public function connect()
{
Expand Down Expand Up @@ -1625,8 +1627,6 @@ public function getWrappedConnection()

$this->connect();

assert($this->_conn !== null);

return $this->_conn;
}

Expand All @@ -1635,7 +1635,6 @@ public function getNativeConnection()
{
$this->connect();

assert($this->_conn !== null);
if (! method_exists($this->_conn, 'getNativeConnection')) {
throw new LogicException(sprintf(
'The driver connection %s does not support accessing the native connection.',
Expand Down

0 comments on commit a340f1f

Please sign in to comment.