From 6b4a77a70b731ecd7f8c87443f0b31872bf4e995 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 19 Jan 2021 10:23:16 +0100 Subject: [PATCH] Fix lint --- src/Admin/AbstractAdmin.php | 80 +++++++++---------- src/Admin/BaseFieldDescription.php | 24 +++--- .../Admin/AbstractTaggedAdmin.php | 36 ++++----- src/Filter/Filter.php | 4 +- src/Twig/Extension/RenderElementExtension.php | 12 +-- src/Twig/Extension/SonataAdminExtension.php | 36 ++++----- .../Extension/RenderElementExtensionTest.php | 2 +- 7 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 2aefec71fe..af7bc496a5 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -506,7 +506,7 @@ public function getDataSourceIterator() .' and won\'t be possible in 4.0.', __METHOD__, DataSourceInterface::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return $this->getModelManager()->getDataSourceIterator($datagrid, $fields); } @@ -520,7 +520,7 @@ public function validate(ErrorElement $errorElement, $object) @trigger_error(sprintf( 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } } @@ -626,7 +626,7 @@ public function preValidate($object) @trigger_error(sprintf( 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } } @@ -819,7 +819,7 @@ final public function addParentAssociationMapping($code, $value) @trigger_error(sprintf( 'Calling "%s" when $this->parentAssociationMapping is string is deprecated since sonata-project/admin-bundle 3.75 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->parentAssociationMapping[$code] = $value; @@ -989,7 +989,7 @@ public function addSubClass($subClass) @trigger_error(sprintf( 'Method "%s" is deprecated since sonata-project/admin-bundle 3.30 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); if (!\in_array($subClass, $this->subClasses, true)) { $this->subClasses[] = $subClass; @@ -1024,7 +1024,7 @@ public function getActiveSubClass() .' Use %s::hasActiveSubClass() to know if there is an active subclass.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare string as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no active subclass.', @@ -1046,7 +1046,7 @@ public function getActiveSubclassCode() .' Use %s::hasActiveSubClass() to know if there is an active subclass.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare string as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no active subclass.', @@ -1065,7 +1065,7 @@ public function getActiveSubclassCode() .' Use %s::hasActiveSubClass() to know if there is an active subclass.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare string as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no active subclass.', @@ -1272,7 +1272,7 @@ public function defineFormBuilder(FormBuilderInterface $formBuilder) .' and will throw an exception in 4.0. Use %s::setSubject() to set the subject.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call and uncomment the following exception // throw new \LogicException(sprintf( // 'Admin "%s" has no subject.', @@ -1377,7 +1377,7 @@ public function createQuery($context = 'list') @trigger_error(sprintf( 'The $context argument of %s is deprecated since 3.3, to be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $query = $this->getModelManager()->createQuery($this->getClass()); @@ -1492,7 +1492,7 @@ public function setPersistFilters($persist) @trigger_error(sprintf( 'The %s method is deprecated since version 3.34 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->persistFilters = $persist; } @@ -1509,7 +1509,7 @@ public function setMaxPerPage($maxPerPage) @trigger_error(sprintf( 'The method %s is deprecated since sonata-project/admin-bundle 3.67 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->maxPerPage = $maxPerPage; } @@ -1549,7 +1549,7 @@ public function getFormGroups() 'Returning other type than array in method %s() is deprecated since sonata-project/admin-bundle 3.65.' .' It will return only array in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->formGroups; @@ -1589,7 +1589,7 @@ public function getFormTabs() 'Returning other type than array in method %s() is deprecated since sonata-project/admin-bundle 3.65.' .' It will return only array in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->formTabs; @@ -1607,7 +1607,7 @@ public function getShowTabs() 'Returning other type than array in method %s() is deprecated since sonata-project/admin-bundle 3.65.' .' It will return only array in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->showTabs; @@ -1625,7 +1625,7 @@ public function getShowGroups() 'Returning other type than array in method %s() is deprecated since sonata-project/admin-bundle 3.65.' .' It will return only array in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->showGroups; @@ -1658,7 +1658,7 @@ public function getParentFieldDescription() .' Use %s::hasParentFieldDescription() to know if there is a parent field description.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare FieldDescriptionInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no parent field description.', @@ -1686,7 +1686,7 @@ public function setSubject($subject) EOT; // NEXT_MAJOR : throw an exception instead - @trigger_error(sprintf($message, \get_class($subject), $this->getClass()), E_USER_DEPRECATED); + @trigger_error(sprintf($message, \get_class($subject), $this->getClass()), \E_USER_DEPRECATED); } $this->subject = $subject; @@ -1700,7 +1700,7 @@ public function getSubject() .' and will throw an exception in 4.0. Use %s::hasSubject() to know if there is a subject.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and update the return type // throw new \LogicException(sprintf( // 'Admin "%s" has no subject.', @@ -1744,7 +1744,7 @@ public function getFormFieldDescription($name) .' Use %s::hasFormFieldDescription() to know if there is a form field description.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare FieldDescriptionInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no form field description for the field %s.', @@ -1817,7 +1817,7 @@ public function getShowFieldDescription($name) .' Use %s::hasFormFieldDescription() to know if there is a show field description.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare FieldDescriptionInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no show field description for the field %s.', @@ -1867,7 +1867,7 @@ public function getListFieldDescription($name) __METHOD__, __CLASS__, $name - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare FieldDescriptionInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no list field description for %s.', @@ -1909,7 +1909,7 @@ public function getFilterFieldDescription($name) .' Use %s::hasFilterFieldDescription() to know if there is a filter field description.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare FieldDescriptionInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no filter field description for the field %s.', @@ -1975,7 +1975,7 @@ public function addChild(AdminInterface $child) } else { @trigger_error( 'Calling "addChild" without second argument is deprecated since sonata-project/admin-bundle 3.35 and will not be allowed in 4.0.', - E_USER_DEPRECATED + \E_USER_DEPRECATED ); } } @@ -1998,7 +1998,7 @@ public function getChild($code) .' and will throw an exception in 4.0. Use %s::hasChild() to know if the child exists.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare AdminInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no child for the code %s.', @@ -2025,7 +2025,7 @@ public function getParent() .' and will throw an exception in 4.0. Use %s::isChild() to know if there is a parent.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // NEXT_MAJOR : remove the previous `trigger_error()` call, the `return null` statement, uncomment the following exception and declare AdminInterface as return type // throw new \LogicException(sprintf( // 'Admin "%s" has no parent.', @@ -2119,7 +2119,7 @@ public function getClassnameLabel() 'Calling %s() when no classname label is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no classname label. Did you forgot to initialize the admin ?', // static::class @@ -2168,7 +2168,7 @@ public function getBreadcrumbs($action) .' Use %s::getBreadcrumbs instead.', __METHOD__, BreadcrumbsBuilder::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return $this->getBreadcrumbsBuilder()->getBreadcrumbs($this, $action); } @@ -2187,7 +2187,7 @@ public function buildBreadcrumbs($action, ?ItemInterface $menu = null) @trigger_error(sprintf( 'The %s method is deprecated since version 3.2 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); if (isset($this->breadcrumbs[$action])) { return $this->breadcrumbs[$action]; @@ -2208,7 +2208,7 @@ final public function getBreadcrumbsBuilder() 'The %s method is deprecated since version 3.2 and will be removed in 4.0.' .' Use the sonata.admin.breadcrumbs_builder service instead.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); if (null === $this->breadcrumbsBuilder) { $this->breadcrumbsBuilder = new BreadcrumbsBuilder( $this->getConfigurationPool()->getContainer('sonata_deprecation_mute')->getParameter('sonata.admin.configuration.breadcrumbs') @@ -2229,7 +2229,7 @@ final public function setBreadcrumbsBuilder(BreadcrumbsBuilderInterface $value) 'The %s method is deprecated since version 3.2 and will be removed in 4.0.' .' Use the sonata.admin.breadcrumbs_builder service instead.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->breadcrumbsBuilder = $value; return $this; @@ -2252,7 +2252,7 @@ public function getCurrentChild() .' Use %s::isCurrentChild() instead.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return $this->currentChild; } @@ -2290,7 +2290,7 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul @trigger_error(sprintf( 'The %s method is deprecated since version 3.9 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $domain = $domain ?: $this->getTranslationDomain(); @@ -2316,7 +2316,7 @@ public function transChoice($id, $count, array $parameters = [], $domain = null, @trigger_error(sprintf( 'The %s method is deprecated since version 3.9 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $domain = $domain ?: $this->getTranslationDomain(); @@ -2379,7 +2379,7 @@ public function setBaseCodeRoute($baseCodeRoute) @trigger_error(sprintf( 'The %s is deprecated since 3.24 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->baseCodeRoute = $baseCodeRoute; } @@ -2507,7 +2507,7 @@ public function toString($object) .' Only object will be allowed in version 4.0.', \gettype($object), __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return ''; } @@ -2536,7 +2536,7 @@ public function setPerPageOptions(array $options) @trigger_error(sprintf( 'The method %s is deprecated since sonata-project/admin-bundle 3.67 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->perPageOptions = $options; } @@ -2826,7 +2826,7 @@ final public function isDefaultFilter($name) @trigger_error(sprintf( 'Method "%s" is deprecated since sonata-project/admin-bundle 3.76.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $filter = $this->getFilterParameters(); $default = $this->getDefaultFilterValues(); @@ -2870,7 +2870,7 @@ final public function getTemplateRegistry(): ?MutableTemplateRegistryInterface .' Use %s::hasTemplateRegistry() to know if the template registry is set.', __METHOD__, __CLASS__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } //if (false === $this->hasTemplateRegistry()) { // throw new \LogicException(sprintf('Unable to find the template registry for admin `%s`.', static::class)); @@ -3128,7 +3128,7 @@ protected function attachInlineValidator() @trigger_error(sprintf( 'The %s method is deprecated since version 3.82 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $admin = $this; diff --git a/src/Admin/BaseFieldDescription.php b/src/Admin/BaseFieldDescription.php index 2dc84530ba..c38710c96f 100644 --- a/src/Admin/BaseFieldDescription.php +++ b/src/Admin/BaseFieldDescription.php @@ -153,7 +153,7 @@ public function __construct( 'Omitting the argument 1 for "%s()" or passing other type than "string" is deprecated'. ' since sonata-project/admin-bundle 3.78. It will accept only string in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } else { $this->setName($name); @@ -197,7 +197,7 @@ public function setFieldName($fieldName) 'The %s() method is deprecated since sonata-project/admin-bundle 3.84' .' and will become private in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->fieldName = $fieldName; @@ -255,7 +255,7 @@ public function setOptions(array $options) .' and the option will be removed in 4.0.' .' Use Symfony Form "help" option instead.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->setHelp($options['help'], 'sonata_deprecation_mute'); unset($options['help']); @@ -290,7 +290,7 @@ public function getTemplate() 'Returning other type than string or null in method %s() is deprecated since' .' sonata-project/admin-bundle 3.65. It will return only those types in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->template; @@ -321,7 +321,7 @@ public function getParent() __METHOD__, __CLASS__ ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); // NEXT_MAJOR : remove the previous `trigger_error()` call, uncomment the following exception and declare AdminInterface as return type // throw new \LogicException(sprintf('%s has no parent.', static::class)); @@ -367,7 +367,7 @@ public function getAssociationAdmin() __METHOD__, __CLASS__ ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); // NEXT_MAJOR : remove the previous `trigger_error()` call, uncomment the following exception and declare AdminInterface as return type // throw new \LogicException(sprintf('%s has no association admin.', static::class)); @@ -483,7 +483,7 @@ public function getAdmin() __METHOD__, __CLASS__ ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); // NEXT_MAJOR : remove the previous `trigger_error()` call, uncomment the following exception and declare AdminInterface as return type // throw new \LogicException(sprintf('%s has no admin.', static::class)); @@ -525,7 +525,7 @@ public function setMappingType($mappingType) @trigger_error(sprintf( 'The "%s()" method is deprecated since version 3.83 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->mappingType = $mappingType; } @@ -554,7 +554,7 @@ public static function camelize($property) 'The %s method is deprecated since 3.1 and will be removed in 4.0. Use %s::classify() instead.', __METHOD__, Inflector::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return InflectorFactory::create()->build()->classify($property); } @@ -575,7 +575,7 @@ public function setHelp($help) 'The "%s()" method is deprecated since sonata-project/admin-bundle 3.74 and will be removed in version 4.0.' .' Use Symfony Form "help" option instead.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->help = $help; @@ -595,7 +595,7 @@ public function getHelp() 'The "%s()" method is deprecated since sonata-project/admin-bundle 3.74 and will be removed in version 4.0.' .' Use Symfony Form "help" option instead.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->help; @@ -609,7 +609,7 @@ public function getLabel() 'Returning other type than string, false or null in method %s() is deprecated since' .' sonata-project/admin-bundle 3.65. It will return only those types in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $label; diff --git a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php index ae9f1925a5..c28da8d463 100644 --- a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php +++ b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php @@ -216,7 +216,7 @@ public function __construct($code, $class, $baseControllerName = null) 'Passing other type than string as argument 1 for method %s() is deprecated since' .' sonata-project/admin-bundle 3.65. It will accept only string in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->code = $code; @@ -225,7 +225,7 @@ public function __construct($code, $class, $baseControllerName = null) 'Passing other type than string as argument 2 for method %s() is deprecated since' .' sonata-project/admin-bundle 3.65. It will accept only string in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->class = $class; @@ -234,7 +234,7 @@ public function __construct($code, $class, $baseControllerName = null) 'Passing other type than string as argument 3 for method %s() is deprecated since' .' sonata-project/admin-bundle 3.84. It will accept only string in version 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->baseControllerName = $baseControllerName; } @@ -311,7 +311,7 @@ public function getManagerType() 'Calling %s() when no manager type is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no manager type.', // static::class @@ -384,7 +384,7 @@ public function getModelManager() 'Calling %s() when no model manager is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no model manager.', // static::class @@ -413,7 +413,7 @@ public function getDataSource(): ?DataSourceInterface 'Calling %s() when no data source is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no data source.', // static::class @@ -442,7 +442,7 @@ public function getFormContractor() 'Calling %s() when no form contractor is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no form contractor.', // static::class @@ -471,7 +471,7 @@ public function getShowBuilder() 'Calling %s() when no show builder is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no show builder.', // static::class @@ -500,7 +500,7 @@ public function getListBuilder() 'Calling %s() when no list build is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no list builder.', // static::class @@ -529,7 +529,7 @@ public function getDatagridBuilder() 'Calling %s() when no datagrid builder is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no datagrid builder.', // static::class @@ -558,7 +558,7 @@ public function getTranslator() 'Calling %s() when no translator is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no translator.', // static::class @@ -588,7 +588,7 @@ public function getConfigurationPool() 'Calling %s() when no pool is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } // throw new \LogicException(sprintf( // 'Admin "%s" has no pool.', @@ -618,7 +618,7 @@ public function getRouteGenerator() 'Calling %s() when no route generator is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no route generator.', // static::class @@ -656,7 +656,7 @@ public function getValidator() @trigger_error(sprintf( 'The %s method is deprecated since version 3.83 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return $this->validator; } @@ -680,7 +680,7 @@ public function getSecurityHandler() 'Calling %s() when no security handler is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no security handler.', // static::class @@ -709,7 +709,7 @@ public function getMenuFactory() 'Calling %s() when no security handler is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no security handler.', // static::class @@ -738,7 +738,7 @@ public function getRouteBuilder() 'Calling %s() when no route builder is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no route builder.', // static::class @@ -767,7 +767,7 @@ public function getLabelTranslatorStrategy() 'Calling %s() when no label translator strategy is set is deprecated since sonata-project/admin-bundle 3.84' .' and will throw a LogicException in 4.0', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); // throw new \LogicException(sprintf( // 'Admin "%s" has no label translator strategy.', // static::class diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index f18c523100..23872f693f 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -201,7 +201,7 @@ public function setValue($value) @trigger_error(sprintf( 'Method %s() is deprecated since sonata-project/admin-bundle 3.84 and will be removed in version 4.0.', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->value = $value; } @@ -218,7 +218,7 @@ public function getValue() @trigger_error(sprintf( 'Method %s() is deprecated since sonata-project/admin-bundle 3.84 and will be removed in version 4.0.', __METHOD__, - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); return $this->value; } diff --git a/src/Twig/Extension/RenderElementExtension.php b/src/Twig/Extension/RenderElementExtension.php index 436975436c..6aa4a6903b 100644 --- a/src/Twig/Extension/RenderElementExtension.php +++ b/src/Twig/Extension/RenderElementExtension.php @@ -159,7 +159,7 @@ public function renderViewElement( .' since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.', $fieldDescription->getName(), ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); $value = null; @@ -203,7 +203,7 @@ public function renderViewElementCompare( .' since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.', $fieldDescription->getName(), ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); $baseValue = null; @@ -219,7 +219,7 @@ public function renderViewElementCompare( .' since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.', $fieldDescription->getName(), ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); $compareValue = null; @@ -276,7 +276,7 @@ public function renderRelationElement($element, FieldDescriptionInterface $field if ($method) { @trigger_error( 'Option "associated_tostring" is deprecated since version 2.3 and will be removed in 4.0. Use "associated_property" instead.', - E_USER_DEPRECATED + \E_USER_DEPRECATED ); } else { $method = '__toString'; @@ -325,7 +325,7 @@ public function getTemplate( 'Relying on default template loading on field template loading exception is deprecated since 3.1' .' and will be removed in 4.0. A %s exception will be thrown instead', LoaderError::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $template = $environment->load($defaultTemplate); if (null !== $this->logger) { @@ -380,7 +380,7 @@ private function getObjectAndValueFromListElement( .' since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.', $fieldDescription->getName(), ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); $value = null; diff --git a/src/Twig/Extension/SonataAdminExtension.php b/src/Twig/Extension/SonataAdminExtension.php index e1b2cb1080..510327018c 100644 --- a/src/Twig/Extension/SonataAdminExtension.php +++ b/src/Twig/Extension/SonataAdminExtension.php @@ -146,14 +146,14 @@ public function __construct( if (null === $translator) { @trigger_error( 'The $translator parameter will be required field with the 4.0 release.', - E_USER_DEPRECATED + \E_USER_DEPRECATED ); } else { if (!$translator instanceof TranslatorInterface) { @trigger_error(sprintf( 'The $translator parameter should be an instance of "%s" and will be mandatory in 4.0.', TranslatorInterface::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (!$translator instanceof TranslatorInterface && !$translator instanceof LegacyTranslationInterface) { @@ -189,7 +189,7 @@ public function __construct( __METHOD__, PropertyAccessorInterface::class, AuthorizationCheckerInterface::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->securityChecker = $propertyAccessorOrSecurityChecker; $this->propertyAccessor = $pool->getPropertyAccessor(); @@ -199,7 +199,7 @@ public function __construct( .' 3.82 and will throw a \TypeError error in version 4.0. You must pass an instance of "%s" instead.', __METHOD__, PropertyAccessorInterface::class - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $this->propertyAccessor = $pool->getPropertyAccessor(); $this->securityChecker = $securityChecker; @@ -367,7 +367,7 @@ public function renderListElement( @trigger_error(sprintf( 'The %s method is deprecated in favor of RenderElementExtension::renderListElement since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->renderElementExtension) { @@ -391,7 +391,7 @@ public function output( @trigger_error(sprintf( 'The %s method is deprecated since version 3.33 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); $content = $template->render($parameters); @@ -443,7 +443,7 @@ public function getValueFromFieldDescription( 'The %s() method is deprecated since sonata-project/admin-bundle 3.73 and will be removed in version 4.0.' .' There is no replacement.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); if (isset($params['loop']) && $object instanceof \ArrayAccess) { throw new \RuntimeException('remove the loop requirement'); @@ -464,7 +464,7 @@ public function getValueFromFieldDescription( .' since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.', $fieldDescription->getName(), ), - E_USER_DEPRECATED + \E_USER_DEPRECATED ); } } @@ -491,7 +491,7 @@ public function renderViewElement( @trigger_error(sprintf( 'The %s method is deprecated in favor of RenderElementExtension::renderViewElement since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->renderElementExtension) { @@ -522,7 +522,7 @@ public function renderViewElementCompare( @trigger_error(sprintf( 'The %s method is deprecated in favor of RenderElementExtension::renderViewElementCompare since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->renderElementExtension) { $this->renderElementExtension = new RenderElementExtension($this->propertyAccessor, $this->templateRegistries, $this->logger); @@ -548,7 +548,7 @@ public function renderRelationElement($element, FieldDescriptionInterface $field @trigger_error(sprintf( 'The %s method is deprecated in favor of RenderElementExtension::renderRelationElement since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->renderElementExtension) { @@ -592,7 +592,7 @@ public function setXEditableTypeMapping($xEditableTypeMapping) @trigger_error(sprintf( 'The %s method is deprecated in favor of XEditableExtension::setXEditableTypeMapping since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } $this->xEditableTypeMapping = $xEditableTypeMapping; @@ -611,7 +611,7 @@ public function getXEditableType($type) @trigger_error(sprintf( 'The %s method is deprecated in favor of XEditableExtension::getXEditableType since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->xEditableTypeMapping[$type] ?? false; @@ -636,7 +636,7 @@ public function getXEditableChoices(FieldDescriptionInterface $fieldDescription) @trigger_error(sprintf( 'The %s method is deprecated in favor of XEditableExtension::getXEditableChoices since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->xEditableExtension) { @@ -662,7 +662,7 @@ final public function getCanonicalizedLocaleForMoment(array $context) @trigger_error(sprintf( 'The %s method is deprecated in favor of CanonicalizeExtension::getCanonicalizedLocaleForMoment since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->canonicalizeExtension) { @@ -690,7 +690,7 @@ final public function getCanonicalizedLocaleForSelect2(array $context) @trigger_error(sprintf( 'The %s method is deprecated in favor of CanonicalizeExtension::getCanonicalizedLocaleForSelect2 since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->canonicalizeExtension) { @@ -719,7 +719,7 @@ public function isGrantedAffirmative($role, $object = null, $field = null) @trigger_error(sprintf( 'The %s method is deprecated in favor of SecurityExtension::isGrantedAffirmative since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } if (null === $this->securityExtension) { @@ -749,7 +749,7 @@ protected function getTemplate( @trigger_error(sprintf( 'The %s method is deprecated in favor of RenderElementExtension::getTemplate since version 3.87 and will be removed in 4.0.', __METHOD__ - ), E_USER_DEPRECATED); + ), \E_USER_DEPRECATED); } return $this->renderElementExtension->getTemplate($fieldDescription, $defaultTemplate, $$environment); diff --git a/tests/Twig/Extension/RenderElementExtensionTest.php b/tests/Twig/Extension/RenderElementExtensionTest.php index 02acad731c..960243b264 100644 --- a/tests/Twig/Extension/RenderElementExtensionTest.php +++ b/tests/Twig/Extension/RenderElementExtensionTest.php @@ -2524,7 +2524,7 @@ public function getRenderViewElementCompareTests(): iterable */ private function buildTwigLikeUrl(array $url): string { - return htmlspecialchars(http_build_query($url, '', '&', PHP_QUERY_RFC3986)); + return htmlspecialchars(http_build_query($url, '', '&', \PHP_QUERY_RFC3986)); } private function removeExtraWhitespace(string $string): string