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

[TASK] Avoid calling deprecated Platform->getName() #522

Merged
merged 1 commit into from
Nov 22, 2023
Merged

Conversation

sbuerk
Copy link
Collaborator

@sbuerk sbuerk commented Nov 22, 2023

The doctrine team deprecated the getName() method
for platform classes within doctrine/dbal 3.x [1].

This change modifes userland code to

a) replace getName() with instanceof checks

Using instanceof checks against the connection platform
is the propose replacement for the deprecated getName()
method.

b) Use prefixed class namespace alias for imported platforms

Instead of

use Doctrine\DBAL\Platforms\SqlitePlatform;

prefixed alias is used:

use Doctrine\DBAL\Platforms\SqlitePlatform
as DoctrineSQLitePlatform;

Only caveat is, that static code analysers like PHPStan
may report it.

[1] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-abstractplatformgetname

Releases: main

The doctrine team deprecated the `getName()` method
for platform classes within `doctrine/dbal 3.x` [1].

This change modifes userland code to

a) replace `getName()` with `instanceof` checks

Using `instanceof` checks against the connection platform
is the propose replacement for the deprecated `getName()`
method.

b) Use prefixed class namespace alias for imported platforms

Instead of

  use Doctrine\DBAL\Platforms\SqlitePlatform;

prefixed alias is used:

  use Doctrine\DBAL\Platforms\SqlitePlatform
    as DoctrineSQLitePlatform;

Only caveat is, that static code analysers like PHPStan
may report it.

[1] https://github.com/doctrine/dbal/blob/3.7.x/UPGRADE.md#deprecated-abstractplatformgetname

Releases: main
@sbuerk sbuerk merged commit 3e9a846 into main Nov 22, 2023
4 checks passed
@sbuerk sbuerk deleted the stefan-2 branch November 22, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants