Skip to content

Commit

Permalink
Merge branch '2.13.x' into 3.1.x
Browse files Browse the repository at this point in the history
* 2.13.x:
  PHPStan 1.0.2
  • Loading branch information
derrabus committed Nov 6, 2021
2 parents 44fb020 + 01595c0 commit 95b517f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 25 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-strict-rules": "^0.12.11",
"phpstan/phpstan": "1.0.2",
"phpstan/phpstan-strict-rules": "^1",
"phpunit/phpunit": "9.5.10",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.1",
Expand Down
23 changes: 14 additions & 9 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
# changing these would be a BC break, to be done in next major
- '~^Return type \(int\|false\) of method Doctrine\\DBAL\\Driver\\OCI8\\Connection\:\:lastInsertId\(\) should be compatible with return type \(string\) of method Doctrine\\DBAL\\Driver\\Connection::lastInsertId\(\)~'
- '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\Connection::lastInsertId\(\) should return string but returns int\|string\.$~'

# https://github.com/doctrine/dbal/pull/3836
# TODO: remove in 4.0.0
- '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array<string>, array<int, int\|string> given\.\z~'
Expand Down Expand Up @@ -82,9 +78,19 @@ parameters:
paths:
- src/Driver/OCI8/Result.php

# https://github.com/phpstan/phpstan/issues/5608
# PHPStan fails to parse this type alias which is meant for Psalm only.
-
message: '~^Invalid type definition detected in type alias (Override)?Params\.$~'
paths:
- src/DriverManager.php

-
message: '~Template type T of method Doctrine\\DBAL\\DriverManager::getConnection\(\) is not referenced in a parameter\.~'
paths:
- src/DriverManager.ph

-
message: '~^Circular definition detected in type alias (Override)?Params\.$~'
message: '~Method Doctrine\\DBAL\\DriverManager::createDriver\(\) should return Doctrine\\DBAL\\Driver but returns object\.~'
paths:
- src/DriverManager.php

Expand Down Expand Up @@ -117,10 +123,9 @@ parameters:
message: '~Only numeric types are allowed in \-, float\|null given on the right side\.~'
path: src/Logging/DebugStack.php

# https://github.com/phpstan/phpstan-src/pull/700
-
message: '~^Parameter #2 \$count of function array_fill expects int<0, max>, int given\.$~'
message: '~Method Doctrine\\DBAL\\Driver\\Mysqli\\Result::rowCount\(\) should return int but returns int\|string\.~'
paths:
- src/Driver/Mysqli/Statement.php
- src/Driver/Mysqli/Result.php
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ public function getTransactionNestingLevel()
*
* @param string|null $name Name of the sequence object from which the ID should be returned.
*
* @return string A string representation of the last inserted ID.
* @return string|int|false A string representation of the last inserted ID.
*
* @throws Exception
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function exec(string $sql): int;
*
* @param string|null $name
*
* @return string
* @return string|int|false
*
* @throws Exception
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Driver/Mysqli/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
use function array_combine;
use function array_fill;
use function array_map;
use function assert;
use function count;
use function is_array;

final class Result implements ResultInterface
{
Expand Down Expand Up @@ -61,7 +59,6 @@ public function __construct(mysqli_stmt $statement)
$this->hasColumns = true;

$fields = $meta->fetch_fields();
assert(is_array($fields));

$this->columnNames = array_map(static function (stdClass $field): string {
return $field->name;
Expand Down
7 changes: 0 additions & 7 deletions src/Schema/SQLServerSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;
use PDOException;

use function assert;
use function count;
Expand Down Expand Up @@ -254,12 +253,6 @@ public function listTableIndexes($table)

try {
$tableIndexes = $this->_conn->fetchAllAssociative($sql);
} catch (PDOException $e) {
if ($e->getCode() === 'IMSSP') {
return [];
}

throw $e;
} catch (Exception $e) {
if (strpos($e->getMessage(), 'SQLSTATE [01000, 15472]') === 0) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion tests/Driver/OCI8/ExecutionModeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Tests\Driver\OCI8;

use Doctrine\DBAL\Driver\OCI8\ExecutionMode;
use PHPStan\Testing\TestCase;
use PHPUnit\Framework\TestCase;

final class ExecutionModeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/WriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public function testDeleteWhereIsNull(): void
* Returns the ID of the last inserted row or skips the test if the currently used driver
* doesn't support this feature
*
* @return string|false
* @return string|int|false
*
* @throws Exception
*/
Expand Down

0 comments on commit 95b517f

Please sign in to comment.