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

Found 1 prod dependencies used only in dev paths: ext-amqp #205

Open
ruudk opened this issue Nov 27, 2024 · 1 comment
Open

Found 1 prod dependencies used only in dev paths: ext-amqp #205

ruudk opened this issue Nov 27, 2024 · 1 comment
Labels
question Support question

Comments

@ruudk
Copy link

ruudk commented Nov 27, 2024

This is a false positive, because it is used in prod (src) as well.

We're using symfony/amqp-messenger and have the following code:

<?php # src/Shared/Infrastructure/Messaging/MessageBus/Symfony/Middleware/NewRelicTrackingMiddleware.php

declare(strict_types=1);

namespace Shared\Infrastructure\Messaging\MessageBus\Symfony\Middleware;

use Override;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
use Throwable;

final readonly class NewRelicTrackingMiddleware implements MiddlewareInterface
{
}
<?php # tests/Unit/Shared/Infrastructure/Messaging/MessageBus/Symfony/Middleware/NewRelicTrackingMiddlewareTest.php

declare(strict_types=1);

namespace Shared\Infrastructure\Messaging\MessageBus\Symfony\Middleware;

use AMQPEnvelope;
use LogicException;
use Mockery;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use Mockery\MockInterface;
use Override;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\BusNameStamp;
use Symfony\Component\Messenger\Stamp\ReceivedStamp;

final class NewRelicTrackingMiddlewareTest extends TestCase
{
}
$ vendor/bin/composer-dependency-analyser
Using config composer-dependency-analyser.php

Found 1 prod dependencies used only in dev paths!
(those should probably be moved to "require-dev" section in composer.json)

  • ext-amqp

(scanned 18970 files in 2.376 s)
$ vendor/bin/composer-dependency-analyser --dump-usages 'ext-amqp'
Using config composer-dependency-analyser.php

Dumping sample usages of ext-amqp
(2 usages of 1 symbol in total)

  • ext-amqp
      AMQPEnvelope
        tests/Unit/Shared/Infrastructure/Messaging/MessageBus/Symfony/Middleware/NewRelicTrackingMiddlewareTest.php:73
        tests/Unit/Shared/Infrastructure/Messaging/MessageBus/Symfony/Middleware/NewRelicTrackingMiddlewareTest.php:105
@janedbal
Copy link
Member

But there is no ext-amqp symbol usage in src, right? You just use symfony/amqp-messenger which has its own require of ext-amqp. Thus you dont rely on ext-amqp directly. In theory, symfony/amqp-messenger could change its implementation not to rely on that and your code would still work, right?

@janedbal janedbal added the question Support question label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Support question
Projects
None yet
Development

No branches or pull requests

2 participants