Skip to content

Commit

Permalink
Do not re-alias SerializationException (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Dec 30, 2022
1 parent fbc1283 commit 75853e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Sync/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use Amp\Serialization\SerializationException as SerializerException;

// Alias must be defined in an always-loaded file as catch blocks do not trigger the autoloader.
\class_alias(SerializerException::class, SerializationException::class);
if (!\class_exists(SerializationException::class)) {
// Alias must be defined in an always-loaded file as catch blocks do not trigger the autoloader.
\class_alias(SerializerException::class, SerializationException::class);
}

/**
* @param \Throwable $exception
Expand Down

4 comments on commit 75853e1

@MikeiLL
Copy link

Choose a reason for hiding this comment

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

For me, this still generates the php warning.

@kelunik
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we forgot to tag a release with this commit. /cc @trowski

If you're in fact using this latest commit, please open an issue with steps how to reproduce this warning.

@MikeiLL
Copy link

Choose a reason for hiding this comment

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

Seems like we forgot to tag a release with this commit. /cc @trowski

If you're in fact using this latest commit, please open an issue with steps how to reproduce this warning.

Thanks. Using latest non-beta release:

|--amphp/amp ^2.6
|--amphp/parallel ^1.4
|  |--amphp/amp ^2
|  |--amphp/byte-stream ^1.6.1
|  |  |--amphp/amp ^2
|  |--amphp/parser ^1
|  |--amphp/process ^1
|  |  |--amphp/amp ^2
|  |  |--amphp/byte-stream ^1.4
|  |  |  |--amphp/amp ^2
|  |--amphp/serialization ^1
|  |--amphp/sync ^1.0.1
|  |  |--amphp/amp ^2.2
|--amphp/parallel-functions ^1.1
|  |--amphp/amp ^2.0.3
|  |--amphp/parallel ^1.4
|  |  |--amphp/amp ^2
|  |  |--amphp/byte-stream ^1.6.1
|  |  |  |--amphp/amp ^2
|  |  |--amphp/parser ^1
|  |  |--amphp/process ^1
|  |  |  |--amphp/amp ^2
|  |  |  |--amphp/byte-stream ^1.4
|  |  |  |  |--amphp/amp ^2
|  |  |--amphp/serialization ^1
|  |  |--amphp/sync ^1.0.1
|  |  |  |--amphp/amp ^2.2
|  |--amphp/serialization ^1.0
PHP Warning:  Cannot declare class Amp\Parallel\Sync\SerializationException, because the name is already in use in /path_to/vendor/amphp/parallel/lib/Sync/functions.php on line 9

The full requirements package:

,
    "require": {
        "php": ">=8.0",
        "composer/installers": "2.x",
        "stevegrunwell/wp-cache-remember": "dev-master",
        "micropackage/requirements": "^1.2",
        "wpbp/debug": "dev-master",
        "inpsyde/wp-context": "^1.4",
        "decodelabs/tagged": "^0.14.6",
        "twilio/sdk": "^6.44",
        "vlucas/phpdotenv": "^5.5",
        "inpsyde/assets": "^2.8"
    },
    "require-dev": {
        "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
        "phpro/grumphp": "^1.13",
        "szepeviktor/phpstan-wordpress": "^1.1.2",
        "codeatcode/codeatcs": "^1.0",
        "wp-coding-standards/wpcs": "dev-develop"
    },

This is what I have for lines 7-10:

if (!\class_exists(SerializationException::class)) {
    // Alias must be defined in an always-loaded file as catch blocks do not trigger the autoloader.
    \class_alias(SerializerException::class, SerializationException::class);
}

Thanks for the attention to this, peops.

@kelunik
Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, there's a tag, but no GitHub release: https://github.com/amphp/parallel/commits/v1.4.2

Please open an issue with steps on how to reproduce then.

Please sign in to comment.