Skip to content

Commit

Permalink
Merge pull request #4934 from morozov/psalm-4.11.2
Browse files Browse the repository at this point in the history
Update Psalm to 4.11.2
  • Loading branch information
morozov committed Oct 27, 2021
2 parents 75fe763 + 07540a0 commit e94864e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"squizlabs/php_codesniffer": "3.6.1",
"symfony/cache": "^4.4",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "4.10.0"
"vimeo/psalm": "4.11.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
Expand Down
22 changes: 7 additions & 15 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MysqliStatement implements IteratorAggregate, StatementInterface, Result
/** @var mixed[] */
protected $_rowBindedValues = [];

/** @var mixed[]|null */
/** @var mixed[] */
protected $_bindedValues;

/** @var string */
Expand Down Expand Up @@ -107,11 +107,7 @@ public function __construct(mysqli $conn, $prepareString)

$this->_stmt = $stmt;

$paramCount = $this->_stmt->param_count;
if (0 >= $paramCount) {
return;
}

$paramCount = $this->_stmt->param_count;
$this->types = str_repeat('s', $paramCount);
$this->_bindedValues = array_fill(1, $paramCount, null);
}
Expand Down Expand Up @@ -156,14 +152,12 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
*/
public function execute($params = null)
{
if ($this->_bindedValues !== null) {
if ($params !== null) {
if (! $this->bindUntypedValues($params)) {
throw StatementError::new($this->_stmt);
}
} else {
$this->bindTypedParameters();
if ($params !== null && count($params) > 0) {
if (! $this->bindUntypedValues($params)) {
throw StatementError::new($this->_stmt);
}
} elseif (count($this->_bindedValues) > 0) {
$this->bindTypedParameters();
}

try {
Expand Down Expand Up @@ -237,8 +231,6 @@ private function bindTypedParameters(): void
$streams = $values = [];
$types = $this->types;

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

foreach ($this->_bindedValues as $parameter => $value) {
assert(is_int($parameter));

Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ parameters:
message: '~^Cannot call method writeTemporary\(\) on OCILob\|null\.$~'
paths:
- lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php

# https://github.com/phpstan/phpstan-src/pull/700
-
message: '~^Parameter #2 \$count of function array_fill expects int<0, max>, int given\.$~'
paths:
- lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php

0 comments on commit e94864e

Please sign in to comment.