diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 948274a2..f226ca39 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,8 +37,6 @@ jobs: - description: 'Lowest deps' php: '8.0' composer_option: '--prefer-lowest' - env: - SYMFONY_DEPRECATIONS_HELPER: max[self]=0 - description: 'Symfony 5.4' php: '8.0' symfony: 5.4.* @@ -59,7 +57,7 @@ jobs: with: php-version: ${{ matrix.php }} - run: | - sed -ri 's/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony }}'"/' composer.json; + sed -ri 's/"symfony\/(expression-language|framework-bundle|templating)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony }}'"/' composer.json; if: matrix.symfony - run: composer config minimum-stability dev if: matrix.dev diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a8d1799..4889e875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Increased minimum PHP version to 8.0 (to be consistent with KnpMenu 3.4) * Dropped support for Symfony 3 and 4 +* Deprecated use of Symfony templating component ## 3.2.0 (2021-10-30) diff --git a/composer.json b/composer.json index b98cc0cf..7029f1e2 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "require": { "php": "^8.0", "knplabs/knp-menu": "^3.3", + "symfony/deprecation-contracts": "^2.5 | ^3.3", "symfony/framework-bundle": "^5.4 | ^6.0" }, "require-dev": { diff --git a/docs/index.rst b/docs/index.rst index 4d54bb19..c64ec68d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -63,7 +63,8 @@ You can define these options if you need to change them: # use "twig: false" to disable the Twig extension and the TwigRenderer twig: template: KnpMenuBundle::menu.html.twig - # if true, enables the helper for PHP templates + # if true, enables the helper for PHP templates + # support for templating is deprecated, it will be removed in next major version templating: false # the renderer to use, list is also available by default default_renderer: twig @@ -76,7 +77,7 @@ You can define these options if you need to change them: xmlns:knp-menu="http://knplabs.com/schema/dic/menu"> [ 'template' => 'KnpMenuBundle::menu.html.twig' ], - // if true, enabled the helper for PHP templates + // if true, enable the helper for PHP templates (deprecated) 'templating' => false, // the renderer to use, list is also available by default 'default_renderer' => 'twig', diff --git a/src/DependencyInjection/KnpMenuExtension.php b/src/DependencyInjection/KnpMenuExtension.php index c9502366..867b1df2 100644 --- a/src/DependencyInjection/KnpMenuExtension.php +++ b/src/DependencyInjection/KnpMenuExtension.php @@ -36,6 +36,7 @@ public function load(array $configs, ContainerBuilder $container): void $container->setParameter('knp_menu.renderer.twig.template', $config['twig']['template']); } if ($config['templating']) { + trigger_deprecation('knplabs/knp-menu-bundle', '3.3', 'Using the templating component is deprecated since version 3.3, this option will be removed in version 4.'); $loader->load('templating.xml'); } diff --git a/tests/DependencyInjection/KnpMenuExtensionTest.php b/tests/DependencyInjection/KnpMenuExtensionTest.php index 26d46f78..e5145c80 100644 --- a/tests/DependencyInjection/KnpMenuExtensionTest.php +++ b/tests/DependencyInjection/KnpMenuExtensionTest.php @@ -47,7 +47,10 @@ public function testDisableTwig(): void $this->assertFalse($container->hasDefinition('knp_menu.renderer.twig')); } - public function testEnsablePhpTemplates(): void + /** + * @group legacy + */ + public function testEnablePhpTemplates(): void { $container = new ContainerBuilder(); $loader = new KnpMenuExtension(); diff --git a/tests/Provider/BuilderAliasProviderTest.php b/tests/Provider/BuilderAliasProviderTest.php index 25a394ae..9a0edb4b 100644 --- a/tests/Provider/BuilderAliasProviderTest.php +++ b/tests/Provider/BuilderAliasProviderTest.php @@ -5,7 +5,7 @@ use Knp\Bundle\MenuBundle\Provider\BuilderAliasProvider; use Knp\Bundle\MenuBundle\Tests\Stubs\TestKernel; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; class BuilderAliasProviderTest extends TestCase { @@ -44,6 +44,9 @@ public function testGetExistentMenu(): void public function testGetContainerAwareMenu(): void { + if (!interface_exists(ContainerAwareInterface::class)) { + self::markTestSkipped('missing interface'); + } $item = $this->getMockBuilder('Knp\Menu\ItemInterface')->getMock(); // mock the factory to return a set value when the builder creates the menu $factory = $this->getMockBuilder('Knp\Menu\FactoryInterface')->getMock(); diff --git a/tests/Templating/MenuHelperTest.php b/tests/Templating/MenuHelperTest.php index c85d461e..825af0dd 100644 --- a/tests/Templating/MenuHelperTest.php +++ b/tests/Templating/MenuHelperTest.php @@ -10,6 +10,7 @@ * Test for MenuHelper class. * * @author Leszek Prabucki + * @group legacy */ class MenuHelperTest extends TestCase {