Removed support of sensio/framework-extra-bundle

This commit is contained in:
Ilyas Salikhov 2024-09-30 21:23:38 +03:00
parent b72dfea35c
commit 6334d2e40f
9 changed files with 2 additions and 101 deletions

View File

@ -1,32 +0,0 @@
<?php
/*
* This file is part of the NelmioApiDocBundle.
*
* (c) Nelmio <hello@nelm.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Extractor\Handler;
use Nelmio\ApiDocBundle\Extractor\HandlerInterface;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\Routing\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
class SensioFrameworkExtraHandler implements HandlerInterface
{
public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method)
{
foreach ($annotations as $annot) {
if ($annot instanceof Cache) {
$annotation->setCache($annot->getMaxAge());
} elseif ($annot instanceof Security) {
$annotation->setAuthentication(true);
}
}
}
}

View File

@ -11,7 +11,6 @@
<parameter key="nelmio_api_doc.extractor.handler.fos_rest.class">Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler</parameter> <parameter key="nelmio_api_doc.extractor.handler.fos_rest.class">Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler</parameter>
<parameter key="nelmio_api_doc.extractor.handler.jms_security.class">Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler</parameter> <parameter key="nelmio_api_doc.extractor.handler.jms_security.class">Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler</parameter>
<parameter key="nelmio_api_doc.extractor.handler.sensio_framework_extra.class">Nelmio\ApiDocBundle\Extractor\Handler\SensioFrameworkExtraHandler</parameter>
<parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter> <parameter key="nelmio_api_doc.extractor.handler.phpdoc.class">Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler</parameter>
<parameter key="nelmio_api_doc.parser.collection_parser.class">Nelmio\ApiDocBundle\Parser\CollectionParser</parameter> <parameter key="nelmio_api_doc.parser.collection_parser.class">Nelmio\ApiDocBundle\Parser\CollectionParser</parameter>
@ -53,10 +52,6 @@
<tag name="nelmio_api_doc.extractor.handler"/> <tag name="nelmio_api_doc.extractor.handler"/>
</service> </service>
<service id="nelmio_api_doc.extractor.handler.sensio_framework_extra" class="%nelmio_api_doc.extractor.handler.sensio_framework_extra.class%" public="false">
<tag name="nelmio_api_doc.extractor.handler"/>
</service>
<service id="nelmio_api_doc.extractor.handler.phpdoc" class="%nelmio_api_doc.extractor.handler.phpdoc.class%" public="false"> <service id="nelmio_api_doc.extractor.handler.phpdoc" class="%nelmio_api_doc.extractor.handler.phpdoc.class%" public="false">
<argument type="service" id="nelmio_api_doc.doc_comment_extractor" /> <argument type="service" id="nelmio_api_doc.doc_comment_extractor" />
<tag name="nelmio_api_doc.extractor.handler"/> <tag name="nelmio_api_doc.extractor.handler"/>

View File

@ -8,7 +8,6 @@ This bundle will get information from the following other annotations:
(when strict parameter is true), ``filters`` (when strict is false) (when strict parameter is true), ``filters`` (when strict is false)
* ``@JMS\SecurityExtraBundle\Annotation\Secure`` - set ``authentication`` to true, * ``@JMS\SecurityExtraBundle\Annotation\Secure`` - set ``authentication`` to true,
``authenticationRoles`` to the given roles ``authenticationRoles`` to the given roles
* ``@Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache`` - set ``cache``
PHPDoc PHPDoc
------ ------

View File

@ -224,19 +224,6 @@ class ApiDocExtractorTest extends WebTestCase
$this->assertCount(2, $annotation->getAuthenticationRoles()); $this->assertCount(2, $annotation->getAuthenticationRoles());
} }
public function testGetWithCache()
{
$container = $this->getContainer();
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zCachedAction', 'test_route_23');
$this->assertNotNull($annotation);
$this->assertEquals(
60,
$annotation->getCache()
);
}
public function testGetWithDeprecated() public function testGetWithDeprecated()
{ {
$container = $this->getContainer(); $container = $this->getContainer();

View File

@ -1,39 +0,0 @@
<?php
/*
* This file is part of the NelmioApiDocBundle.
*
* (c) Nelmio <hello@nelm.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Extractor;
use Nelmio\ApiDocBundle\Tests\WebTestCase;
class SensioFrameworkExtraHandlerTest extends WebTestCase
{
public function testCacheAnnotation()
{
$container = $this->getContainer();
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zCachedAction', 'test_route_23');
$this->assertNotNull($annotation);
$this->assertSame(60, $annotation->getCache());
}
public function testSecurityAnnotation()
{
$container = $this->getContainer();
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::zSecuredAction', 'test_route_24');
$this->assertNotNull($annotation);
$this->assertTrue($annotation->getAuthentication());
}
}

View File

@ -15,12 +15,8 @@ use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RequestParam; use FOS\RestBundle\Controller\Annotations\RequestParam;
use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Nelmio\ApiDocBundle\Tests\Fixtures\DependencyTypePath; use Nelmio\ApiDocBundle\Tests\Fixtures\DependencyTypePath;
use Nelmio\ApiDocBundle\Tests\Fixtures\RequestParamHelper;
use Nelmio\ApiDocBundle\Util\LegacyFormHelper;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
class TestController class TestController
{ {
@ -219,7 +215,6 @@ class TestController
/** /**
* @ApiDoc() * @ApiDoc()
* @Cache(maxage=60, public=1)
*/ */
public function zCachedAction() public function zCachedAction()
{ {
@ -227,7 +222,6 @@ class TestController
/** /**
* @ApiDoc() * @ApiDoc()
* @Security("has_role('ROLE_USER')")
*/ */
public function zSecuredAction() public function zSecuredAction()
{ {

View File

@ -2605,7 +2605,6 @@ With multiple lines.',
array ( array (
'method' => 'POST', 'method' => 'POST',
'uri' => '/zcached', 'uri' => '/zcached',
'cache' => 60,
'https' => false, 'https' => false,
'authentication' => false, 'authentication' => false,
'authenticationRoles' => 'authenticationRoles' =>
@ -2618,7 +2617,7 @@ With multiple lines.',
'method' => 'POST', 'method' => 'POST',
'uri' => '/zsecured', 'uri' => '/zsecured',
'https' => false, 'https' => false,
'authentication' => true, 'authentication' => false,
'authenticationRoles' => 'authenticationRoles' =>
array ( array (
), ),

View File

@ -2448,7 +2448,6 @@ With multiple lines.',
array ( array (
'method' => 'POST', 'method' => 'POST',
'uri' => '/zcached', 'uri' => '/zcached',
'cache' => 60,
'https' => false, 'https' => false,
'authentication' => false, 'authentication' => false,
'authenticationRoles' => 'authenticationRoles' =>
@ -2461,7 +2460,7 @@ With multiple lines.',
'method' => 'POST', 'method' => 'POST',
'uri' => '/zsecured', 'uri' => '/zsecured',
'https' => false, 'https' => false,
'authentication' => true, 'authentication' => false,
'authenticationRoles' => 'authenticationRoles' =>
array ( array (
), ),

View File

@ -27,7 +27,6 @@
"jms/serializer": "~3.15.0", "jms/serializer": "~3.15.0",
"jms/serializer-bundle": "4.1.0", "jms/serializer-bundle": "4.1.0",
"phpunit/phpunit": "~9.5", "phpunit/phpunit": "~9.5",
"sensio/framework-extra-bundle": "^6.2",
"symfony/asset": "^5.0|^6.0", "symfony/asset": "^5.0|^6.0",
"symfony/browser-kit": "^5.0|^6.0", "symfony/browser-kit": "^5.0|^6.0",
"symfony/translation": "^5.0|^6.0", "symfony/translation": "^5.0|^6.0",