mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Re-add symfony 2.8 support
This commit is contained in:
parent
af3b77eb9f
commit
9b677f2ff3
@ -12,7 +12,6 @@
|
||||
namespace Nelmio\ApiDocBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class AddDescribersPass implements CompilerPassInterface
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Nelmio\ApiDocBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class AddRouteDescribersPass implements CompilerPassInterface
|
||||
|
55
DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
Normal file
55
DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Nelmio\ApiDocBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Trait that allows a generic method to find and sort service by priority option in the tag.
|
||||
*
|
||||
* @author Iltar van der Berg <kjarli@gmail.com>
|
||||
*
|
||||
* @internal extracted from Symfony, to keep sf 2.8 support.
|
||||
*/
|
||||
trait PriorityTaggedServiceTrait
|
||||
{
|
||||
/**
|
||||
* Finds all services with the given tag name and order them by their priority.
|
||||
*
|
||||
* The order of additions must be respected for services having the same priority,
|
||||
* and knowing that the \SplPriorityQueue class does not respect the FIFO method,
|
||||
* we should not use this class.
|
||||
*
|
||||
* @see https://bugs.php.net/bug.php?id=53710
|
||||
* @see https://bugs.php.net/bug.php?id=60926
|
||||
*
|
||||
* @param string $tagName
|
||||
* @param ContainerBuilder $container
|
||||
*
|
||||
* @return Reference[]
|
||||
*/
|
||||
private function findAndSortTaggedServices($tagName, ContainerBuilder $container)
|
||||
{
|
||||
$services = array();
|
||||
foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tags) {
|
||||
foreach ($tags as $attributes) {
|
||||
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
|
||||
$services[$priority][] = new Reference($serviceId);
|
||||
}
|
||||
}
|
||||
if ($services) {
|
||||
krsort($services);
|
||||
$services = call_user_func_array('array_merge', $services);
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
}
|
@ -16,17 +16,17 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "~7.0|~7.1",
|
||||
"symfony/framework-bundle": "^3.2",
|
||||
"symfony/framework-bundle": "^2.8|^3.0",
|
||||
"exsyst/swagger": "~0.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/twig-bundle": "^3.2",
|
||||
"symfony/console": "^3.2",
|
||||
"symfony/config": "^3.2",
|
||||
"symfony/validator": "^3.2",
|
||||
"symfony/property-access": "^3.2",
|
||||
"symfony/browser-kit": "^3.2",
|
||||
"symfony/cache": "^3.2",
|
||||
"symfony/twig-bundle": "^2.8|^3.0",
|
||||
"symfony/console": "^2.8|^3.0",
|
||||
"symfony/config": "^2.8|^3.0",
|
||||
"symfony/validator": "^2.8|^3.0",
|
||||
"symfony/property-access": "^2.8|^3.0",
|
||||
"symfony/browser-kit": "^2.8|^3.0",
|
||||
"symfony/cache": "^3.1",
|
||||
"symfony/phpunit-bridge": "^3.2",
|
||||
"sensio/framework-extra-bundle": "^3.0",
|
||||
"phpunit/phpunit": "^5.4",
|
||||
|
Loading…
x
Reference in New Issue
Block a user