Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Psalm level to 3 #4348

Merged
merged 21 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function setUp(): void
}

/**
* @return Connection|MockObject
* @return Connection&MockObject
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have recently seen people at Sonata using something even better: MockObject<Connection>. Would that work for us?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work with the latest version of dependencies:

$ composer show | grep psalm

psalm/plugin-phpunit                           0.10.1  Psalm plugin for PHPUnit
vimeo/psalm                                    3.17.2  A static analysis tool for finding...

$ psalm

...
ERROR: InvalidArgument - tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php:67:71 - Argument 2 of Doctrine\DBAL\Types\VarDateTimeType::convertToPHPValue expects Doctrine\DBAL\Platforms\AbstractPlatform, PHPUnit\Framework\MockObject\MockObject<Doctrine\DBAL\Platforms\AbstractPlatform> provided (see https://psalm.dev/004)
        self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform));


------------------------------
251 errors found
------------------------------

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I can't find the piece of code where I see that so nevermind…

*/
private function getExecuteStatementMockConnection()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DB2ConnectionTest extends DbalTestCase
/**
* The ibm_db2 driver connection mock under test.
*
* @var DB2Connection|MockObject
* @var DB2Connection&MockObject
*/
private $connectionMock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MysqliConnectionTest extends DbalFunctionalTestCase
/**
* The mysqli driver connection mock under test.
*
* @var MysqliConnection|MockObject
* @var MysqliConnection&MockObject
*/
private $connectionMock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OCI8ConnectionTest extends DbalTestCase
/**
* The oci8 driver connection mock under test.
*
* @var OCI8Connection|MockObject
* @var OCI8Connection&MockObject
*/
private $connectionMock;

Expand Down
3 changes: 1 addition & 2 deletions tests/Doctrine/Tests/DBAL/Driver/PDO/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\DBAL\Driver\PDO\Exception;
use Doctrine\Tests\DbalTestCase;
use PDOException;
use PHPUnit\Framework\MockObject\MockObject;

/**
* @requires extension pdo
Expand All @@ -28,7 +27,7 @@ class ExceptionTest extends DbalTestCase
/**
* The wrapped PDO exception mock.
*
* @var PDOException|MockObject
* @var PDOException
*/
private $wrappedException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SQLAnywhereConnectionTest extends DbalTestCase
/**
* The sqlanywhere driver connection mock under test.
*
* @var SQLAnywhereConnection|MockObject
* @var SQLAnywhereConnection&MockObject
*/
private $connectionMock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SQLSrvConnectionTest extends DbalTestCase
/**
* The sqlsrv driver connection mock under test.
*
* @var SQLSrvConnection|MockObject
* @var SQLSrvConnection&MockObject
*/
private $connectionMock;

Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

class StatementTest extends DbalTestCase
{
/** @var Connection|MockObject */
/** @var Connection&MockObject */
protected $conn;

/** @var Statement */
protected $stmt;

/** @var DriverStatement|MockObject */
/** @var DriverStatement&MockObject */
protected $wrappedStmt;

protected function setUp(): void
Expand Down Expand Up @@ -157,7 +157,7 @@ public function testRowCount(): void
}

/**
* @return Connection|MockObject
* @return Connection&MockObject
*/
protected function createConnection()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
final class DB2SchemaManagerTest extends TestCase
{
/** @var Connection|MockObject */
/** @var Connection&MockObject */
private $conn;

/** @var DB2SchemaManager */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testSchemaDiffToSaveSql(): void
}

/**
* @return AbstractPlatform|MockObject
* @return AbstractPlatform&MockObject
*/
private function createPlatform(bool $unsafe)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class TableDiffTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

public function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class CreateSchemaSqlCollectorTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platformMock;

/** @var CreateSchemaSqlCollector */
Expand Down Expand Up @@ -134,7 +134,7 @@ public function testResetsQueries(): void
}

/**
* @return ForeignKeyConstraint|MockObject
* @return ForeignKeyConstraint&MockObject
*/
private function createForeignKeyConstraintMock()
{
Expand All @@ -144,7 +144,7 @@ private function createForeignKeyConstraintMock()
}

/**
* @return Sequence|MockObject
* @return Sequence&MockObject
*/
private function createSequenceMock()
{
Expand All @@ -154,7 +154,7 @@ private function createSequenceMock()
}

/**
* @return Table|MockObject
* @return Table&MockObject
*/
private function createTableMock()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class ArrayTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var ArrayType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

abstract class BaseDateTypeTestCase extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
protected $platform;

/** @var Type */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class BinaryTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
protected $platform;

/** @var BinaryType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/BlobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class BlobTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
protected $platform;

/** @var BlobType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class BooleanTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var BooleanType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class DateImmutableTypeTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var DateImmutableType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class DateIntervalTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var DateIntervalType */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class DateTimeImmutableTypeTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var DateTimeImmutableType */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class DateTimeTzImmutableTypeTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var DateTimeTzImmutableType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class DecimalTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var DecimalType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/FloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class FloatTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var FloatType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class GuidTypeTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var GuidType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class IntegerTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var IntegerType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class JsonArrayTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
protected $platform;

/** @var JsonArrayType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class JsonTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
protected $platform;

/** @var JsonType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class ObjectTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var ObjectType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class SmallIntTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var SmallIntType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class StringTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var StringType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class TimeImmutableTypeTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var TimeImmutableType */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class VarDateTimeImmutableTypeTest extends TestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var VarDateTimeImmutableType */
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class VarDateTimeTest extends DbalTestCase
{
/** @var AbstractPlatform|MockObject */
/** @var AbstractPlatform&MockObject */
private $platform;

/** @var VarDateTimeType */
Expand Down