Skip to content

0.6.0 depends on symfony/framework-bundle, package lacking in composer.json require section #256

@webignition

Description

@webignition

PR #254 (included in release 0.6.0) added src/WebTestAssertionsTrait.php which uses Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait.

When upgrading a project of mine to use panther 0.6.0, phpstan crashed when linting due to:

Trait 'Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait' not found in [file]

symfony/framework-bundle is present in the require-dev section of composer.json but not the require section.

Projects using symfony/panther as a direct dependency (not a dev dependency) will not pull in the symfony/framework-bundle dependency unless otherwise explicitly required. Having to explicitly require the dependencies of a dependency isn't the right way to do things.

A file in src now directly depends on a file within test namespace of symfony/framework-bundle. For things to work nicely, panther itself should declare a direct dependency on symfony/framework-bundle (not just a dev dependency).

Solutions that I can see:

  1. move the current symfony/framework-bundle requirement from require-dev to require
  2. find another means of making the changes applied in Compatibility with Symfony 5 #254 work without a direct dependency on symfony/framework-bundle

Solution 1 feels wrong to me (or at least not fully right). Having a file in src depend on a file in the test namespace of symfony/framework-bundle seems ... messy. But this does seem to be the more pragmatic solution.

Solution 2 could be achieved by factoring out WebTestAssertionsTrait from symfony/framework-bundle into a separate package upon which both symfony/panther and symfony/framework-bundle could depend. This seems like a heck of a lot of work and involves many parties to be achieved. Perhaps ideal but not realistic.

@dunglas What are your thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions