From 1de6269593a1831f82a1b21d34556603d598a8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20B=C5=82oszyk?= Date: Thu, 21 May 2020 20:00:49 +0200 Subject: [PATCH] Add deprecations --- composer.json | 5 +++-- .../Compiler/AdapterCompilerPass.php | 2 ++ .../Compiler/StatusRendererCompilerPass.php | 2 ++ .../DependencyInjection/Configuration.php | 2 ++ .../SonataCoreExtension.php | 2 ++ src/CoreBundle/Exporter/Exporter.php | 2 ++ src/CoreBundle/Form/FormHelper.php | 3 +++ .../Model/PageableManagerInterface.php | 3 +++ src/CoreBundle/Resources/config/commands.xml | 2 ++ src/CoreBundle/Resources/config/core.xml | 5 ++++- src/CoreBundle/Resources/config/date.xml | 4 +++- src/CoreBundle/Resources/config/exporter.xml | 4 +++- src/CoreBundle/Resources/config/flash.xml | 3 +++ .../Resources/config/form_types.xml | 21 +++++++++++++++++++ src/CoreBundle/Resources/config/twig.xml | 6 ++++++ src/CoreBundle/Resources/config/validator.xml | 1 + src/CoreBundle/SonataCoreBundle.php | 8 +++++++ .../Test/XliffValidatorTestCase.php | 3 +++ .../Twig/Extension/FlashMessageExtension.php | 2 +- src/Form/Type/BasePickerType.php | 2 +- .../Compiler/FormFactoryCompilerPassTest.php | 2 +- .../Form/Type/FormChoiceWidgetTest.php | 8 +++---- tests/Form/Type/FormChoiceWidgetTest.php | 8 +++---- 23 files changed, 84 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 3b1a8151..b3724f45 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "twig/twig": "^1.34 || ^2.0" }, "conflict": { - "sonata-project/exporter": "< 1.11.0" + "sonata-project/exporter": "< 1.11" }, "require-dev": { "doctrine/orm": "^2.4", @@ -48,7 +48,8 @@ "matthiasnoback/symfony-config-test": "^4.0", "matthiasnoback/symfony-dependency-injection-test": "^4.0", "nelmio/api-doc-bundle": "^2.11", - "sonata-project/exporter": "^1.11.0 || ^2.0", + "phpspec/prophecy": "^1.0", + "sonata-project/exporter": "^1.11 || ^2.0", "symfony/phpunit-bridge": "^4.3" }, "suggest": { diff --git a/src/CoreBundle/DependencyInjection/Compiler/AdapterCompilerPass.php b/src/CoreBundle/DependencyInjection/Compiler/AdapterCompilerPass.php index 6bd52ffb..de61fde9 100644 --- a/src/CoreBundle/DependencyInjection/Compiler/AdapterCompilerPass.php +++ b/src/CoreBundle/DependencyInjection/Compiler/AdapterCompilerPass.php @@ -19,6 +19,8 @@ /** * @author Thomas Rabaix + * + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. */ class AdapterCompilerPass implements CompilerPassInterface { diff --git a/src/CoreBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php b/src/CoreBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php index c2200545..74bd3fdb 100644 --- a/src/CoreBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php +++ b/src/CoreBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php @@ -19,6 +19,8 @@ /** * @author Hugo Briand + * + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. */ class StatusRendererCompilerPass implements CompilerPassInterface { diff --git a/src/CoreBundle/DependencyInjection/Configuration.php b/src/CoreBundle/DependencyInjection/Configuration.php index f7d1200c..93c4f360 100644 --- a/src/CoreBundle/DependencyInjection/Configuration.php +++ b/src/CoreBundle/DependencyInjection/Configuration.php @@ -22,6 +22,8 @@ * * @author Thomas Rabaix * @author Alexander + * + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. */ class Configuration implements ConfigurationInterface { diff --git a/src/CoreBundle/DependencyInjection/SonataCoreExtension.php b/src/CoreBundle/DependencyInjection/SonataCoreExtension.php index 85ca6a58..afb98805 100644 --- a/src/CoreBundle/DependencyInjection/SonataCoreExtension.php +++ b/src/CoreBundle/DependencyInjection/SonataCoreExtension.php @@ -34,6 +34,8 @@ /** * @author Thomas Rabaix + * + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. */ class SonataCoreExtension extends Extension implements PrependExtensionInterface { diff --git a/src/CoreBundle/Exporter/Exporter.php b/src/CoreBundle/Exporter/Exporter.php index be0ddc84..0e391e2e 100644 --- a/src/CoreBundle/Exporter/Exporter.php +++ b/src/CoreBundle/Exporter/Exporter.php @@ -29,6 +29,8 @@ /** * NEXT_MAJOR: remove this class, and the dev dependency. + * + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. */ class Exporter { diff --git a/src/CoreBundle/Form/FormHelper.php b/src/CoreBundle/Form/FormHelper.php index 2c932452..8efcabe2 100644 --- a/src/CoreBundle/Form/FormHelper.php +++ b/src/CoreBundle/Form/FormHelper.php @@ -17,6 +17,9 @@ use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +/** + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. + */ class FormHelper { private static $typeMapping = []; diff --git a/src/CoreBundle/Model/PageableManagerInterface.php b/src/CoreBundle/Model/PageableManagerInterface.php index 98155bf4..5c991c41 100644 --- a/src/CoreBundle/Model/PageableManagerInterface.php +++ b/src/CoreBundle/Model/PageableManagerInterface.php @@ -27,6 +27,9 @@ class_alias( ); if (false) { + /** + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. + */ interface PageableManagerInterface extends \Sonata\Doctrine\Model\PageableManagerInterface { } diff --git a/src/CoreBundle/Resources/config/commands.xml b/src/CoreBundle/Resources/config/commands.xml index b4f347c6..25be62b7 100644 --- a/src/CoreBundle/Resources/config/commands.xml +++ b/src/CoreBundle/Resources/config/commands.xml @@ -2,9 +2,11 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. diff --git a/src/CoreBundle/Resources/config/core.xml b/src/CoreBundle/Resources/config/core.xml index 1ab9c242..881a688d 100644 --- a/src/CoreBundle/Resources/config/core.xml +++ b/src/CoreBundle/Resources/config/core.xml @@ -1,11 +1,14 @@ - + + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.slugify.cocur" instead. + The "%service_id%" service is deprecated since 2.3 and will be removed in 4.0. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. diff --git a/src/CoreBundle/Resources/config/date.xml b/src/CoreBundle/Resources/config/date.xml index bae41497..79a4de6a 100644 --- a/src/CoreBundle/Resources/config/date.xml +++ b/src/CoreBundle/Resources/config/date.xml @@ -1,6 +1,8 @@ - + + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.date.moment_format_converter" instead. + diff --git a/src/CoreBundle/Resources/config/exporter.xml b/src/CoreBundle/Resources/config/exporter.xml index 2049bfc9..c6fad4e7 100644 --- a/src/CoreBundle/Resources/config/exporter.xml +++ b/src/CoreBundle/Resources/config/exporter.xml @@ -2,6 +2,8 @@ - + + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.exporter.exporter" instead. + diff --git a/src/CoreBundle/Resources/config/flash.xml b/src/CoreBundle/Resources/config/flash.xml index 5470c607..2c2c0873 100644 --- a/src/CoreBundle/Resources/config/flash.xml +++ b/src/CoreBundle/Resources/config/flash.xml @@ -6,6 +6,7 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.flashmessage.manager" instead. @@ -13,10 +14,12 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.flashmessage.twig.runtime" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.flashmessage.twig.extension" instead. diff --git a/src/CoreBundle/Resources/config/form_types.xml b/src/CoreBundle/Resources/config/form_types.xml index e8ae20f5..a93a5cc6 100644 --- a/src/CoreBundle/Resources/config/form_types.xml +++ b/src/CoreBundle/Resources/config/form_types.xml @@ -2,12 +2,15 @@ + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.array" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.boolean" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.collection" instead. @@ -16,32 +19,39 @@ + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_range" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_picker" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_picker" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_range_picker" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range_picker" instead. + The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.equal" instead. @@ -50,44 +60,55 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.array" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.boolean" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.collection" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.date_range" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.date_picker" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_picker" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.date_range_picker" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range_picker" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.type.equal" instead. diff --git a/src/CoreBundle/Resources/config/twig.xml b/src/CoreBundle/Resources/config/twig.xml index 8859ad3f..dc1eeba1 100644 --- a/src/CoreBundle/Resources/config/twig.xml +++ b/src/CoreBundle/Resources/config/twig.xml @@ -2,23 +2,29 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.extension.wrapping" instead. %sonata.core.form_type% + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.status_runtime" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.status_extension" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.deprecated_template_extension" instead. + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.template_extension" instead. %kernel.debug% diff --git a/src/CoreBundle/Resources/config/validator.xml b/src/CoreBundle/Resources/config/validator.xml index 3000ddc8..553631f7 100644 --- a/src/CoreBundle/Resources/config/validator.xml +++ b/src/CoreBundle/Resources/config/validator.xml @@ -2,6 +2,7 @@ + The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.validator.inline" instead. diff --git a/src/CoreBundle/SonataCoreBundle.php b/src/CoreBundle/SonataCoreBundle.php index 050930ab..d76edf75 100644 --- a/src/CoreBundle/SonataCoreBundle.php +++ b/src/CoreBundle/SonataCoreBundle.php @@ -65,6 +65,14 @@ use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\HttpKernel\Bundle\Bundle; +/** + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. + * Use + * sonata-project/doctrine-extensions, + * sonata-project/form-extensions, + * sonata-project/twig-extensions + * instead. + */ class SonataCoreBundle extends Bundle { public function build(ContainerBuilder $container) diff --git a/src/CoreBundle/Test/XliffValidatorTestCase.php b/src/CoreBundle/Test/XliffValidatorTestCase.php index 99100054..ec6deaa6 100644 --- a/src/CoreBundle/Test/XliffValidatorTestCase.php +++ b/src/CoreBundle/Test/XliffValidatorTestCase.php @@ -17,6 +17,9 @@ use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Loader\XliffFileLoader; +/** + * @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0. + */ abstract class XliffValidatorTestCase extends TestCase { /** diff --git a/src/CoreBundle/Twig/Extension/FlashMessageExtension.php b/src/CoreBundle/Twig/Extension/FlashMessageExtension.php index 4f97d562..d78ff6d1 100644 --- a/src/CoreBundle/Twig/Extension/FlashMessageExtension.php +++ b/src/CoreBundle/Twig/Extension/FlashMessageExtension.php @@ -37,7 +37,7 @@ class FlashMessageExtension extends \Sonata\Twig\Extension\FlashMessageExtension */ protected $flashManager; - public function __construct(FlashManager $flashManager = null) + public function __construct(?FlashManager $flashManager = null) { $this->flashManager = $flashManager; diff --git a/src/Form/Type/BasePickerType.php b/src/Form/Type/BasePickerType.php index 4c218ebf..1a64662f 100644 --- a/src/Form/Type/BasePickerType.php +++ b/src/Form/Type/BasePickerType.php @@ -47,7 +47,7 @@ abstract class BasePickerType extends AbstractType /** * NEXT_MAJOR: TranslatorInterface needs to be mandatory. */ - public function __construct(MomentFormatConverter $formatConverter, TranslatorInterface $translator = null) + public function __construct(MomentFormatConverter $formatConverter, ?TranslatorInterface $translator = null) { $this->formatConverter = $formatConverter; $this->translator = $translator; diff --git a/tests/CoreBundle/DependencyInjection/Compiler/FormFactoryCompilerPassTest.php b/tests/CoreBundle/DependencyInjection/Compiler/FormFactoryCompilerPassTest.php index e29065c7..4f91cf3e 100644 --- a/tests/CoreBundle/DependencyInjection/Compiler/FormFactoryCompilerPassTest.php +++ b/tests/CoreBundle/DependencyInjection/Compiler/FormFactoryCompilerPassTest.php @@ -78,7 +78,7 @@ public function testProcessWithContainerHasFormExtensionDefinition() $this->assertSame($sonataFormExtension, $this->container->getDefinition('form.extension')); - $this->assertContains('foo', $sonataFormExtension->getArgument(1)); + $this->assertStringContainsString('foo', $sonataFormExtension->getArgument(1)); $this->assertSame([], $sonataFormExtension->getArgument(2)); $this->assertSame([], $sonataFormExtension->getArgument(3)); } diff --git a/tests/CoreBundle/Form/Type/FormChoiceWidgetTest.php b/tests/CoreBundle/Form/Type/FormChoiceWidgetTest.php index 932d3542..ad2ecb14 100644 --- a/tests/CoreBundle/Form/Type/FormChoiceWidgetTest.php +++ b/tests/CoreBundle/Form/Type/FormChoiceWidgetTest.php @@ -42,7 +42,7 @@ public function testLabelRendering() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( '
', $this->cleanHtmlWhitespace($html) ); @@ -58,7 +58,7 @@ public function testDefaultValueRendering() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( '', $this->cleanHtmlWhitespace($html) ); @@ -74,7 +74,7 @@ public function testRequiredIsDisabledForEmptyPlaceholder() $html = $this->renderWidget($choice->createView()); - $this->assertNotContains( + $this->assertStringNotContainsString( 'required="required"', $this->cleanHtmlWhitespace($html) ); @@ -90,7 +90,7 @@ public function testRequiredIsEnabledIfPlaceholderIsSet() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( 'required="required"', $this->cleanHtmlWhitespace($html) ); diff --git a/tests/Form/Type/FormChoiceWidgetTest.php b/tests/Form/Type/FormChoiceWidgetTest.php index e73b5258..1546f82a 100644 --- a/tests/Form/Type/FormChoiceWidgetTest.php +++ b/tests/Form/Type/FormChoiceWidgetTest.php @@ -40,7 +40,7 @@ public function testLabelRendering() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( '
', $this->cleanHtmlWhitespace($html) ); @@ -56,7 +56,7 @@ public function testDefaultValueRendering() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( '', $this->cleanHtmlWhitespace($html) ); @@ -72,7 +72,7 @@ public function testRequiredIsDisabledForEmptyPlaceholder() $html = $this->renderWidget($choice->createView()); - $this->assertNotContains( + $this->assertStringNotContainsString( 'required="required"', $this->cleanHtmlWhitespace($html) ); @@ -88,7 +88,7 @@ public function testRequiredIsEnabledIfPlaceholderIsSet() $html = $this->renderWidget($choice->createView()); - $this->assertContains( + $this->assertStringContainsString( 'required="required"', $this->cleanHtmlWhitespace($html) );