diff --git a/package_manager/src/Stage.php b/package_manager/src/Stage.php index 7e5188ba00d4360178bd578e25df7af274e73131..f04fa31b2dd56cd4259f92afb18e6f03c0648015 100644 --- a/package_manager/src/Stage.php +++ b/package_manager/src/Stage.php @@ -240,6 +240,12 @@ class Stage implements LoggerAwareInterface { } $this->failureMarker = $failure_marker; $this->setLogger(new NullLogger()); + if (self::TEMPSTORE_METADATA_KEY !== static::TEMPSTORE_METADATA_KEY) { + @trigger_error('Overriding ' . __CLASS__ . '::TEMPSTORE_METADATA_KEY is deprecated in automatic_updates:8.x-2.5 and will not be possible in automatic_updates:3.0.0. There is no replacement. See https://www.drupal.org/node/3317450.', E_USER_DEPRECATED); + } + if (self::TEMPSTORE_LOCK_KEY !== static::TEMPSTORE_LOCK_KEY) { + @trigger_error('Overriding ' . __CLASS__ . '::TEMPSTORE_LOCK_KEY is deprecated in automatic_updates:8.x-2.5 and will not be possible in automatic_updates:3.0.0. There is no replacement. See https://www.drupal.org/node/3317450.', E_USER_DEPRECATED); + } } /** diff --git a/package_manager/tests/src/Kernel/StageTest.php b/package_manager/tests/src/Kernel/StageTest.php index 392d1eea7b8c6e87a4164c8cc00e2f77ede6b6cc..0c955bfebf8beb3228deb1991ae66315f50fe33a 100644 --- a/package_manager/tests/src/Kernel/StageTest.php +++ b/package_manager/tests/src/Kernel/StageTest.php @@ -395,7 +395,9 @@ class StageTest extends PackageManagerKernelTestBase { public function testConstructorDeprecations(): void { $this->expectDeprecation('Calling Drupal\package_manager\Stage::__construct() without the $path_factory argument is deprecated in automatic_updates:8.x-2.3 and will be required before automatic_updates:3.0.0. See https://www.drupal.org/node/3310706.'); $this->expectDeprecation('Calling Drupal\package_manager\Stage::__construct() without the $failure_marker argument is deprecated in automatic_updates:8.x-2.3 and will be required before automatic_updates:3.0.0. See https://www.drupal.org/node/3311257.'); - new Stage( + $this->expectDeprecation('Overriding Drupal\package_manager\Stage::TEMPSTORE_METADATA_KEY is deprecated in automatic_updates:8.x-2.5 and will not be possible in automatic_updates:3.0.0. There is no replacement. See https://www.drupal.org/node/3317450.'); + $this->expectDeprecation('Overriding Drupal\package_manager\Stage::TEMPSTORE_LOCK_KEY is deprecated in automatic_updates:8.x-2.5 and will not be possible in automatic_updates:3.0.0. There is no replacement. See https://www.drupal.org/node/3317450.'); + new TestStageOverriddenConstants( $this->container->get('config.factory'), $this->container->get('package_manager.path_locator'), $this->container->get('package_manager.beginner'), @@ -496,3 +498,17 @@ class TestTime extends Time { } } + +class TestStageOverriddenConstants extends Stage { + + /** + * {@inheritdoc} + */ + protected const TEMPSTORE_LOCK_KEY = 'overridden_lock'; + + /** + * {@inheritdoc} + */ + protected const TEMPSTORE_METADATA_KEY = 'overridden_metadata'; + +}