Skip to content

Commit

Permalink
Allow using Symfony 5.x, even with the 3.x branch of this bundle (#19)
Browse files Browse the repository at this point in the history
This brings the pending changes from #17 and #18 to the 3.x branch of this bundle. Hopefully, it eases migration a bit.

Technically, it will be necessary to be at Symfony ^4.4 before the release containing these changes here can be obtained. But, being at Symfony 4.4 before attempting the migration to 5.0 should be the usual upgrade path.
  • Loading branch information
mpdude authored Apr 8, 2022
1 parent fdaa02f commit 3858c53
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Build/TreeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use Psr\Log\LoggerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\Config\ConfigCacheInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Stopwatch\StopwatchEvent;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Webfactory\Bundle\NavigationBundle\Event\TreeInitializedEvent;
use Webfactory\Bundle\NavigationBundle\Tree\Tree;

Expand Down
4 changes: 3 additions & 1 deletion Command/DumpTreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function configure()
->addOption('short', null, InputOption::VALUE_NONE, 'Kompakte Ausgabe');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->shortOutput = $input->getOption('short');

Expand All @@ -28,6 +28,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
foreach ($roots as $root) {
$this->dumpNode($root, $output);
}

return 0;
}

private function dumpNode(Node $n, OutputInterface $output, $depth = 0)
Expand Down
4 changes: 3 additions & 1 deletion Command/LookupNodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function configure()
->addArgument('queryParam', InputArgument::IS_ARRAY, 'One or several key=value pairs to search in the node index');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$provisions = [];

Expand All @@ -35,5 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$output->writeln('No matching node found.');
}

return 0;
}
}
2 changes: 1 addition & 1 deletion Event/TreeInitializedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Webfactory\Bundle\NavigationBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Webfactory\Bundle\NavigationBundle\Tree\Tree;

class TreeInitializedEvent extends Event
Expand Down
23 changes: 15 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,24 @@

"require": {
"php": "^7.2",
"symfony/config": "^2.8|^3.4|^4.0",
"symfony/console": "^2.8|^3.4|^4.0",
"symfony/dependency-injection": "^3.4|^4.0",
"symfony/event-dispatcher": "^4.3",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/http-foundation": "^2.8|^3.4|^4.0",
"symfony/http-kernel": "^2.8|^3.4|^4.0",
"symfony/proxy-manager-bridge": "^2.8|^3.4|^4.0",
"psr/container": "^1.0",
"psr/log": "^1.1",
"symfony/config": "^4.0|^5.0",
"symfony/console": "^4.0|^5.0",
"symfony/dependency-injection": "^4.2|^5.0",
"symfony/event-dispatcher": "^4.3|^5.0",
"symfony/event-dispatcher-contracts": "^1.0|^2.0",
"symfony/http-foundation": "^4.0|^5.0",
"symfony/http-kernel": "^4.0|^5.0",
"symfony/proxy-manager-bridge": "^4.0|^5.0",
"symfony/service-contracts": "^1.0|^2.0",
"twig/twig": "^1.36|^2.6"
},

"require-dev": {
"symfony/stopwatch": "^5.4"
},

"suggest": {
"symfony/stopwatch": "um zu messen, wie lange der Aufbau des NavigationTree dauert",
"ocramius/proxy-manager": "damit der NavigationTree wirklich lazy erzeugt wird"
Expand Down

0 comments on commit 3858c53

Please sign in to comment.