From c6246c9dd34e3c94d3984d9b6d9e008234f2180a Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 16 Dec 2020 23:16:35 +0100 Subject: [PATCH 1/6] Move getListModes into TaggedAdminInterface --- src/Admin/AbstractAdmin.php | 5 ----- src/Admin/AdminInterface.php | 5 ----- src/DependencyInjection/Admin/AbstractTaggedAdmin.php | 8 ++++++++ src/DependencyInjection/Admin/TaggedAdminInterface.php | 5 +++++ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 36af1fabc6..b9f41491bc 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -2587,11 +2587,6 @@ public function getObjectMetadata($object) return new Metadata($this->toString($object)); } - public function getListModes() - { - return $this->listModes; - } - public function setListMode($mode) { if (!$this->hasRequest()) { diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 1e131f020b..434b960af7 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -698,11 +698,6 @@ public function getTranslationLabel($label, $context = '', $type = ''); */ public function getObjectMetadata($object); - /** - * @return array> - */ - public function getListModes(); - /** * Check the current request is given route or not. * diff --git a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php index 4d26d42334..d02f321b95 100644 --- a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php +++ b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php @@ -261,6 +261,14 @@ final public function showMosaicButton($isShown) } } + /** + * @final since sonata-admin/admin-bundle 3.x + */ + public function getListModes() + { + return $this->listModes; + } + /** * @final since sonata-admin/admin-bundle 3.x */ diff --git a/src/DependencyInjection/Admin/TaggedAdminInterface.php b/src/DependencyInjection/Admin/TaggedAdminInterface.php index 10f04574dc..9c394cc24f 100644 --- a/src/DependencyInjection/Admin/TaggedAdminInterface.php +++ b/src/DependencyInjection/Admin/TaggedAdminInterface.php @@ -91,6 +91,11 @@ public function getLabel(); */ // public function showMosaicButton(bool $isShown): void; + /** + * @return array> + */ + public function getListModes(); + /** * NEXT_MAJOR: Uncomment this method. */ From ec7dff2fb1ef4c35d2eee411b3fa1395b432c456 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 16 Dec 2020 23:19:50 +0100 Subject: [PATCH 2/6] Update 3.x comments --- src/Admin/AbstractAdmin.php | 4 +- src/Admin/AdminInterface.php | 2 +- src/Datagrid/Pager.php | 130 +++++++++--------- src/Datagrid/SimplePager.php | 4 +- .../Admin/AbstractTaggedAdmin.php | 96 ++++++------- src/Filter/Filter.php | 10 +- src/Util/FormBuilderIterator.php | 2 +- tests/Datagrid/PagerTest.php | 44 +++--- tests/Util/FormBuilderIteratorTest.php | 2 +- 9 files changed, 147 insertions(+), 147 deletions(-) diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index b9f41491bc..c8f59a0b21 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -525,7 +525,7 @@ public function validate(ErrorElement $errorElement, $object) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function initialize() { @@ -2122,7 +2122,7 @@ public function getClassnameLabel() if (null === $this->classnameLabel) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no classname label is set is deprecated since sonata-project/admin-bundle 3.x' + '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); diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 434b960af7..5897a2d9e6 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -382,7 +382,7 @@ public function getDataSourceIterator(); /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-admin/admin-bundle 3.x + * @deprecated since sonata-admin/admin-bundle 3.84 * * @return void */ diff --git a/src/Datagrid/Pager.php b/src/Datagrid/Pager.php index 6f5d32b4fc..89b9862e8c 100644 --- a/src/Datagrid/Pager.php +++ b/src/Datagrid/Pager.php @@ -47,7 +47,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @var int */ @@ -56,7 +56,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @var array */ @@ -65,7 +65,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @var int */ @@ -74,7 +74,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @var mixed bool|int */ @@ -88,7 +88,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Used by iterator interface * @@ -99,7 +99,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Used by iterator interface * @@ -115,7 +115,7 @@ abstract class Pager implements \Iterator, \Countable, \Serializable, PagerInter /** * NEXT_MAJOR: Remove this property. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @var string[] */ @@ -132,7 +132,7 @@ public function __construct($maxPerPage = 10) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the current pager's max link. * @@ -141,7 +141,7 @@ public function __construct($maxPerPage = 10) public function getCurrentMaxLink() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -151,7 +151,7 @@ public function getCurrentMaxLink() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the current pager's max record limit. * @@ -160,7 +160,7 @@ public function getCurrentMaxLink() public function getMaxRecordLimit() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -170,7 +170,7 @@ public function getMaxRecordLimit() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Sets the current pager's max record limit. * @@ -179,7 +179,7 @@ public function getMaxRecordLimit() public function setMaxRecordLimit($limit) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -228,7 +228,7 @@ public function haveToPaginate() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the current cursor. * @@ -237,7 +237,7 @@ public function haveToPaginate() public function getCursor() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -247,7 +247,7 @@ public function getCursor() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Sets the current cursor. * @@ -256,7 +256,7 @@ public function getCursor() public function setCursor($pos) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -274,7 +274,7 @@ public function setCursor($pos) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns an object by cursor position. * @@ -285,7 +285,7 @@ public function setCursor($pos) public function getObjectByCursor($pos) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -297,7 +297,7 @@ public function getObjectByCursor($pos) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the current object. * @@ -306,7 +306,7 @@ public function getObjectByCursor($pos) public function getCurrent() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -316,7 +316,7 @@ public function getCurrent() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the next object. * @@ -325,7 +325,7 @@ public function getCurrent() public function getNext() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -339,7 +339,7 @@ public function getNext() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the previous object. * @@ -348,7 +348,7 @@ public function getNext() public function getPrevious() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -362,7 +362,7 @@ public function getPrevious() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the first index on the current page. * @@ -371,7 +371,7 @@ public function getPrevious() public function getFirstIndex() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -401,7 +401,7 @@ public function getFirstIndice() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the last index on the current page. * @@ -410,7 +410,7 @@ public function getFirstIndice() public function getLastIndex() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -556,7 +556,7 @@ public function isLastPage() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns the current pager's parameter holder. * @@ -565,7 +565,7 @@ public function isLastPage() public function getParameters() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -575,7 +575,7 @@ public function getParameters() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns a parameter. * @@ -587,7 +587,7 @@ public function getParameters() public function getParameter($name, $default = null) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -597,7 +597,7 @@ public function getParameter($name, $default = null) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Checks whether a parameter has been set. * @@ -608,7 +608,7 @@ public function getParameter($name, $default = null) public function hasParameter($name) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -618,7 +618,7 @@ public function hasParameter($name) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Sets a parameter. * @@ -628,7 +628,7 @@ public function hasParameter($name) public function setParameter($name, $value) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -638,12 +638,12 @@ public function setParameter($name, $value) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function current() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -657,12 +657,12 @@ public function current() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function key() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -676,12 +676,12 @@ public function key() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function next() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -698,12 +698,12 @@ public function next() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function rewind() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -720,12 +720,12 @@ public function rewind() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function valid() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -739,12 +739,12 @@ public function valid() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x, use getNbResults instead + * @deprecated since sonata-project/admin-bundle 3.84, use getNbResults instead */ public function count() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -754,12 +754,12 @@ public function count() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function serialize() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -772,12 +772,12 @@ public function serialize() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ public function unserialize($serialized) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -791,14 +791,14 @@ public function unserialize($serialized) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @return string[] */ public function getCountColumn() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -808,14 +808,14 @@ public function getCountColumn() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * @return string[] */ public function setCountColumn(array $countColumn) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -863,7 +863,7 @@ protected function setLastPage($page) /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Returns true if the properties used for iteration have been initialized. * @@ -872,7 +872,7 @@ protected function setLastPage($page) protected function isIteratorInitialized() { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); @@ -882,7 +882,7 @@ protected function isIteratorInitialized() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Loads data into properties used for iteration. * @@ -892,7 +892,7 @@ protected function initializeIterator() { if ('sonata_deprecation_mute' !== (\func_get_args()[0] ?? null)) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } @@ -904,7 +904,7 @@ protected function initializeIterator() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Empties properties used for iteration. * @@ -914,7 +914,7 @@ protected function resetIterator() { if ('sonata_deprecation_mute' !== (\func_get_args()[0] ?? null)) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } @@ -926,7 +926,7 @@ protected function resetIterator() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 * * Retrieve the object for a certain offset. * @@ -937,7 +937,7 @@ protected function resetIterator() protected function retrieveObject($offset) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); diff --git a/src/Datagrid/SimplePager.php b/src/Datagrid/SimplePager.php index d08e154c99..81e1617cb2 100644 --- a/src/Datagrid/SimplePager.php +++ b/src/Datagrid/SimplePager.php @@ -159,13 +159,13 @@ public function getThreshold() /** * NEXT_MAJOR: Remove this method. * - * @deprecated since sonata-project/admin-bundle 3.x + * @deprecated since sonata-project/admin-bundle 3.84 */ protected function resetIterator() { if ('sonata_deprecation_mute' !== (\func_get_args()[0] ?? null)) { @trigger_error(sprintf( - 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.', + 'The method "%s()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.', __METHOD__ ), E_USER_DEPRECATED); } diff --git a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php index d02f321b95..31a885ecf2 100644 --- a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php +++ b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php @@ -227,7 +227,7 @@ public function __construct($code, $class, $baseControllerName = null) if (!\is_string($baseControllerName)) { @trigger_error(sprintf( 'Passing other type than string as argument 3 for method %s() is deprecated since' - .' sonata-project/admin-bundle 3.x. It will accept only string in version 4.0.', + .' sonata-project/admin-bundle 3.84. It will accept only string in version 4.0.', __METHOD__ ), E_USER_DEPRECATED); } @@ -237,7 +237,7 @@ public function __construct($code, $class, $baseControllerName = null) abstract public function initialize(); /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setLabel($label) { @@ -245,7 +245,7 @@ public function setLabel($label) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getLabel() { @@ -262,7 +262,7 @@ final public function showMosaicButton($isShown) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getListModes() { @@ -270,7 +270,7 @@ public function getListModes() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setPagerType($pagerType) { @@ -278,7 +278,7 @@ public function setPagerType($pagerType) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 * * @return string */ @@ -288,7 +288,7 @@ public function getPagerType() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setManagerType($type) { @@ -296,14 +296,14 @@ public function setManagerType($type) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getManagerType() { if (null === $this->managerType) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no manager type is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -317,7 +317,7 @@ public function getManagerType() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setSecurityInformation(array $information) { @@ -325,7 +325,7 @@ public function setSecurityInformation(array $information) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getSecurityInformation() { @@ -333,7 +333,7 @@ public function getSecurityInformation() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setFilterPersister(?FilterPersisterInterface $filterPersister = null) { @@ -357,7 +357,7 @@ final public function hasFilterPersister(): bool } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setModelManager(ModelManagerInterface $modelManager) { @@ -365,14 +365,14 @@ public function setModelManager(ModelManagerInterface $modelManager) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getModelManager() { if (null === $this->modelManager) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no model manager is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -386,7 +386,7 @@ public function getModelManager() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setDataSource(DataSourceInterface $dataSource) { @@ -401,7 +401,7 @@ public function getDataSource(): ?DataSourceInterface if (null === $this->dataSource) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no data source is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -415,7 +415,7 @@ public function getDataSource(): ?DataSourceInterface } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setFormContractor(FormContractorInterface $formBuilder) { @@ -423,14 +423,14 @@ public function setFormContractor(FormContractorInterface $formBuilder) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getFormContractor() { if (null === $this->formContractor) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no form contractor is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -444,7 +444,7 @@ public function getFormContractor() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setShowBuilder(ShowBuilderInterface $showBuilder) { @@ -452,14 +452,14 @@ public function setShowBuilder(ShowBuilderInterface $showBuilder) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getShowBuilder() { if (null === $this->showBuilder) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no show builder is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -473,7 +473,7 @@ public function getShowBuilder() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setListBuilder(ListBuilderInterface $listBuilder) { @@ -481,14 +481,14 @@ public function setListBuilder(ListBuilderInterface $listBuilder) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getListBuilder() { if (null === $this->listBuilder) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no list build is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -502,7 +502,7 @@ public function getListBuilder() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder) { @@ -510,14 +510,14 @@ public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getDatagridBuilder() { if (null === $this->datagridBuilder) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no datagrid builder is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -546,7 +546,7 @@ public function getTranslator() if (null === $this->translator) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no translator is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -560,7 +560,7 @@ public function getTranslator() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setConfigurationPool(Pool $configurationPool) { @@ -568,7 +568,7 @@ public function setConfigurationPool(Pool $configurationPool) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getConfigurationPool() { @@ -576,7 +576,7 @@ public function getConfigurationPool() // NEXT_MAJOR: Remove this deprecation and uncomment the following exception if ('sonata_deprecation_mute' !== (\func_get_args()[0] ?? null)) { @trigger_error(sprintf( - 'Calling %s() when no pool is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -591,7 +591,7 @@ public function getConfigurationPool() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setRouteGenerator(RouteGeneratorInterface $routeGenerator) { @@ -599,14 +599,14 @@ public function setRouteGenerator(RouteGeneratorInterface $routeGenerator) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getRouteGenerator() { if (null === $this->routeGenerator) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no route generator is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -653,7 +653,7 @@ public function getValidator() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setSecurityHandler(SecurityHandlerInterface $securityHandler) { @@ -661,14 +661,14 @@ public function setSecurityHandler(SecurityHandlerInterface $securityHandler) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getSecurityHandler() { if (null === $this->securityHandler) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no security handler is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -682,7 +682,7 @@ public function getSecurityHandler() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setMenuFactory(FactoryInterface $menuFactory) { @@ -690,14 +690,14 @@ public function setMenuFactory(FactoryInterface $menuFactory) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getMenuFactory() { if (null === $this->menuFactory) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no security handler is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -711,7 +711,7 @@ public function getMenuFactory() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setRouteBuilder(RouteBuilderInterface $routeBuilder) { @@ -719,14 +719,14 @@ public function setRouteBuilder(RouteBuilderInterface $routeBuilder) } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getRouteBuilder() { if (null === $this->routeBuilder) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no route builder is set is deprecated since sonata-project/admin-bundle 3.x' + '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); @@ -740,7 +740,7 @@ public function getRouteBuilder() } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy) { @@ -748,14 +748,14 @@ public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $lab } /** - * @final since sonata-admin/admin-bundle 3.x + * @final since sonata-admin/admin-bundle 3.84 */ public function getLabelTranslatorStrategy() { if (null === $this->labelTranslatorStrategy) { // NEXT_MAJOR: Remove this deprecation and uncomment the following exception @trigger_error(sprintf( - 'Calling %s() when no label translator strategy is set is deprecated since sonata-project/admin-bundle 3.x' + '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); diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index 3a3eef4e9b..f18c523100 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -30,7 +30,7 @@ abstract class Filter implements FilterInterface * * @var mixed|null * - * @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0. + * @deprecated since sonata-project/admin-bundle 3.84, to be removed in 4.0. */ protected $value; @@ -194,12 +194,12 @@ public function getOptions() * * @param mixed $value * - * @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0. + * @deprecated since sonata-project/admin-bundle 3.84, to be removed in 4.0. */ public function setValue($value) { @trigger_error(sprintf( - 'Method %s() is deprecated since sonata-project/admin-bundle 3.x and will be removed in version 4.0.', + 'Method %s() is deprecated since sonata-project/admin-bundle 3.84 and will be removed in version 4.0.', __METHOD__, ), E_USER_DEPRECATED); @@ -211,12 +211,12 @@ public function setValue($value) * * @return mixed * - * @deprecated since sonata-project/admin-bundle 3.x, to be removed in 4.0. + * @deprecated since sonata-project/admin-bundle 3.84, to be removed in 4.0. */ public function getValue() { @trigger_error(sprintf( - 'Method %s() is deprecated since sonata-project/admin-bundle 3.x and will be removed in version 4.0.', + 'Method %s() is deprecated since sonata-project/admin-bundle 3.84 and will be removed in version 4.0.', __METHOD__, ), E_USER_DEPRECATED); diff --git a/src/Util/FormBuilderIterator.php b/src/Util/FormBuilderIterator.php index 3c97587bc5..5d45dda05a 100644 --- a/src/Util/FormBuilderIterator.php +++ b/src/Util/FormBuilderIterator.php @@ -61,7 +61,7 @@ public function __construct(FormBuilderInterface $formBuilder, $prefix = null) if (null !== $prefix && !\is_string($prefix)) { @trigger_error(sprintf( 'Passing other type than string or null as argument 2 for method %s() is deprecated since' - .' sonata-project/admin-bundle 3.x. It will accept only string and null in version 4.0.', + .' sonata-project/admin-bundle 3.84. It will accept only string and null in version 4.0.', __METHOD__ ), E_USER_DEPRECATED); } diff --git a/tests/Datagrid/PagerTest.php b/tests/Datagrid/PagerTest.php index a4d770977b..37e9247deb 100644 --- a/tests/Datagrid/PagerTest.php +++ b/tests/Datagrid/PagerTest.php @@ -107,7 +107,7 @@ public function testGetMaxPerPage3(): void */ public function testGetCurrentMaxLink(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCurrentMaxLink()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCurrentMaxLink()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(1, $this->pager->getCurrentMaxLink()); $this->pager->getLinks(); @@ -129,7 +129,7 @@ public function testGetCurrentMaxLink(): void */ public function testGetMaxRecordLimit(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getMaxRecordLimit()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getMaxRecordLimit()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertFalse($this->pager->getMaxRecordLimit()); $this->pager->setMaxRecordLimit(99); @@ -152,7 +152,7 @@ public function testGetNbResults(): void */ public function testCount(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::count()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::count()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(0, $this->pager->count()); $this->callMethod($this->pager, 'setNbResults', [100]); @@ -175,10 +175,10 @@ public function testGetQuery(): void */ public function testGetCountColumn(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCountColumn()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCountColumn()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(['id'], $this->pager->getCountColumn()); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::setCountColumn()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::setCountColumn()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->pager->setCountColumn(['foo']); $this->assertSame(['foo'], $this->pager->getCountColumn()); } @@ -190,14 +190,14 @@ public function testGetCountColumn(): void */ public function testParameters(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getParameter()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getParameter()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertNull($this->pager->getParameter('foo', null)); $this->assertSame('bar', $this->pager->getParameter('foo', 'bar')); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::hasParameter()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::hasParameter()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertFalse($this->pager->hasParameter('foo')); $this->assertSame([], $this->pager->getParameters()); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::setParameter()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::setParameter()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->pager->setParameter('foo', 'foo_value'); $this->assertTrue($this->pager->hasParameter('foo')); @@ -332,7 +332,7 @@ public function testIterator(): void $this->assertSame($object3, $value); $this->assertSame($expectedObjects, $values); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::valid()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::valid()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertFalse($this->pager->valid()); $this->callMethod($this->pager, 'resetIterator'); @@ -350,7 +350,7 @@ public function testValid(): void ->method('getResults') ->willReturn([]); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::valid()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::valid()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertFalse($this->pager->valid()); } @@ -365,7 +365,7 @@ public function testNext(): void ->method('getResults') ->willReturn([]); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::next()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::next()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertFalse($this->pager->next()); } @@ -380,7 +380,7 @@ public function testKey(): void ->method('getResults') ->willReturn([123 => new \stdClass()]); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::key()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::key()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(123, $this->pager->key()); } @@ -397,7 +397,7 @@ public function testCurrent(): void ->method('getResults') ->willReturn([$object]); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::current()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::current()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame($object, $this->pager->current()); } @@ -408,7 +408,7 @@ public function testCurrent(): void */ public function testGetCursor(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCursor()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCursor()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(1, $this->pager->getCursor()); $this->pager->setCursor(0); @@ -474,9 +474,9 @@ public function testGetObjectByCursor(): void $this->pager->setQuery($query); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getObjectByCursor()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getObjectByCursor()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame($object1, $this->pager->getObjectByCursor(1)); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCursor()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getCursor()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(1, $this->pager->getCursor()); $id = 1; @@ -527,7 +527,7 @@ public function testGetPreviousPage(): void */ public function testGetFirstIndex(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getFirstIndex()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getFirstIndex()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(1, $this->pager->getFirstIndex()); $this->pager->setMaxPerPage(0); @@ -550,7 +550,7 @@ public function testGetFirstIndex(): void */ public function testGetLastIndex(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getLastIndex()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getLastIndex()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertSame(0, $this->pager->getLastIndex()); $this->pager->setMaxPerPage(0); @@ -578,7 +578,7 @@ public function testGetLastIndex(): void */ public function testGetNext(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getNext()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getNext()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertNull($this->pager->getNext()); $object1 = new \stdClass(); @@ -642,7 +642,7 @@ public function testGetNext(): void */ public function testGetPrevious(): void { - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getPrevious()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::getPrevious()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->assertNull($this->pager->getPrevious()); $object1 = new \stdClass(); @@ -707,7 +707,7 @@ public function testGetPrevious(): void public function testSerialize(): void { $pagerClone = clone $this->pager; - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::serialize()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::serialize()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $data = $this->pager->serialize(); $this->assertNotEmpty($data); @@ -746,7 +746,7 @@ public function testUnserialize(): void ->willReturn([]); $this->pager->current(); - $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::unserialize()" is deprecated since sonata-project/admin-bundle 3.x and will be removed in 4.0.'); + $this->expectDeprecation('The method "Sonata\AdminBundle\Datagrid\Pager::unserialize()" is deprecated since sonata-project/admin-bundle 3.84 and will be removed in 4.0.'); $this->pager->unserialize(serialize($serialized)); $this->assertSame(7, $this->pager->getMaxPerPage()); diff --git a/tests/Util/FormBuilderIteratorTest.php b/tests/Util/FormBuilderIteratorTest.php index 679295a0b4..0c83ce81d4 100644 --- a/tests/Util/FormBuilderIteratorTest.php +++ b/tests/Util/FormBuilderIteratorTest.php @@ -80,7 +80,7 @@ public function testHasChildren(): void */ public function testTriggersADeprecationWithWrongPrefixType(): void { - $this->expectDeprecation('Passing other type than string or null as argument 2 for method Sonata\AdminBundle\Util\FormBuilderIterator::__construct() is deprecated since sonata-project/admin-bundle 3.x. It will accept only string and null in version 4.0.'); + $this->expectDeprecation('Passing other type than string or null as argument 2 for method Sonata\AdminBundle\Util\FormBuilderIterator::__construct() is deprecated since sonata-project/admin-bundle 3.84. It will accept only string and null in version 4.0.'); $this->builder->add('name', TextType::class); $iterator = new FormBuilderIterator($this->builder, new \stdClass()); From ace22a994df9d666952042f58ec14724be4412a2 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 16 Dec 2020 23:41:43 +0100 Subject: [PATCH 3/6] Fix signature --- src/Datagrid/PagerInterface.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Datagrid/PagerInterface.php b/src/Datagrid/PagerInterface.php index c9b422c5e1..ef612541a6 100644 --- a/src/Datagrid/PagerInterface.php +++ b/src/Datagrid/PagerInterface.php @@ -18,17 +18,17 @@ * * NEXT_MAJOR: Remove these comments and uncomment corresponding methods. * - * @method int getPage() - * @method int getFirstPage() - * @method int getLastPage() - * @method int getNextPage() - * @method int getPreviousPage() - * @method bool isFirstPage() - * @method bool isLastPage() - * @method int getNbResults() - * @method array getLinks(?int $nbLinks = null) - * @method bool haveToPaginate() - * @method ProxyQueryInterface getQuery() + * @method int getPage() + * @method int getFirstPage() + * @method int getLastPage() + * @method int getNextPage() + * @method int getPreviousPage() + * @method bool isFirstPage() + * @method bool isLastPage() + * @method int getNbResults() + * @method array getLinks(?int $nbLinks = null) + * @method bool haveToPaginate() + * @method ProxyQueryInterface|null getQuery() */ interface PagerInterface { @@ -78,7 +78,7 @@ public function setPage($page); // public function isLastPage(): bool; // NEXT_MAJOR: uncomment this method in 4.0 -// public function getQuery(): ProxyQueryInterface; +// public function getQuery(): ?ProxyQueryInterface; /** * @param ProxyQueryInterface $query From 30918078081c139103b5ea7dc47384b6ccfcc4ea Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Thu, 17 Dec 2020 00:17:19 +0100 Subject: [PATCH 4/6] Minor improvements --- phpstan-baseline.neon | 2 +- src/Admin/AbstractAdmin.php | 4 ++-- src/DependencyInjection/Admin/AbstractTaggedAdmin.php | 6 ++++++ src/DependencyInjection/Admin/TaggedAdminInterface.php | 2 ++ src/Security/Handler/AclSecurityHandlerInterface.php | 3 ++- src/Security/Handler/SecurityHandlerInterface.php | 2 +- src/Util/AdminObjectAclData.php | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 446958d64d..d57283ad69 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -159,7 +159,7 @@ parameters: - # will be fixed in v4. Currently BC break - message: "#^Method Sonata\\\\AdminBundle\\\\Translator\\\\Extractor\\\\JMSTranslatorBundle\\\\AdminExtractor\\:\\:buildSecurityInformation\\(\\) should return array\\ but return statement is missing\\.$#" + message: "#^Method Sonata\\\\AdminBundle\\\\Translator\\\\Extractor\\\\JMSTranslatorBundle\\\\AdminExtractor\\:\\:buildSecurityInformation\\(\\) should return array\\\\> but return statement is missing\\.$#" count: 1 path: src/Translator/Extractor/JMSTranslatorBundle/AdminExtractor.php diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index c8f59a0b21..2c37b6634a 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -1177,12 +1177,12 @@ public function generateObjectUrl($name, $object, array $parameters = [], $refer public function generateUrl($name, array $parameters = [], $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH) { - return $this->routeGenerator->generateUrl($this, $name, $parameters, $referenceType); + return $this->getRouteGenerator()->generateUrl($this, $name, $parameters, $referenceType); } public function generateMenuUrl($name, array $parameters = [], $referenceType = RoutingUrlGeneratorInterface::ABSOLUTE_PATH) { - return $this->routeGenerator->generateMenuUrl($this, $name, $parameters, $referenceType); + return $this->getRouteGenerator()->generateMenuUrl($this, $name, $parameters, $referenceType); } final public function setTemplateRegistry(MutableTemplateRegistryInterface $templateRegistry): void diff --git a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php index 31a885ecf2..f82f85ebd1 100644 --- a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php +++ b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php @@ -68,6 +68,8 @@ abstract class AbstractTaggedAdmin implements TaggedAdminInterface /** * @var array> + * + * @phpstan-var array{list: array{class: string}, mosaic: array{class: string}} */ protected $listModes = [ 'list' => ['class' => 'fa fa-list fa-fw'], @@ -318,6 +320,8 @@ public function getManagerType() /** * @final since sonata-admin/admin-bundle 3.84 + * + * @param array $information */ public function setSecurityInformation(array $information) { @@ -326,6 +330,8 @@ public function setSecurityInformation(array $information) /** * @final since sonata-admin/admin-bundle 3.84 + * + * @return array */ public function getSecurityInformation() { diff --git a/src/DependencyInjection/Admin/TaggedAdminInterface.php b/src/DependencyInjection/Admin/TaggedAdminInterface.php index 9c394cc24f..8ec4f8e586 100644 --- a/src/DependencyInjection/Admin/TaggedAdminInterface.php +++ b/src/DependencyInjection/Admin/TaggedAdminInterface.php @@ -120,6 +120,8 @@ public function getManagerType(); * NEXT_MAJOR: Uncomment this method. * * Set the roles and permissions per role. + * + * @param array $information */ // public function setSecurityInformation(array $information): void; diff --git a/src/Security/Handler/AclSecurityHandlerInterface.php b/src/Security/Handler/AclSecurityHandlerInterface.php index 466561e267..8d69156b0a 100644 --- a/src/Security/Handler/AclSecurityHandlerInterface.php +++ b/src/Security/Handler/AclSecurityHandlerInterface.php @@ -86,7 +86,8 @@ public function addObjectOwner(AclInterface $acl, ?UserSecurityIdentity $securit * * NEXT_MAJOR: change signature to `addObjectClassAces(MutableAclInterface $acl, array $roleInformation = []): void`. * - * @param MutableAclInterface $acl + * @param MutableAclInterface $acl + * @param array $roleInformation * * @return void */ diff --git a/src/Security/Handler/SecurityHandlerInterface.php b/src/Security/Handler/SecurityHandlerInterface.php index f937b9cebd..3ee14696fa 100644 --- a/src/Security/Handler/SecurityHandlerInterface.php +++ b/src/Security/Handler/SecurityHandlerInterface.php @@ -36,7 +36,7 @@ public function isGranted(AdminInterface $admin, $attributes, $object = null); public function getBaseRole(AdminInterface $admin); /** - * @return array + * @return array */ public function buildSecurityInformation(AdminInterface $admin); diff --git a/src/Util/AdminObjectAclData.php b/src/Util/AdminObjectAclData.php index 48c816a9e2..e33a2495a4 100644 --- a/src/Util/AdminObjectAclData.php +++ b/src/Util/AdminObjectAclData.php @@ -321,7 +321,7 @@ public function getSecurityHandler() } /** - * @return array + * @return array */ public function getSecurityInformation() { From 34f10d6d06955e9e47b4bcabff8d6ab4c3613002 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 29 Dec 2020 20:04:33 +0100 Subject: [PATCH 5/6] Remove useless template --- src/Admin/AdminInterface.php | 1 - src/DependencyInjection/Admin/AbstractTaggedAdmin.php | 1 - src/DependencyInjection/Admin/TaggedAdminInterface.php | 2 -- 3 files changed, 4 deletions(-) diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 5897a2d9e6..f5db9f6e7b 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -52,7 +52,6 @@ * @method void defineFormBuilder(FormBuilderInterface $formBuilder) * * @phpstan-template T of object - * @phpstan-extends TaggedAdminInterface * @phpstan-extends AccessRegistryInterface * @phpstan-extends UrlGeneratorInterface * @phpstan-extends LifecycleHookProviderInterface diff --git a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php index f82f85ebd1..835c55b998 100644 --- a/src/DependencyInjection/Admin/AbstractTaggedAdmin.php +++ b/src/DependencyInjection/Admin/AbstractTaggedAdmin.php @@ -32,7 +32,6 @@ /** * @phpstan-template T of object - * @phpstan-implements TaggedAdminInterface */ abstract class AbstractTaggedAdmin implements TaggedAdminInterface { diff --git a/src/DependencyInjection/Admin/TaggedAdminInterface.php b/src/DependencyInjection/Admin/TaggedAdminInterface.php index 8ec4f8e586..49b80e0e1f 100644 --- a/src/DependencyInjection/Admin/TaggedAdminInterface.php +++ b/src/DependencyInjection/Admin/TaggedAdminInterface.php @@ -41,8 +41,6 @@ * - The first and third argument are automatically injected by the AddDependencyCallsCompilerPass. * - The second one is used as a reference of the Admin in the Pool, with the `setAdminClasses` call. * - * @phpstan-template T of object - * * @method void initialize() * @method void setLabel(?string $label) * @method void showMosaicButton(bool $isShown) From 139d6c339c65c5c2f7c996891eeefb6e32611185 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 29 Dec 2020 20:55:15 +0100 Subject: [PATCH 6/6] Fix psalm issue --- src/Util/FormViewIterator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Util/FormViewIterator.php b/src/Util/FormViewIterator.php index 9fccc04a4c..d2d9b0e8bb 100644 --- a/src/Util/FormViewIterator.php +++ b/src/Util/FormViewIterator.php @@ -42,6 +42,9 @@ public function hasChildren() return \count($this->current()->children) > 0; } + /** + * @return FormView + */ public function current() { return $this->iterator->current();