1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

PhpStan fixes (#363)

This commit is contained in:
Jan Barášek
2020-05-07 21:30:57 +02:00
committed by David Grudl
parent ed2a827419
commit 1bdf6e93d0
4 changed files with 15 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
"require-dev": { "require-dev": {
"tracy/tracy": "~2.2", "tracy/tracy": "~2.2",
"nette/tester": "~2.0", "nette/tester": "~2.0",
"nette/di": "^3.0",
"phpstan/phpstan": "^0.12" "phpstan/phpstan": "^0.12"
}, },
"replace": { "replace": {

View File

@@ -148,6 +148,9 @@ class MySqliDriver implements Dibi\Driver
} }
/**
* @param int|string $code
*/
public static function createException(string $message, $code, string $sql): Dibi\DriverException public static function createException(string $message, $code, string $sql): Dibi\DriverException
{ {
if (in_array($code, [1216, 1217, 1451, 1452, 1701], true)) { if (in_array($code, [1216, 1217, 1451, 1452, 1701], true)) {

View File

@@ -32,6 +32,12 @@ namespace Dibi;
* @method Fluent and(...$cond) * @method Fluent and(...$cond)
* @method Fluent or(...$cond) * @method Fluent or(...$cond)
* @method Fluent using(...$cond) * @method Fluent using(...$cond)
* @method Fluent update(...$cond)
* @method Fluent insert(...$cond)
* @method Fluent delete(...$cond)
* @method Fluent into(...$cond)
* @method Fluent values(...$cond)
* @method Fluent set(...$args)
* @method Fluent asc() * @method Fluent asc()
* @method Fluent desc() * @method Fluent desc()
*/ */

View File

@@ -19,7 +19,7 @@ class Result implements IDataSource
{ {
use Strict; use Strict;
/** @var ResultDriver */ /** @var ResultDriver|null */
private $driver; private $driver;
/** @var array Translate table */ /** @var array Translate table */
@@ -242,6 +242,9 @@ class Result implements IDataSource
$data = null; $data = null;
$assoc = preg_split('#(\[\]|->|=|\|)#', $assoc, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $assoc = preg_split('#(\[\]|->|=|\|)#', $assoc, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (!$assoc) {
throw new \InvalidArgumentException("Invalid descriptor '$assoc'.");
}
// check columns // check columns
foreach ($assoc as $as) { foreach ($assoc as $as) {
@@ -292,6 +295,7 @@ class Result implements IDataSource
} while ($row = $this->fetch()); } while ($row = $this->fetch());
unset($x); unset($x);
/** @var mixed[] $data */
return $data; return $data;
} }