From 72f4d2e10e2fdccf4a622a56f0b8217c965b2d0d Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Sat, 16 Oct 2021 10:07:29 +0200 Subject: [PATCH 1/2] [AllBundles] Cleanup of symfony 3.4 compatibility layers --- .../DependencyInjection/Configuration.php | 7 +--- .../Event/AdaptSimpleFormEvent.php | 3 +- src/Kunstmaan/AdminBundle/Event/BcEvent.php | 26 ------------- .../Event/ChangePasswordSuccessEvent.php | 3 +- .../Event/DeepCloneAndSaveEvent.php | 4 +- .../Helper/Security/Acl/AclHelper.php | 18 ++------- .../Helper/Security/Acl/AclNativeHelper.php | 18 ++------- .../Helper/Security/Acl/AclHelperTest.php | 15 ++------ .../Security/Acl/AclNativeHelperTest.php | 15 ++------ .../DependencyInjection/Configuration.php | 8 +--- .../AdminListBundle/Event/AdminListEvent.php | 4 +- .../DependencyInjection/Configuration.php | 10 +---- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../KunstmaanFormExtension.php | 2 +- .../FormBundle/Event/SubmissionEvent.php | 4 +- .../KunstmaanFormExtensionTest.php | 6 +-- .../Command/InstallCommand.php | 38 ++----------------- .../DataFixtures/ORM/UserFixtures.php | 7 ---- .../Generator/SearchPageGenerator.php | 2 +- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 9 +---- .../MediaBundle/Helper/File/PdfHandler.php | 2 +- .../DependencyInjection/ConfigurationTest.php | 6 +-- .../Tests/Utils/SymfonyVersionTest.php | 26 ------------- .../MediaBundle/Utils/SymfonyVersion.php | 35 ----------------- .../DependencyInjection/Configuration.php | 10 +---- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../NodeBundle/Event/AdaptFormEvent.php | 4 +- .../Event/ConfigureActionMenuEvent.php | 4 +- src/Kunstmaan/NodeBundle/Event/NodeEvent.php | 4 +- .../Event/PostNodeDuplicateEvent.php | 4 +- .../Event/PreNodeDuplicateEvent.php | 4 +- .../NodeBundle/Event/SlugSecurityEvent.php | 4 +- .../EventListener/RenderContextListener.php | 29 ++------------ .../DependencyInjection/Configuration.php | 7 +--- .../NodeSearchBundle/Event/IndexNodeEvent.php | 4 +- .../DependencyInjection/Configuration.php | 7 +--- .../PagePartBundle/Event/PagePartEvent.php | 4 +- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 10 +---- .../Event/PreSitemapIndexRenderEvent.php | 4 +- .../Event/PreSitemapRenderEvent.php | 4 +- .../DependencyInjection/Configuration.php | 10 +---- .../DependencyInjection/Configuration.php | 7 +--- .../KunstmaanTranslatorExtension.php | 14 +------ .../Command/Importer/ImportCommandHandler.php | 10 ++--- .../Importer/ImportCommandHandlerTest.php | 23 ----------- .../DependencyInjection/Configuration.php | 7 +--- .../Event/AfterUserDeleteEvent.php | 4 +- .../DependencyInjection/Configuration.php | 7 +--- .../DependencyInjection/Configuration.php | 7 +--- .../VotingBundle/Event/AbstractVoteEvent.php | 23 +---------- 59 files changed, 90 insertions(+), 470 deletions(-) delete mode 100644 src/Kunstmaan/AdminBundle/Event/BcEvent.php delete mode 100644 src/Kunstmaan/MediaBundle/Tests/Utils/SymfonyVersionTest.php delete mode 100644 src/Kunstmaan/MediaBundle/Utils/SymfonyVersion.php diff --git a/src/Kunstmaan/AdminBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/AdminBundle/DependencyInjection/Configuration.php index ca19fedbff..09e92458cc 100644 --- a/src/Kunstmaan/AdminBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/AdminBundle/DependencyInjection/Configuration.php @@ -18,12 +18,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_admin'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_admin'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->fixXmlConfig('admin_locale') diff --git a/src/Kunstmaan/AdminBundle/Event/AdaptSimpleFormEvent.php b/src/Kunstmaan/AdminBundle/Event/AdaptSimpleFormEvent.php index 23ce1c85b4..1aca54b0f5 100644 --- a/src/Kunstmaan/AdminBundle/Event/AdaptSimpleFormEvent.php +++ b/src/Kunstmaan/AdminBundle/Event/AdaptSimpleFormEvent.php @@ -4,8 +4,9 @@ use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane; use Symfony\Component\HttpFoundation\Request; +use Symfony\Contracts\EventDispatcher\Event; -final class AdaptSimpleFormEvent extends BcEvent +final class AdaptSimpleFormEvent extends Event { /** * @var Request diff --git a/src/Kunstmaan/AdminBundle/Event/BcEvent.php b/src/Kunstmaan/AdminBundle/Event/BcEvent.php deleted file mode 100644 index b1af2e375e..0000000000 --- a/src/Kunstmaan/AdminBundle/Event/BcEvent.php +++ /dev/null @@ -1,26 +0,0 @@ -= 4.3 - * - * @internal - */ - abstract class BcEvent extends Event - { - } -} diff --git a/src/Kunstmaan/AdminBundle/Event/ChangePasswordSuccessEvent.php b/src/Kunstmaan/AdminBundle/Event/ChangePasswordSuccessEvent.php index 2b0fc0e6b3..8639fd8d2e 100644 --- a/src/Kunstmaan/AdminBundle/Event/ChangePasswordSuccessEvent.php +++ b/src/Kunstmaan/AdminBundle/Event/ChangePasswordSuccessEvent.php @@ -4,8 +4,9 @@ use Kunstmaan\AdminBundle\Entity\UserInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; -final class ChangePasswordSuccessEvent extends BcEvent +final class ChangePasswordSuccessEvent extends Event { /** @var UserInterface */ private $user; diff --git a/src/Kunstmaan/AdminBundle/Event/DeepCloneAndSaveEvent.php b/src/Kunstmaan/AdminBundle/Event/DeepCloneAndSaveEvent.php index 758deec826..13c77d408f 100644 --- a/src/Kunstmaan/AdminBundle/Event/DeepCloneAndSaveEvent.php +++ b/src/Kunstmaan/AdminBundle/Event/DeepCloneAndSaveEvent.php @@ -2,10 +2,12 @@ namespace Kunstmaan\AdminBundle\Event; +use Symfony\Contracts\EventDispatcher\Event; + /** * This event wil be used to pass metadata when the deep clone event is triggered. */ -final class DeepCloneAndSaveEvent extends BcEvent +final class DeepCloneAndSaveEvent extends Event { /** * @var mixed diff --git a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclHelper.php b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclHelper.php index 81edba9f8a..85542a5940 100644 --- a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclHelper.php +++ b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclHelper.php @@ -148,12 +148,7 @@ private function getPermittedAclIdsSQLForUser(Query $query): string $user = null; if (!\is_null($token)) { $user = $token->getUser(); - if (method_exists($this->roleHierarchy, 'getReachableRoleNames')) { - $userRoles = $this->roleHierarchy->getReachableRoleNames($token->getRoleNames()); - } else { - // Symfony 3.4 compatibility - $userRoles = $this->roleHierarchy->getReachableRoles($token->getRoles()); - } + $userRoles = $this->roleHierarchy->getReachableRoleNames($token->getRoleNames()); } // Security context does not provide anonymous role automatically. @@ -161,15 +156,8 @@ private function getPermittedAclIdsSQLForUser(Query $query): string foreach ($userRoles as $role) { // The reason we ignore this is because by default FOSUserBundle adds ROLE_USER for every user - if (is_string($role)) { - if ($role !== 'ROLE_USER') { - $uR[] = $databasePlatform->quoteStringLiteral($role); - } - } else { - // Symfony 3.4 compatibility - if ($role->getRole() !== 'ROLE_USER') { - $uR[] = $databasePlatform->quoteStringLiteral($role->getRole()); - } + if ($role !== 'ROLE_USER') { + $uR[] = $databasePlatform->quoteStringLiteral($role); } } $uR = array_unique($uR); diff --git a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclNativeHelper.php b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclNativeHelper.php index 930ea3dcd0..b99162cef9 100644 --- a/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclNativeHelper.php +++ b/src/Kunstmaan/AdminBundle/Helper/Security/Acl/AclNativeHelper.php @@ -83,12 +83,7 @@ public function apply(QueryBuilder $queryBuilder, PermissionDefinition $permissi $user = null; if (!\is_null($token)) { $user = $token->getUser(); - if (method_exists($this->roleHierarchy, 'getReachableRoleNames')) { - $userRoles = $this->roleHierarchy->getReachableRoleNames($token->getRoleNames()); - } else { - // Symfony 3.4 compatibility - $userRoles = $this->roleHierarchy->getReachableRoles($token->getRoles()); - } + $userRoles = $this->roleHierarchy->getReachableRoleNames($token->getRoleNames()); } // Security context does not provide anonymous role automatically. @@ -96,15 +91,8 @@ public function apply(QueryBuilder $queryBuilder, PermissionDefinition $permissi foreach ($userRoles as $role) { // The reason we ignore this is because by default FOSUserBundle adds ROLE_USER for every user - if (is_string($role)) { - if ($role !== 'ROLE_USER') { - $uR[] = $databasePlatform->quoteStringLiteral($role); - } - } else { - // Symfony 3.4 compatibility - if ($role->getRole() !== 'ROLE_USER') { - $uR[] = $databasePlatform->quoteStringLiteral($role->getRole()); - } + if ($role !== 'ROLE_USER') { + $uR[] = $databasePlatform->quoteStringLiteral($role); } } $uR = array_unique($uR); diff --git a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php index 843b645f25..234323d53b 100644 --- a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php @@ -316,17 +316,10 @@ public function testGetTokenStorage() private function getRoleMockData($anonymous = false) { - if (Kernel::VERSION_ID >= 40300) { - $rolesMethodName = 'getRoleNames'; - $reachableRolesMethodName = 'getReachableRoleNames'; - $roles = ['ROLE_KING']; - $allRoles = [$roles[0], 'ROLE_SUBJECT']; - } else { - $rolesMethodName = 'getRoles'; - $reachableRolesMethodName = 'getReachableRoles'; - $roles = $anonymous ? [] : [new Role('ROLE_KING')]; - $allRoles = $anonymous ? [] : [$roles[0], new Role('ROLE_SUBJECT')]; - } + $rolesMethodName = 'getRoleNames'; + $reachableRolesMethodName = 'getReachableRoleNames'; + $roles = $anonymous ? [] : ['ROLE_KING']; + $allRoles = $anonymous ? [] : [$roles[0], 'ROLE_SUBJECT']; return [ $rolesMethodName, diff --git a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php index cee9b38224..9b54d1038c 100644 --- a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php @@ -191,17 +191,10 @@ public function testGetTokenStorage() private function getRoleMockData($anonymous = false) { - if (Kernel::VERSION_ID >= 40300) { - $rolesMethodName = 'getRoleNames'; - $reachableRolesMethodName = 'getReachableRoleNames'; - $roles = ['ROLE_KING']; - $allRoles = [$roles[0], 'ROLE_SUBJECT']; - } else { - $rolesMethodName = 'getRoles'; - $reachableRolesMethodName = 'getReachableRoles'; - $roles = $anonymous ? [] : [new Role('ROLE_KING')]; - $allRoles = $anonymous ? [] : [$roles[0], new Role('ROLE_SUBJECT')]; - } + $rolesMethodName = 'getRoleNames'; + $reachableRolesMethodName = 'getReachableRoleNames'; + $roles = $anonymous ? [] : ['ROLE_KING']; + $allRoles = $anonymous ? [] : [$roles[0], 'ROLE_SUBJECT']; return [ $rolesMethodName, diff --git a/src/Kunstmaan/AdminListBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/AdminListBundle/DependencyInjection/Configuration.php index 68e68ed38a..fae48c4e55 100644 --- a/src/Kunstmaan/AdminListBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/AdminListBundle/DependencyInjection/Configuration.php @@ -13,14 +13,8 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_k_admin_list'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_k_admin_list'); - } + $rootNode = $treeBuilder->getRootNode(); - /* @var ArrayNodeDefinition $pages */ $rootNode ->children() ->arrayNode('lock') diff --git a/src/Kunstmaan/AdminListBundle/Event/AdminListEvent.php b/src/Kunstmaan/AdminListBundle/Event/AdminListEvent.php index 8af42e0c8d..8fc3a6e5ec 100644 --- a/src/Kunstmaan/AdminListBundle/Event/AdminListEvent.php +++ b/src/Kunstmaan/AdminListBundle/Event/AdminListEvent.php @@ -2,12 +2,12 @@ namespace Kunstmaan\AdminListBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; -final class AdminListEvent extends BcEvent +final class AdminListEvent extends Event { /** * @var object diff --git a/src/Kunstmaan/ArticleBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/ArticleBundle/DependencyInjection/Configuration.php index 35ce79a911..ef96856eb2 100644 --- a/src/Kunstmaan/ArticleBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/ArticleBundle/DependencyInjection/Configuration.php @@ -12,14 +12,6 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder('kunstmaan_article'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_article'); - } - - return $treeBuilder; + return new TreeBuilder('kunstmaan_article'); } } diff --git a/src/Kunstmaan/ConfigBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/ConfigBundle/DependencyInjection/Configuration.php index 36f2021df9..c1163c1e64 100644 --- a/src/Kunstmaan/ConfigBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/ConfigBundle/DependencyInjection/Configuration.php @@ -14,12 +14,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_config'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_config'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/DashboardBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/DashboardBundle/DependencyInjection/Configuration.php index 4f58c08a67..4a5bed63e5 100644 --- a/src/Kunstmaan/DashboardBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/DashboardBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_dashboard'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_dashboard'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/FixturesBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/FixturesBundle/DependencyInjection/Configuration.php index 1d65e29050..bd28531574 100644 --- a/src/Kunstmaan/FixturesBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/FixturesBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_fixtures'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_fixtures'); - } + $rootNode = $treeBuilder->getRootNode(); return $treeBuilder; } diff --git a/src/Kunstmaan/FormBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/FormBundle/DependencyInjection/Configuration.php index c177c76853..3ac7f10549 100644 --- a/src/Kunstmaan/FormBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/FormBundle/DependencyInjection/Configuration.php @@ -15,12 +15,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_form'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_form'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php b/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php index ae023e0979..1d878bf879 100644 --- a/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php +++ b/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php @@ -26,7 +26,7 @@ public function prepend(ContainerBuilder $container) { if (!$container->hasParameter('form_submission_rootdir')) { $container->setParameter('form_submission_rootdir', - sprintf('%s/%s/uploads/formsubmissions', $container->getParameter('kernel.project_dir'), Kernel::VERSION_ID >= 40000 ? 'public' : 'web')); + sprintf('%s/%s/uploads/formsubmissions', $container->getParameter('kernel.project_dir'), 'public')); } if (!$container->hasParameter('form_submission_webdir')) { diff --git a/src/Kunstmaan/FormBundle/Event/SubmissionEvent.php b/src/Kunstmaan/FormBundle/Event/SubmissionEvent.php index be5ceb3bfd..2308f675f8 100644 --- a/src/Kunstmaan/FormBundle/Event/SubmissionEvent.php +++ b/src/Kunstmaan/FormBundle/Event/SubmissionEvent.php @@ -2,11 +2,11 @@ namespace Kunstmaan\FormBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\FormBundle\Entity\FormSubmission; use Kunstmaan\FormBundle\Helper\FormPageInterface; +use Symfony\Contracts\EventDispatcher\Event; -final class SubmissionEvent extends BcEvent +final class SubmissionEvent extends Event { /** * @var FormSubmission diff --git a/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php b/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php index 638bb7cdd2..3de735cf71 100644 --- a/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php +++ b/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php @@ -22,10 +22,6 @@ public function testCorrectParametersHaveBeenSet() $this->container->setParameter('kernel.project_dir', '/somewhere/over/the/rainbow'); $this->load(); - $expectedFormSubmissionPath = '/somewhere/over/the/rainbow/web/uploads/formsubmissions'; - if (Kernel::VERSION_ID >= 40000) { - $expectedFormSubmissionPath = '/somewhere/over/the/rainbow/public/uploads/formsubmissions'; - } - $this->assertContainerBuilderHasParameter('form_submission_rootdir', $expectedFormSubmissionPath); + $this->assertContainerBuilderHasParameter('form_submission_rootdir', '/somewhere/over/the/rainbow/public/uploads/formsubmissions'); } } diff --git a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php index c5a30c93f2..ffcf48f530 100644 --- a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php +++ b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php @@ -85,28 +85,13 @@ protected function interact(InputInterface $input, OutputInterface $output) $outputStyle->writeln('Installing KunstmaanCms...'); $outputStyle->writeln($this->getKunstmaanLogo()); - if (Kernel::VERSION_ID >= 40000 && true !== $input->getOption('db-installed')) { + if (true !== $input->getOption('db-installed')) { $this->shouldStop = !$this->assistant->askConfirmation('We need access to your database. Are the database credentials setup properly? (y/n)', 'y'); if ($this->shouldStop) { return; } } - // Only ask namespace for Symfony 3 - if (Kernel::VERSION_ID < 40000 && null === $input->getOption('namespace')) { - $question = new Question( - $questionHelper->getQuestion('Bundle namespace', $input->getOption('namespace')), - $input->getOption('namespace') - ); - $question->setValidator([Validators::class, 'validateBundleNamespace']); - $namespace = $questionHelper->ask($input, $output, $question); - $input->setOption('namespace', $namespace); - $input->setOption('bundle-name', strtr($namespace, ['\\Bundle\\' => '', '\\' => ''])); - - $dir = $input->getOption('dir') ?: $this->projectDir . '/src'; - $input->setOption('dir', $dir); - } - if (null === $input->getOption('demosite')) { $demoSiteOption = $this->assistant->askConfirmation('Do you want to create a "demosite"? (y/n)', 'n'); $input->setOption('demosite', $demoSiteOption === true ? 'Yes' : 'No'); @@ -138,19 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $defaultSiteOptions['--demosite'] = true; } - if (Kernel::VERSION_ID < 40000) { - $defaultSiteOptions = ['--namespace' => $input->getOption('namespace')]; - - $this->executeCommand($output, 'kuma:generate:bundle', [ - '--namespace' => $input->getOption('namespace'), - '--dir' => $input->getOption('dir'), - '--bundle-name' => $input->getOption('bundle-name'), - ]); - } - - if (Kernel::VERSION_ID >= 40000) { - $this->executeCommand($output, 'kuma:generate:config'); - } + $this->executeCommand($output, 'kuma:generate:config'); $this ->executeCommand($output, 'kuma:generate:default-site', $defaultSiteOptions) @@ -162,12 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ; if ($input->getOption('create-tests') === 'Yes') { - $adminTestOptions = []; - if (Kernel::VERSION_ID < 40000) { - $adminTestOptions = ['--namespace' => $input->getOption('namespace')]; - } - - $this->executeCommand($output, 'kuma:generate:admin-tests', $adminTestOptions); + $this->executeCommand($output, 'kuma:generate:admin-tests', []); } $this->assistant->writeSection('Installation done. Enjoy your KunstmaanCMS', 'bg=green;fg=black'); diff --git a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php index 4b1da98bf1..c370585f4a 100644 --- a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php @@ -59,13 +59,6 @@ public function load(ObjectManager $manager) " > User 'admin' created with password '$password'", ]); - if (Kernel::VERSION_ID < 40000) { - $file = $this->container->get('kernel')->getProjectDir() . '/app/config/config.yml'; - $contents = file_get_contents($file); - $contents = str_replace('-adminpwd-', $password, $contents); - file_put_contents($file, $contents); - } - $this->setReference(self::REFERENCE_ADMIN_USER, $user1); } diff --git a/src/Kunstmaan/GeneratorBundle/Generator/SearchPageGenerator.php b/src/Kunstmaan/GeneratorBundle/Generator/SearchPageGenerator.php index 2c67471cbf..b017b3437c 100644 --- a/src/Kunstmaan/GeneratorBundle/Generator/SearchPageGenerator.php +++ b/src/Kunstmaan/GeneratorBundle/Generator/SearchPageGenerator.php @@ -78,7 +78,7 @@ public function generateTemplates( $rootDir, OutputInterface $output ) { - $dirPath = Kernel::VERSION_ID >= 40000 ? $this->rootDir . '/templates' : $bundle->getPath() . '/Resources/views'; + $dirPath = $this->rootDir . '/templates'; $fullSkeletonDir = $this->skeletonDir . '/Resources/views'; $this->filesystem->copy( diff --git a/src/Kunstmaan/LeadGenerationBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/LeadGenerationBundle/DependencyInjection/Configuration.php index 76f8e7cfa5..9b56cbacd5 100644 --- a/src/Kunstmaan/LeadGenerationBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/LeadGenerationBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_lead_generation'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_lead_generation'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php index 3678ccfdfb..86667a38b6 100644 --- a/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php @@ -16,12 +16,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_media'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_media'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() @@ -40,7 +35,7 @@ public function getConfigTreeBuilder() ->prototype('scalar')->end() ->end() ->scalarNode('web_root') - ->defaultValue(SymfonyVersion::getRootWebPath()) + ->defaultValue('%kernel.project_dir%/public') ->cannotBeEmpty() ->end() ->end(); diff --git a/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php b/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php index 784bc22144..f34c04cd3e 100644 --- a/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php +++ b/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php @@ -28,7 +28,7 @@ public function setMediaPath($kernelRootDir) { parent::setMediaPath($kernelRootDir); - $this->setWebPath(realpath(str_replace('/', DIRECTORY_SEPARATOR, $kernelRootDir . sprintf('/%s/', Kernel::VERSION_ID >= 40000 ? 'public' : 'web')) . DIRECTORY_SEPARATOR)); + $this->setWebPath(realpath(str_replace('/', DIRECTORY_SEPARATOR, $kernelRootDir . '/public/') . DIRECTORY_SEPARATOR)); } /** diff --git a/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php index 7a6dc47018..d31220370f 100644 --- a/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -30,13 +30,9 @@ public function testConfigGeneratesAsExpected() ], 'enable_pdf_preview' => true, 'blacklisted_extensions' => [], - 'web_root' => '%kernel.project_dir%/web', + 'web_root' => '%kernel.project_dir%/public', ]; - if (Kernel::VERSION_ID >= 40000) { - $array['web_root'] = '%kernel.project_dir%/public'; - } - $expectedConfig = $array; $this->assertProcessedConfigurationEquals([$array], $expectedConfig); diff --git a/src/Kunstmaan/MediaBundle/Tests/Utils/SymfonyVersionTest.php b/src/Kunstmaan/MediaBundle/Tests/Utils/SymfonyVersionTest.php deleted file mode 100644 index d7472364ef..0000000000 --- a/src/Kunstmaan/MediaBundle/Tests/Utils/SymfonyVersionTest.php +++ /dev/null @@ -1,26 +0,0 @@ -assertStringStartsWith('%kernel.project_dir%/', $path); - $this->assertStringEndsWith(Kernel::VERSION_ID < 40000 ? 'web' : 'public', $path); - } - - public function testIsKernelLessThan() - { - $this->assertTrue(SymfonyVersion::isKernelLessThan(100, 100, 100)); - $this->assertFalse(SymfonyVersion::isKernelLessThan(1, 1, 1)); - } -} diff --git a/src/Kunstmaan/MediaBundle/Utils/SymfonyVersion.php b/src/Kunstmaan/MediaBundle/Utils/SymfonyVersion.php deleted file mode 100644 index b673b4c563..0000000000 --- a/src/Kunstmaan/MediaBundle/Utils/SymfonyVersion.php +++ /dev/null @@ -1,35 +0,0 @@ -getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_media_page_part'); - } - - return $treeBuilder; + return new TreeBuilder('kunstmaan_media_page_part'); } } diff --git a/src/Kunstmaan/MenuBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/MenuBundle/DependencyInjection/Configuration.php index c3e790ad0b..8b7eb5c062 100644 --- a/src/Kunstmaan/MenuBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/MenuBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_menu'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_menu'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php index f72d0ac859..663054c147 100644 --- a/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/MultiDomainBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_multi_domain'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_multi_domain'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php index 024f526b0b..64f8a80b9a 100644 --- a/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/NodeBundle/DependencyInjection/Configuration.php @@ -14,12 +14,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_node'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_node'); - } + $rootNode = $treeBuilder->getRootNode(); /* @var ArrayNodeDefinition $pages */ $rootNode diff --git a/src/Kunstmaan/NodeBundle/Event/AdaptFormEvent.php b/src/Kunstmaan/NodeBundle/Event/AdaptFormEvent.php index a6d2e1e0b7..0a437192f7 100644 --- a/src/Kunstmaan/NodeBundle/Event/AdaptFormEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/AdaptFormEvent.php @@ -2,18 +2,18 @@ namespace Kunstmaan\NodeBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane; use Kunstmaan\NodeBundle\Entity\HasNodeInterface; use Kunstmaan\NodeBundle\Entity\Node; use Kunstmaan\NodeBundle\Entity\NodeTranslation; use Kunstmaan\NodeBundle\Entity\NodeVersion; use Symfony\Component\HttpFoundation\Request; +use Symfony\Contracts\EventDispatcher\Event; /** * The event to pass metadata if the adaptForm event is triggered */ -final class AdaptFormEvent extends BcEvent +final class AdaptFormEvent extends Event { /** * @var TabPane diff --git a/src/Kunstmaan/NodeBundle/Event/ConfigureActionMenuEvent.php b/src/Kunstmaan/NodeBundle/Event/ConfigureActionMenuEvent.php index f4d4e0c607..757305d817 100644 --- a/src/Kunstmaan/NodeBundle/Event/ConfigureActionMenuEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/ConfigureActionMenuEvent.php @@ -4,10 +4,10 @@ use Knp\Menu\FactoryInterface; use Knp\Menu\ItemInterface; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\NodeBundle\Entity\NodeVersion; +use Symfony\Contracts\EventDispatcher\Event; -final class ConfigureActionMenuEvent extends BcEvent +final class ConfigureActionMenuEvent extends Event { /** * @var FactoryInterface diff --git a/src/Kunstmaan/NodeBundle/Event/NodeEvent.php b/src/Kunstmaan/NodeBundle/Event/NodeEvent.php index 4049bc0c62..c0544048a1 100644 --- a/src/Kunstmaan/NodeBundle/Event/NodeEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/NodeEvent.php @@ -2,17 +2,17 @@ namespace Kunstmaan\NodeBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\NodeBundle\Entity\HasNodeInterface; use Kunstmaan\NodeBundle\Entity\Node; use Kunstmaan\NodeBundle\Entity\NodeTranslation; use Kunstmaan\NodeBundle\Entity\NodeVersion; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; /** * NodeEvent */ -class NodeEvent extends BcEvent +class NodeEvent extends Event { /** * @var HasNodeInterface diff --git a/src/Kunstmaan/NodeBundle/Event/PostNodeDuplicateEvent.php b/src/Kunstmaan/NodeBundle/Event/PostNodeDuplicateEvent.php index a2e82c3683..7b41227886 100644 --- a/src/Kunstmaan/NodeBundle/Event/PostNodeDuplicateEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/PostNodeDuplicateEvent.php @@ -2,12 +2,12 @@ namespace Kunstmaan\NodeBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\NodeBundle\Entity\HasNodeInterface; use Kunstmaan\NodeBundle\Entity\Node; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; -final class PostNodeDuplicateEvent extends BcEvent +final class PostNodeDuplicateEvent extends Event { /** * @var Node diff --git a/src/Kunstmaan/NodeBundle/Event/PreNodeDuplicateEvent.php b/src/Kunstmaan/NodeBundle/Event/PreNodeDuplicateEvent.php index 18dd88b602..76ea921ac7 100644 --- a/src/Kunstmaan/NodeBundle/Event/PreNodeDuplicateEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/PreNodeDuplicateEvent.php @@ -2,11 +2,11 @@ namespace Kunstmaan\NodeBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\NodeBundle\Entity\Node; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; -final class PreNodeDuplicateEvent extends BcEvent +final class PreNodeDuplicateEvent extends Event { /** * @var Node diff --git a/src/Kunstmaan/NodeBundle/Event/SlugSecurityEvent.php b/src/Kunstmaan/NodeBundle/Event/SlugSecurityEvent.php index df94ec8f7a..19f2e65816 100644 --- a/src/Kunstmaan/NodeBundle/Event/SlugSecurityEvent.php +++ b/src/Kunstmaan/NodeBundle/Event/SlugSecurityEvent.php @@ -2,9 +2,9 @@ namespace Kunstmaan\NodeBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; +use Symfony\Contracts\EventDispatcher\Event; -final class SlugSecurityEvent extends BcEvent +final class SlugSecurityEvent extends Event { private $node; diff --git a/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php b/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php index ac69f83bad..74a23ecfca 100644 --- a/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php +++ b/src/Kunstmaan/NodeBundle/EventListener/RenderContextListener.php @@ -85,33 +85,12 @@ public function onKernelView($event) $template = new Template([]); $template->setTemplate($entity->getDefaultView()); - $controllerInfo = $this->getControllerInfo($request->attributes->get('_controller')); - $template->setOwner($controllerInfo); - - $request->attributes->set('_template', $template); - } - } - - /** - * BC check to return correct controller/action information. - * - * @param string $controllerString - * - * @return array - */ - private function getControllerInfo($controllerString) - { - if (strpos($controllerString, '::') !== false) { - $controllerBits = explode('::', $controllerString); + $controllerBits = explode('::', $request->attributes->get('_controller')); $action = array_pop($controllerBits); - return [$controllerBits, $action]; - } - - // NEXT_MAJOR: Remove BC check when we drop sf 3.4 support - $controllerBits = explode(':', $controllerString); - $action = array_pop($controllerBits); + $template->setOwner([$controllerBits, $action]); - return [implode(':', $controllerBits), $action]; + $request->attributes->set('_template', $template); + } } } diff --git a/src/Kunstmaan/NodeSearchBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/NodeSearchBundle/DependencyInjection/Configuration.php index e7a77e9cd3..f3a3ef78e3 100644 --- a/src/Kunstmaan/NodeSearchBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/NodeSearchBundle/DependencyInjection/Configuration.php @@ -32,12 +32,7 @@ public function __construct($useElasticSearchVersion6) public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_node_search'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_node_search'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode->children()->booleanNode('enable_update_listener')->defaultTrue(); $rootNode->children()->booleanNode('use_match_query_for_title')->defaultFalse(); diff --git a/src/Kunstmaan/NodeSearchBundle/Event/IndexNodeEvent.php b/src/Kunstmaan/NodeSearchBundle/Event/IndexNodeEvent.php index 8632b8b4c2..244d39fa50 100644 --- a/src/Kunstmaan/NodeSearchBundle/Event/IndexNodeEvent.php +++ b/src/Kunstmaan/NodeSearchBundle/Event/IndexNodeEvent.php @@ -2,10 +2,10 @@ namespace Kunstmaan\NodeSearchBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\NodeBundle\Entity\HasNodeInterface; +use Symfony\Contracts\EventDispatcher\Event; -final class IndexNodeEvent extends BcEvent +final class IndexNodeEvent extends Event { const EVENT_INDEX_NODE = 'kunstmaan_node_search.onIndexNode'; diff --git a/src/Kunstmaan/PagePartBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/PagePartBundle/DependencyInjection/Configuration.php index 34e8a17b41..e9562f4793 100644 --- a/src/Kunstmaan/PagePartBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/PagePartBundle/DependencyInjection/Configuration.php @@ -15,12 +15,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_page_part'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_page_part'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode->children() ->booleanNode('extended_pagepart_chooser') diff --git a/src/Kunstmaan/PagePartBundle/Event/PagePartEvent.php b/src/Kunstmaan/PagePartBundle/Event/PagePartEvent.php index a00ca25ec4..2a1f739540 100644 --- a/src/Kunstmaan/PagePartBundle/Event/PagePartEvent.php +++ b/src/Kunstmaan/PagePartBundle/Event/PagePartEvent.php @@ -2,11 +2,11 @@ namespace Kunstmaan\PagePartBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\PagePartBundle\Helper\PagePartInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Contracts\EventDispatcher\Event; -final class PagePartEvent extends BcEvent +final class PagePartEvent extends Event { /** * @var PagePartInterface diff --git a/src/Kunstmaan/RedirectBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/RedirectBundle/DependencyInjection/Configuration.php index 06a118f0e2..1110315b3c 100644 --- a/src/Kunstmaan/RedirectBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/RedirectBundle/DependencyInjection/Configuration.php @@ -14,12 +14,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_redirect'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_redirect'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/SearchBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/SearchBundle/DependencyInjection/Configuration.php index c8d1c541c5..74bf6c2225 100644 --- a/src/Kunstmaan/SearchBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/SearchBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_search'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_search'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/SeoBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/SeoBundle/DependencyInjection/Configuration.php index 04fa92d503..205c210b6f 100644 --- a/src/Kunstmaan/SeoBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/SeoBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_seo'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_seo'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/SitemapBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/SitemapBundle/DependencyInjection/Configuration.php index 2d6341989b..5be19fbd75 100644 --- a/src/Kunstmaan/SitemapBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/SitemapBundle/DependencyInjection/Configuration.php @@ -12,14 +12,6 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder('kunstmaan_sitemap'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_sitemap'); - } - - return $treeBuilder; + return new TreeBuilder('kunstmaan_sitemap'); } } diff --git a/src/Kunstmaan/SitemapBundle/Event/PreSitemapIndexRenderEvent.php b/src/Kunstmaan/SitemapBundle/Event/PreSitemapIndexRenderEvent.php index 255b364895..7231cf934c 100644 --- a/src/Kunstmaan/SitemapBundle/Event/PreSitemapIndexRenderEvent.php +++ b/src/Kunstmaan/SitemapBundle/Event/PreSitemapIndexRenderEvent.php @@ -4,10 +4,10 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\SitemapBundle\Model\SitemapIndex; +use Symfony\Contracts\EventDispatcher\Event; -final class PreSitemapIndexRenderEvent extends BcEvent +final class PreSitemapIndexRenderEvent extends Event { public const NAME = 'sitemap.index.pre_render'; diff --git a/src/Kunstmaan/SitemapBundle/Event/PreSitemapRenderEvent.php b/src/Kunstmaan/SitemapBundle/Event/PreSitemapRenderEvent.php index d059eab73f..18c3823489 100644 --- a/src/Kunstmaan/SitemapBundle/Event/PreSitemapRenderEvent.php +++ b/src/Kunstmaan/SitemapBundle/Event/PreSitemapRenderEvent.php @@ -4,10 +4,10 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Kunstmaan\AdminBundle\Event\BcEvent; use Kunstmaan\SitemapBundle\Model\SitemapUrl; +use Symfony\Contracts\EventDispatcher\Event; -final class PreSitemapRenderEvent extends BcEvent +final class PreSitemapRenderEvent extends Event { public const NAME = 'sitemap.pre_render'; diff --git a/src/Kunstmaan/TaggingBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/TaggingBundle/DependencyInjection/Configuration.php index 9368d2c244..268858062c 100644 --- a/src/Kunstmaan/TaggingBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/TaggingBundle/DependencyInjection/Configuration.php @@ -12,14 +12,6 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder('kunstmaan_tagging'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_tagging'); - } - - return $treeBuilder; + return new TreeBuilder('kunstmaan_tagging'); } } diff --git a/src/Kunstmaan/TranslatorBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/TranslatorBundle/DependencyInjection/Configuration.php index dca681d961..5c9ef52e23 100644 --- a/src/Kunstmaan/TranslatorBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/TranslatorBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kuma_translator'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kuma_translator'); - } + $rootNode = $treeBuilder->getRootNode(); $availableStorageEngines = ['orm']; $defaultFileFormats = ['yml', 'yaml', 'xliff']; diff --git a/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php b/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php index 8a19bb81cd..319d57f678 100644 --- a/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php +++ b/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php @@ -83,12 +83,7 @@ public function registerTranslatorConfiguration($config, $container) $dirs[] = \dirname($r->getFileName()) . '/Resources/translations'; } - if (Kernel::VERSION_ID < 4000) { - $overridePath = $container->getParameter('kernel.root_dir') . '/Resources/%s/translations'; - } else { - $overridePath = $container->getParameter('kernel.project_dir') . '/translations'; - } - + $overridePath = $container->getParameter('kernel.project_dir') . '/translations'; foreach ($container->getParameter('kernel.bundles') as $bundle => $class) { $reflection = new \ReflectionClass($class); if (is_dir($dir = \dirname($reflection->getFileName()) . '/Resources/translations')) { @@ -99,12 +94,7 @@ public function registerTranslatorConfiguration($config, $container) } } - if (Kernel::VERSION_ID < 4000) { - $dir = $container->getParameter('kernel.root_dir') . '/Resources/translations'; - } else { - $dir = $container->getParameter('kernel.project_dir') . '/translations'; - } - + $dir = $container->getParameter('kernel.project_dir') . '/translations'; if (is_dir($dir)) { $dirs[] = $dir; } diff --git a/src/Kunstmaan/TranslatorBundle/Service/Command/Importer/ImportCommandHandler.php b/src/Kunstmaan/TranslatorBundle/Service/Command/Importer/ImportCommandHandler.php index 96215d692f..0df03f332a 100644 --- a/src/Kunstmaan/TranslatorBundle/Service/Command/Importer/ImportCommandHandler.php +++ b/src/Kunstmaan/TranslatorBundle/Service/Command/Importer/ImportCommandHandler.php @@ -61,10 +61,9 @@ public function executeImportCommand(ImportCommand $importCommand) */ private function importGlobalTranslationFiles(ImportCommand $importCommand) { - $baseDir = Kernel::VERSION_ID >= 40000 ? $this->kernel->getProjectDir() : $this->kernel->getRootDir(); - $translationsDir = Kernel::VERSION_ID >= 40000 ? 'translations' : null; + $baseDir = $this->kernel->getProjectDir(); $locales = $this->determineLocalesToImport($importCommand); - $finder = $this->translationFileExplorer->find($baseDir, $locales, $translationsDir); + $finder = $this->translationFileExplorer->find($baseDir, $locales, 'translations'); return $this->importTranslationFiles($finder, $importCommand->getForce()); } @@ -80,10 +79,7 @@ public function importBundleTranslationFiles(ImportCommand $importCommand) if ($importBundle === 'all') { $importCount = $this->importAllBundlesTranslationFiles($importCommand); - - if (Kernel::VERSION_ID >= 40000) { - $importCount += $this->importSf4TranslationFiles($importCommand); - } + $importCount += $this->importSf4TranslationFiles($importCommand); return $importCount; } diff --git a/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php b/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php index 3d216c3762..e15180c0df 100644 --- a/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php +++ b/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php @@ -71,31 +71,8 @@ public function testParseRequestedLocalesArray() $this->assertEquals($expectedArray, $locales); } - /** - * @group legacy - */ - public function testImportBundleTranslationFiles() - { - if (Kernel::VERSION_ID >= 40000) { - $this->markTestSkipped('Skip symfony 3 test'); - } - - $importCommand = new ImportCommand(); - $importCommand - ->setForce(false) - ->setLocales(false) - ->setGlobals(true) - ->setDefaultBundle('own'); - - $this->assertEquals(0, $this->importCommandHandler->importBundleTranslationFiles($importCommand)); - } - public function testImportSf4TranslationFiles() { - if (Kernel::VERSION_ID < 40000) { - $this->markTestSkipped('Skip symfony 4 test'); - } - $importCommand = new ImportCommand(); $importCommand ->setForce(false) diff --git a/src/Kunstmaan/UserManagementBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/UserManagementBundle/DependencyInjection/Configuration.php index 33004dd7f0..301a7b67b5 100644 --- a/src/Kunstmaan/UserManagementBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/UserManagementBundle/DependencyInjection/Configuration.php @@ -14,12 +14,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_user_management'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_user_management'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/UserManagementBundle/Event/AfterUserDeleteEvent.php b/src/Kunstmaan/UserManagementBundle/Event/AfterUserDeleteEvent.php index 488d423707..259782fed6 100644 --- a/src/Kunstmaan/UserManagementBundle/Event/AfterUserDeleteEvent.php +++ b/src/Kunstmaan/UserManagementBundle/Event/AfterUserDeleteEvent.php @@ -2,9 +2,9 @@ namespace Kunstmaan\UserManagementBundle\Event; -use Kunstmaan\AdminBundle\Event\BcEvent; +use Symfony\Contracts\EventDispatcher\Event; -final class AfterUserDeleteEvent extends BcEvent +final class AfterUserDeleteEvent extends Event { /** @var string */ private $deletedUser; diff --git a/src/Kunstmaan/UtilitiesBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/UtilitiesBundle/DependencyInjection/Configuration.php index f95532b6b2..e32ecaa9e9 100644 --- a/src/Kunstmaan/UtilitiesBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/UtilitiesBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_utilities'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_utilities'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/VotingBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/VotingBundle/DependencyInjection/Configuration.php index 5aff63f535..ec7207c275 100644 --- a/src/Kunstmaan/VotingBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/VotingBundle/DependencyInjection/Configuration.php @@ -13,12 +13,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('kunstmaan_voting'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('kunstmaan_voting'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Kunstmaan/VotingBundle/Event/AbstractVoteEvent.php b/src/Kunstmaan/VotingBundle/Event/AbstractVoteEvent.php index 05216da2b0..7091df825e 100644 --- a/src/Kunstmaan/VotingBundle/Event/AbstractVoteEvent.php +++ b/src/Kunstmaan/VotingBundle/Event/AbstractVoteEvent.php @@ -2,31 +2,10 @@ namespace Kunstmaan\VotingBundle\Event; -use Symfony\Component\EventDispatcher\Event as LegacyEvent; use Symfony\Component\HttpFoundation\Request; use Symfony\Contracts\EventDispatcher\Event; -if (!class_exists(Event::class)) { - /** - * Symfony 3.4 - * - * @internal - */ - abstract class BcEvent extends LegacyEvent - { - } -} else { - /** - * Symfony >= 4.3 - * - * @internal - */ - abstract class BcEvent extends Event - { - } -} - -abstract class AbstractVoteEvent extends BcEvent implements EventInterface +abstract class AbstractVoteEvent extends Event implements EventInterface { /** * @var Request From c0e04768da29235bb76f110750454df1303cc960 Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Sat, 16 Oct 2021 12:10:16 +0200 Subject: [PATCH 2/2] [AllBundles] Re-add typehint after sf3.4 support is dropped --- .../AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php | 2 -- .../Tests/Helper/Security/Acl/AclNativeHelperTest.php | 2 -- .../AdminBundle/Toolbar/BundleVersionDataCollector.php | 5 +---- src/Kunstmaan/AdminBundle/Toolbar/ExceptionDataCollector.php | 5 +---- .../DependencyInjection/KunstmaanFormExtension.php | 1 - .../Tests/DependencyInjection/KunstmaanFormExtensionTest.php | 1 - src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php | 3 --- .../GeneratorBundle/DataFixtures/ORM/UserFixtures.php | 1 - .../MediaBundle/DependencyInjection/Configuration.php | 1 - src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php | 1 - .../Tests/DependencyInjection/ConfigurationTest.php | 1 - src/Kunstmaan/NodeBundle/Toolbar/NodeDataCollector.php | 5 +---- .../DependencyInjection/KunstmaanTranslatorExtension.php | 1 - .../Tests/Service/Importer/ImportCommandHandlerTest.php | 1 - .../TranslatorBundle/Toolbar/TranslatorDataCollector.php | 5 +---- 15 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php index 234323d53b..c7db9c4aa1 100644 --- a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclHelperTest.php @@ -18,10 +18,8 @@ use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\MaskBuilder; use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionDefinition; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\RoleHierarchy; use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; diff --git a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php index 9b54d1038c..0aa66edd60 100644 --- a/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/Helper/Security/Acl/AclNativeHelperTest.php @@ -12,10 +12,8 @@ use Kunstmaan\AdminBundle\Helper\Security\Acl\AclNativeHelper; use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionDefinition; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\RoleHierarchy; use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; diff --git a/src/Kunstmaan/AdminBundle/Toolbar/BundleVersionDataCollector.php b/src/Kunstmaan/AdminBundle/Toolbar/BundleVersionDataCollector.php index 2adfdcdf7c..d0eb88db50 100644 --- a/src/Kunstmaan/AdminBundle/Toolbar/BundleVersionDataCollector.php +++ b/src/Kunstmaan/AdminBundle/Toolbar/BundleVersionDataCollector.php @@ -42,10 +42,7 @@ public function collectData() ]; } - /** - * NEXT_MAJOR Add \Throwable $exception typehint when symfony version < 5 support is removed - */ - public function collect(Request $request, Response $response, $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { if (!$this->isEnabled()) { $this->data = []; diff --git a/src/Kunstmaan/AdminBundle/Toolbar/ExceptionDataCollector.php b/src/Kunstmaan/AdminBundle/Toolbar/ExceptionDataCollector.php index f0fa0eef38..66be2bafd0 100644 --- a/src/Kunstmaan/AdminBundle/Toolbar/ExceptionDataCollector.php +++ b/src/Kunstmaan/AdminBundle/Toolbar/ExceptionDataCollector.php @@ -43,10 +43,7 @@ public function collectData() } } - /** - * NEXT_MAJOR Add \Throwable $exception typehint when symfony version < 5 support is removed - */ - public function collect(Request $request, Response $response, $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { if (false === $this->isEnabled()) { $this->data = false; diff --git a/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php b/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php index 1d878bf879..3f888b1e0c 100644 --- a/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php +++ b/src/Kunstmaan/FormBundle/DependencyInjection/KunstmaanFormExtension.php @@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\HttpKernel\Kernel; class KunstmaanFormExtension extends Extension implements PrependExtensionInterface { diff --git a/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php b/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php index 3de735cf71..9dba7ea76b 100644 --- a/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php +++ b/src/Kunstmaan/FormBundle/Tests/DependencyInjection/KunstmaanFormExtensionTest.php @@ -5,7 +5,6 @@ use Kunstmaan\FormBundle\DependencyInjection\KunstmaanFormExtension; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\HttpKernel\Kernel; class KunstmaanFormExtensionTest extends AbstractExtensionTestCase { diff --git a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php index ffcf48f530..fa255ba5a9 100644 --- a/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php +++ b/src/Kunstmaan/GeneratorBundle/Command/InstallCommand.php @@ -5,15 +5,12 @@ use Kunstmaan\GeneratorBundle\Helper\CommandAssistant; use Sensio\Bundle\GeneratorBundle\Command\GeneratorCommand; use Sensio\Bundle\GeneratorBundle\Command\Helper\QuestionHelper; -use Sensio\Bundle\GeneratorBundle\Command\Validators; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Process\Process; /** diff --git a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php index c370585f4a..931140a7bd 100644 --- a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php @@ -9,7 +9,6 @@ use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Kernel; /** * Fixture for creating the admin and guest user diff --git a/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php b/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php index 86667a38b6..97b6383e6a 100644 --- a/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php +++ b/src/Kunstmaan/MediaBundle/DependencyInjection/Configuration.php @@ -2,7 +2,6 @@ namespace Kunstmaan\MediaBundle\DependencyInjection; -use Kunstmaan\MediaBundle\Utils\SymfonyVersion; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; diff --git a/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php b/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php index f34c04cd3e..4bb2efe319 100644 --- a/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php +++ b/src/Kunstmaan/MediaBundle/Helper/File/PdfHandler.php @@ -4,7 +4,6 @@ use Kunstmaan\MediaBundle\Entity\Media; use Kunstmaan\MediaBundle\Helper\Transformer\PreviewTransformerInterface; -use Symfony\Component\HttpKernel\Kernel; /** * Custom handler for PDF files (display thumbnails if imagemagick is enabled and has PDF support) diff --git a/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php index d31220370f..8721f98e4d 100644 --- a/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Kunstmaan/MediaBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -5,7 +5,6 @@ use Kunstmaan\MediaBundle\DependencyInjection\Configuration; use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Kernel; class ConfigurationTest extends TestCase { diff --git a/src/Kunstmaan/NodeBundle/Toolbar/NodeDataCollector.php b/src/Kunstmaan/NodeBundle/Toolbar/NodeDataCollector.php index fc1ab6f35b..7850d2f707 100644 --- a/src/Kunstmaan/NodeBundle/Toolbar/NodeDataCollector.php +++ b/src/Kunstmaan/NodeBundle/Toolbar/NodeDataCollector.php @@ -57,10 +57,7 @@ public function collectData() return []; } - /** - * NEXT_MAJOR Add \Throwable $exception typehint when symfony version < 5 support is removed - */ - public function collect(Request $request, Response $response, $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { if (!$this->showDataCollection($request, $response) || !$this->isEnabled()) { $this->data = false; diff --git a/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php b/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php index 319d57f678..42fc3260f8 100644 --- a/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php +++ b/src/Kunstmaan/TranslatorBundle/DependencyInjection/KunstmaanTranslatorExtension.php @@ -8,7 +8,6 @@ use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\HttpKernel\Kernel; class KunstmaanTranslatorExtension extends Extension { diff --git a/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php b/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php index e15180c0df..019f7fef31 100644 --- a/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php +++ b/src/Kunstmaan/TranslatorBundle/Tests/Service/Importer/ImportCommandHandlerTest.php @@ -4,7 +4,6 @@ use Kunstmaan\TranslatorBundle\Model\Import\ImportCommand; use Kunstmaan\TranslatorBundle\Tests\WebTestCase; -use Symfony\Component\HttpKernel\Kernel; class ImportCommandHandlerTest extends WebTestCase { diff --git a/src/Kunstmaan/TranslatorBundle/Toolbar/TranslatorDataCollector.php b/src/Kunstmaan/TranslatorBundle/Toolbar/TranslatorDataCollector.php index 40bef5b2b9..6a7745aee6 100644 --- a/src/Kunstmaan/TranslatorBundle/Toolbar/TranslatorDataCollector.php +++ b/src/Kunstmaan/TranslatorBundle/Toolbar/TranslatorDataCollector.php @@ -72,10 +72,7 @@ public function collectData() return ['data' => $data]; } - /** - * NEXT_MAJOR Add \Throwable $exception typehint when symfony version < 5 support is removed - */ - public function collect(Request $request, Response $response, $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null) { if (!$this->showDataCollection($request, $response) || !$this->isEnabled()) { $this->data = false;