Skip to content

Commit

Permalink
Drop support for DBAL 3
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Feb 7, 2024
1 parent 5733ece commit c376858
Show file tree
Hide file tree
Showing 47 changed files with 108 additions and 600 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- "8.3"
dbal-version:
- "default"
- "3.7"
extension:
- "sqlite3"
- "pdo_sqlite"
Expand Down Expand Up @@ -109,7 +108,6 @@ jobs:
- "8.3"
dbal-version:
- "default"
- "3.7"
postgres-version:
- "15"
extension:
Expand All @@ -121,8 +119,8 @@ jobs:
postgres-version: "14"
extension: pdo_pgsql
- php-version: "8.2"
dbal-version: "3.7"
postgres-version: "9.6"
dbal-version: "default"
postgres-version: "10"
extension: pdo_pgsql

services:
Expand Down Expand Up @@ -182,7 +180,6 @@ jobs:
- "8.3"
dbal-version:
- "default"
- "3.7"
- "4@dev"
mariadb-version:
- "10.9"
Expand Down Expand Up @@ -248,7 +245,6 @@ jobs:
- "8.3"
dbal-version:
- "default"
- "3.7"
mysql-version:
- "5.7"
- "8.0"
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ jobs:
name: Static Analysis with PHPStan
runs-on: ubuntu-22.04

strategy:
matrix:
include:
- dbal-version: default
config: phpstan.neon
- dbal-version: 3.7
config: phpstan-dbal3.neon

steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
Expand All @@ -46,27 +38,16 @@ jobs:
php-version: "8.2"
tools: cs2pr

- name: Require specific DBAL version
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"


- name: Install dependencies with Composer
uses: ramsey/composer-install@v2

- name: Run static analysis with phpstan/phpstan
run: "vendor/bin/phpstan analyse -c ${{ matrix.config }} --error-format=checkstyle | cs2pr"
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"

static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-22.04

strategy:
matrix:
dbal-version:
- default
- 3.7

steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
Expand All @@ -76,11 +57,6 @@ jobs:
with:
coverage: none
php-version: "8.2"
tools: cs2pr

- name: Require specific DBAL version
run: "composer require doctrine/dbal ^${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version != 'default' }}"

- name: Install dependencies with Composer
uses: ramsey/composer-install@v2
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"composer-runtime-api": "^2",
"ext-ctype": "*",
"doctrine/collections": "^2.1",
"doctrine/dbal": "^3.6 || ^4",
"doctrine/dbal": "^4",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2",
"doctrine/inflector": "^1.4 || ^2.0",
Expand Down
33 changes: 0 additions & 33 deletions phpstan-dbal3.neon

This file was deleted.

27 changes: 0 additions & 27 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,10 @@ parameters:
path: src/Persisters/Entity/BasicEntityPersister.php

# DBAL 4 compatibility
-
message: '~^Method Doctrine\\ORM\\Query\\AST\\Functions\\TrimFunction::getTrimMode\(\) never returns .* so it can be removed from the return type\.$~'
path: src/Query/AST/Functions/TrimFunction.php
-
message: '~^Method Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister\:\:getArrayBindingType\(\) never returns .* so it can be removed from the return type\.$~'
path: src/Persisters/Entity/BasicEntityPersister.php

-
message: '~^Unreachable statement \- code above always terminates\.$~'
path: src/Mapping/AssociationMapping.php

# Compatibility with DBAL 3
# See https://github.com/doctrine/dbal/pull/3480
-
message: '~^Result of method Doctrine\\DBAL\\Connection::commit\(\) \(void\) is used\.$~'
path: src/UnitOfWork.php
-
message: '~^Strict comparison using === between void and false will always evaluate to false\.$~'
path: src/UnitOfWork.php
-
message: '~^Variable \$e on left side of \?\? always exists and is not nullable\.$~'
path: src/UnitOfWork.php

-
message: '~^Parameter #1 \$command of method Symfony\\Component\\Console\\Application::add\(\) expects Symfony\\Component\\Console\\Command\\Command, Doctrine\\DBAL\\Tools\\Console\\Command\\ReservedWordsCommand given\.$~'
path: src/Tools/Console/ConsoleRunner.php

-
message: '~Strict comparison using \=\=\= between callable\(\)\: mixed and null will always evaluate to false\.~'
path: src/Tools/SchemaTool.php

# To be removed in 4.0
-
message: '#Negated boolean expression is always false\.#'
Expand Down
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,6 @@
</UninitializedProperty>
</file>
<file src="src/Query/Exec/MultiTableUpdateExecutor.php">
<InvalidArgument>
<code>$paramTypes</code>
</InvalidArgument>
<InvalidReturnStatement>
<code>$numUpdated</code>
</InvalidReturnStatement>
Expand Down
43 changes: 0 additions & 43 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<issueHandlers>
<DeprecatedClass>
<errorLevel type="suppress">
<!-- We wire the command as long as DBAL ships it -->
<referencedClass name="Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand" />
<!-- Remove on 3.0.x -->
<referencedClass name="Doctrine\ORM\Event\LifecycleEventArgs"/>
<referencedClass name="Doctrine\ORM\Exception\UnknownEntityNamespace"/>
Expand All @@ -45,22 +43,11 @@
<referencedClass name="Doctrine\ORM\Tools\Console\EntityManagerProvider\HelperSetManagerProvider"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
<errorLevel type="suppress">
<!-- Remove on 3.0.x -->
<!-- Compatibility with DBAL 3 -->
<referencedMethod name="Doctrine\DBAL\Connection::getEventManager"/>
<file name="src/Query/TreeWalkerChain.php"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
<errorLevel type="suppress">
<!-- We're catching invalid input here. -->
<file name="src/Internal/Hydration/AbstractHydrator.php"/>

<!-- DBAL 3.2 forward compatibility -->
<file name="src/Tools/Pagination/CountOutputWalker.php"/>
<file name="src/Tools/Pagination/LimitSubqueryOutputWalker.php"/>
<!-- https://github.com/vimeo/psalm/issues/8520 -->
<file name="src/PersistentCollection.php"/>
<!-- Remove on 4.0.x -->
Expand Down Expand Up @@ -177,43 +164,13 @@

<!-- Persistence 2 compatibility -->
<referencedFunction name="Doctrine\Persistence\ObjectManager::clear"/>

<!-- See https://github.com/doctrine/orm/issues/8850 -->
<referencedFunction name="Doctrine\DBAL\Connection::lastInsertId"/>

<!-- FIXME -->
<referencedFunction name="Doctrine\DBAL\DriverManager::getConnection"/>
</errorLevel>
</TooManyArguments>
<TypeDoesNotContainNull>
<errorLevel type="suppress">
<!-- DBAL 3 compatibility -->
<file name="src/Tools/SchemaTool.php"/>
</errorLevel>
</TypeDoesNotContainNull>
<TypeDoesNotContainType>
<errorLevel type="suppress">
<file name="src/Internal/SQLResultCasing.php"/>
<file name="src/Mapping/ClassMetadataFactory.php"/>
<!-- DBAL 3 compatibility -->
<file name="src/UnitOfWork.php"/>
<file name="src/Utility/LockSqlHelper.php"/>
</errorLevel>
</TypeDoesNotContainType>
<UndefinedClass>
<errorLevel type="suppress">
<!-- Compatibility with DBAL 3 -->
<referencedClass name="Doctrine\DBAL\Platforms\SQLitePlatform"/>
</errorLevel>
</UndefinedClass>
<UndefinedMethod>
<errorLevel type="suppress">
<!-- Compatibility with DBAL 3 -->
<referencedMethod name="Doctrine\DBAL\Connection::getEventManager"/>
<!-- FIXME -->
<referencedMethod name="Doctrine\DBAL\Schema\SchemaDiff::toSaveSql"/>
</errorLevel>
</UndefinedMethod>
<UndefinedPropertyFetch>
<errorLevel type="suppress">
<!-- https://github.com/vimeo/psalm/issues/7878 -->
Expand Down
14 changes: 7 additions & 7 deletions src/AbstractQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@ public function setParameters(ArrayCollection|array $parameters): static
/**
* Sets a query parameter.
*
* @param string|int $key The parameter position or name.
* @param mixed $value The parameter value.
* @param ParameterType|ArrayParameterType|string|int|null $type The parameter type. If specified, the given value
* will be run through the type conversion of this
* type. This is usually not needed for strings and
* numeric types.
* @param string|int $key The parameter position or name.
* @param mixed $value The parameter value.
* @param ParameterType|ArrayParameterType|string|null $type The parameter type. If specified, the given value
* will be run through the type conversion of this
* type. This is usually not needed for strings and
* numeric types.
*
* @return $this
*/
public function setParameter(string|int $key, mixed $value, ParameterType|ArrayParameterType|string|int|null $type = null): static
public function setParameter(string|int $key, mixed $value, ParameterType|ArrayParameterType|string|null $type = null): static
{
$existingParameter = $this->getParameter($key);

Expand Down
8 changes: 4 additions & 4 deletions src/Cache/Persister/Entity/AbstractEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getInserts(): array
public function getSelectSQL(
array|Criteria $criteria,
AssociationMapping|null $assoc = null,
LockMode|int|null $lockMode = null,
LockMode|null $lockMode = null,
int|null $limit = null,
int|null $offset = null,
array|null $orderBy = null,
Expand Down Expand Up @@ -289,7 +289,7 @@ public function load(
object|null $entity = null,
AssociationMapping|null $assoc = null,
array $hints = [],
LockMode|int|null $lockMode = null,
LockMode|null $lockMode = null,
int|null $limit = null,
array|null $orderBy = null,
): object|null {
Expand Down Expand Up @@ -532,15 +532,15 @@ public function loadOneToOneEntity(AssociationMapping $assoc, object $sourceEnti
/**
* {@inheritDoc}
*/
public function lock(array $criteria, LockMode|int $lockMode): void
public function lock(array $criteria, LockMode $lockMode): void
{
$this->persister->lock($criteria, $lockMode);
}

/**
* {@inheritDoc}
*/
public function refresh(array $id, object $entity, LockMode|int|null $lockMode = null): void
public function refresh(array $id, object $entity, LockMode|null $lockMode = null): void
{
$this->persister->refresh($id, $entity, $lockMode);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ public function close(): void
$this->wrapped->close();
}

public function lock(object $entity, LockMode|int $lockMode, DateTimeInterface|int|null $lockVersion = null): void
public function lock(object $entity, LockMode $lockMode, DateTimeInterface|int|null $lockVersion = null): void

Check warning on line 110 in src/Decorator/EntityManagerDecorator.php

View check run for this annotation

Codecov / codecov/patch

src/Decorator/EntityManagerDecorator.php#L110

Added line #L110 was not covered by tests
{
$this->wrapped->lock($entity, $lockMode, $lockVersion);
}

public function find(string $className, mixed $id, LockMode|int|null $lockMode = null, int|null $lockVersion = null): object|null
public function find(string $className, mixed $id, LockMode|null $lockMode = null, int|null $lockVersion = null): object|null

Check warning on line 115 in src/Decorator/EntityManagerDecorator.php

View check run for this annotation

Codecov / codecov/patch

src/Decorator/EntityManagerDecorator.php#L115

Added line #L115 was not covered by tests
{
return $this->wrapped->find($className, $id, $lockMode, $lockVersion);
}

public function refresh(object $object, LockMode|int|null $lockMode = null): void
public function refresh(object $object, LockMode|null $lockMode = null): void

Check warning on line 120 in src/Decorator/EntityManagerDecorator.php

View check run for this annotation

Codecov / codecov/patch

src/Decorator/EntityManagerDecorator.php#L120

Added line #L120 was not covered by tests
{
$this->wrapped->refresh($object, $lockMode);
}
Expand Down
Loading

0 comments on commit c376858

Please sign in to comment.