From 6334d2e40f9476c768da45e233d06de29549a854 Mon Sep 17 00:00:00 2001 From: Ilyas Salikhov Date: Mon, 30 Sep 2024 21:23:38 +0300 Subject: [PATCH 1/3] Removed support of sensio/framework-extra-bundle --- .../Handler/SensioFrameworkExtraHandler.php | 32 --------------- Resources/config/services.xml | 5 --- Resources/doc/other-bundle-annotations.rst | 1 - Tests/Extractor/ApiDocExtractorTest.php | 13 ------- .../SensioFrameworkExtraHandlerTest.php | 39 ------------------- Tests/Fixtures/Controller/TestController.php | 6 --- Tests/Formatter/testFormat-result.php | 3 +- Tests/Formatter/testFormat-result_1.php | 3 +- composer.json | 1 - 9 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 Extractor/Handler/SensioFrameworkExtraHandler.php delete mode 100644 Tests/Extractor/Handler/SensioFrameworkExtraHandlerTest.php diff --git a/Extractor/Handler/SensioFrameworkExtraHandler.php b/Extractor/Handler/SensioFrameworkExtraHandler.php deleted file mode 100644 index c8997f7c8..000000000 --- a/Extractor/Handler/SensioFrameworkExtraHandler.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * 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); - } - } - } -} diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 323065402..321420aca 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -11,7 +11,6 @@ Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler - Nelmio\ApiDocBundle\Extractor\Handler\SensioFrameworkExtraHandler Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler Nelmio\ApiDocBundle\Parser\CollectionParser @@ -53,10 +52,6 @@ - - - - diff --git a/Resources/doc/other-bundle-annotations.rst b/Resources/doc/other-bundle-annotations.rst index 044781200..dd1fbfc62 100644 --- a/Resources/doc/other-bundle-annotations.rst +++ b/Resources/doc/other-bundle-annotations.rst @@ -8,7 +8,6 @@ This bundle will get information from the following other annotations: (when strict parameter is true), ``filters`` (when strict is false) * ``@JMS\SecurityExtraBundle\Annotation\Secure`` - set ``authentication`` to true, ``authenticationRoles`` to the given roles -* ``@Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache`` - set ``cache`` PHPDoc ------ diff --git a/Tests/Extractor/ApiDocExtractorTest.php b/Tests/Extractor/ApiDocExtractorTest.php index 0bf31addd..7b1ab8ad1 100644 --- a/Tests/Extractor/ApiDocExtractorTest.php +++ b/Tests/Extractor/ApiDocExtractorTest.php @@ -224,19 +224,6 @@ public function testGetWithAuthentication() $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() { $container = $this->getContainer(); diff --git a/Tests/Extractor/Handler/SensioFrameworkExtraHandlerTest.php b/Tests/Extractor/Handler/SensioFrameworkExtraHandlerTest.php deleted file mode 100644 index ce1682bbd..000000000 --- a/Tests/Extractor/Handler/SensioFrameworkExtraHandlerTest.php +++ /dev/null @@ -1,39 +0,0 @@ - -* -* 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()); - } -} diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index 38200dd03..96287746c 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -15,12 +15,8 @@ use FOS\RestBundle\Controller\Annotations\RequestParam; use Nelmio\ApiDocBundle\Annotation\ApiDoc; 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\Validator\Constraints as Assert; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; class TestController { @@ -219,7 +215,6 @@ public function authenticatedAction() /** * @ApiDoc() - * @Cache(maxage=60, public=1) */ public function zCachedAction() { @@ -227,7 +222,6 @@ public function zCachedAction() /** * @ApiDoc() - * @Security("has_role('ROLE_USER')") */ public function zSecuredAction() { diff --git a/Tests/Formatter/testFormat-result.php b/Tests/Formatter/testFormat-result.php index 92f44e19e..49552a045 100644 --- a/Tests/Formatter/testFormat-result.php +++ b/Tests/Formatter/testFormat-result.php @@ -2605,7 +2605,6 @@ array ( 'method' => 'POST', 'uri' => '/zcached', - 'cache' => 60, 'https' => false, 'authentication' => false, 'authenticationRoles' => @@ -2618,7 +2617,7 @@ 'method' => 'POST', 'uri' => '/zsecured', 'https' => false, - 'authentication' => true, + 'authentication' => false, 'authenticationRoles' => array ( ), diff --git a/Tests/Formatter/testFormat-result_1.php b/Tests/Formatter/testFormat-result_1.php index 798b905c2..5380106d1 100644 --- a/Tests/Formatter/testFormat-result_1.php +++ b/Tests/Formatter/testFormat-result_1.php @@ -2448,7 +2448,6 @@ array ( 'method' => 'POST', 'uri' => '/zcached', - 'cache' => 60, 'https' => false, 'authentication' => false, 'authenticationRoles' => @@ -2461,7 +2460,7 @@ 'method' => 'POST', 'uri' => '/zsecured', 'https' => false, - 'authentication' => true, + 'authentication' => false, 'authenticationRoles' => array ( ), diff --git a/composer.json b/composer.json index 865536d6a..171347fe1 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,6 @@ "jms/serializer": "~3.15.0", "jms/serializer-bundle": "4.1.0", "phpunit/phpunit": "~9.5", - "sensio/framework-extra-bundle": "^6.2", "symfony/asset": "^5.0|^6.0", "symfony/browser-kit": "^5.0|^6.0", "symfony/translation": "^5.0|^6.0", From 4d4758cb40dbb45eccb8e7eb904c89ca323454eb Mon Sep 17 00:00:00 2001 From: Ilyas Salikhov Date: Mon, 30 Sep 2024 21:26:44 +0300 Subject: [PATCH 2/3] fix jms/serializer dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 171347fe1..56cb22e88 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,8 @@ }, "require-dev": { "friendsofsymfony/rest-bundle": "^3.7", - "jms/serializer": "~3.15.0", - "jms/serializer-bundle": "4.1.0", + "jms/serializer": "^3.15", + "jms/serializer-bundle": "^4.1|^5.4", "phpunit/phpunit": "~9.5", "symfony/asset": "^5.0|^6.0", "symfony/browser-kit": "^5.0|^6.0", From 45d1ed1735598d546415dfe92b74176160563045 Mon Sep 17 00:00:00 2001 From: Ilyas Salikhov Date: Mon, 30 Sep 2024 21:33:21 +0300 Subject: [PATCH 3/3] add doctrine/annotations as dev dependency --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 56cb22e88..662e71208 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "michelf/php-markdown": "~1.4" }, "require-dev": { + "doctrine/annotations": "^1.0", "friendsofsymfony/rest-bundle": "^3.7", "jms/serializer": "^3.15", "jms/serializer-bundle": "^4.1|^5.4",