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

Fixed #92 - Update dependencies to symfony v7.0 #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"require": {
"php": ">=7.2",
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
"symfony/framework-bundle": "^6.0|^7.0",
"twig/twig": "^2.15|^3.0",
"symfony/deprecation-contracts": "^2.4|^3.0"
},
Expand All @@ -23,10 +23,10 @@
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0|^6.0",
"nyholm/symfony-bundle-test": "^v2.0",
"nyholm/symfony-bundle-test": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"doctrine/doctrine-bundle": "^v1.0|^v2.0",
"doctrine/annotations": "^v1.7",
"doctrine/annotations": "^2.0",
"symfony/twig-bundle": "^3.4|^4.0|^5.0|^6.0"
},
"autoload-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class Configuration implements ConfigurationInterface
{
#[\ReturnTypeWillChange]
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('apy_breadcrumb_trail');
// BC layer for symfony/config < 4.2
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/BreadcrumbListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function onKernelController(KernelEvent $event)
throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class));
}

if (HttpKernelInterface::MASTER_REQUEST == $event->getRequestType()) {
if (HttpKernelInterface::MAIN_REQUEST == $event->getRequestType()) {
$this->breadcrumbTrail->reset();

// Annotations from class
Expand Down
9 changes: 9 additions & 0 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" priority="-1" />
</service>
<service id="apy_breadcrumb_trail.annotation.listener" alias="APY\BreadcrumbTrailBundle\EventListener\BreadcrumbListener" public="true" />

<!-- Definición del servicio AnnotationReader -->
<service id="Doctrine\Common\Annotations\AnnotationReader" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

As can be seen in the composer.json this bundle does not have a dependency on doctrine annotations, so this approach is not correct as the class potentially is not there. The service retrieval and tagging on the lines below should happen in a compiler pass instead.

Copy link
Author

Choose a reason for hiding this comment

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

If you look the BreadcrumbLister.php file, you can see dependencia of Doctrine\Common\Annotations\Reader;

When you run the tests with the last version with symfony 6.0, we can look this message
7x: Since symfony/framework-bundle 6.4: The "Doctrine\Common\Annotations\Reader" service alias is deprecated without replacement. It is being referenced by the "APY\BreadcrumbTrailBundle\EventListener\BreadcrumbListener" service.
1x in BundleInitializationTest::testServicesAreRegisteredToContainer from APY\BreadcrumbTrailBundle
1x in BreadcrumbListenerTest::testAnnotations from APY\BreadcrumbTrailBundle\EventListener
1x in BreadcrumbListenerTest::testAttributes from APY\BreadcrumbTrailBundle\EventListener
1x in BreadcrumbListenerTest::testMixingAnnotationsWithAttributesFails from APY\BreadcrumbTrailBundle\EventListener
1x in BreadcrumbListenerTest::testInvokableController from APY\BreadcrumbTrailBundle\EventListener
...


<!-- Definición del servicio BreadcrumbListener -->
<service id="APY\BreadcrumbTrailBundle\EventListener\BreadcrumbListener">
<argument type="service" id="Doctrine\Common\Annotations\AnnotationReader" />
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" priority="-1" />
</service>
</services>
</container>
Loading