Skip to content
Snippets Groups Projects
Verified Commit fd2c1341 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3048495 by jonathan1055, quietone, rajandro, Spokje, Pooja Ganjage,...

Issue #3048495 by jonathan1055, quietone, rajandro, Spokje, Pooja Ganjage, andypost, kishor_kolekar, msuthars, munish.kumar, ankithashetty, ayushmishra206, ravi.shankar, naveenvalecha, longwave, Gábor Hojtsy, alexpott, smustgrave, Lendude, xjm, adityasingh, daffie: Fix Drupal.Semantics.FunctionTriggerError coding standard
parent dff46835
No related branches found
No related tags found
42 merge requests!12227Issue #3181946 by jonmcl, mglaman,!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3478Issue #3337882: Deleted menus are not removed from content type config,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!213Issue #2906496: Give Media a menu item under Content
Pipeline #23863 failed
Showing
with 21 additions and 12 deletions
......@@ -17,6 +17,7 @@
* @see https://www.drupal.org/project/drupal/issues/2870194
*/
function deprecation_test_function() {
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('This is the deprecation message for deprecation_test_function().', E_USER_DEPRECATED);
return 'known_return_value';
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\deprecation_test\Deprecation;
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error(__NAMESPACE__ . '\DrupalStandardsListenerDeprecatedClass is deprecated.', E_USER_DEPRECATED);
/**
......
......@@ -2,6 +2,7 @@
namespace Drupal\deprecation_test\Deprecation;
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error(__NAMESPACE__ . '\FixtureDeprecatedClass is deprecated.', E_USER_DEPRECATED);
/**
......
......@@ -226,7 +226,9 @@ public function renderPageWithoutDuplicateIds() {
public function deprecations() {
// Create 2 identical deprecation messages. This should only trigger a
// single response header.
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('Test deprecation message', E_USER_DEPRECATED);
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('Test deprecation message', E_USER_DEPRECATED);
return [
'#markup' => 'Content that triggers deprecation messages',
......
......@@ -625,7 +625,7 @@ public function testReferencedEntity() {
* @see https://www.drupal.org/node/3354596
*/
protected function createCacheId(array $keys, array $contexts) {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See: https://www.drupal.org/project/drupal/issues/2551419.', E_USER_DEPRECATED);
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3354596', E_USER_DEPRECATED);
$cid_parts = $keys;
$contexts = \Drupal::service('cache_contexts_manager')->convertTokensToKeys($contexts);
......
......@@ -2,7 +2,7 @@
namespace Drupal\tour;
@trigger_error('The ' . __NAMESPACE__ . '\TourTipPluginInterface is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Implement ' . __NAMESPACE__ . '\TipPluginInterface instead. See https://www.drupal.org/node/3340701.', E_USER_DEPRECATED);
@trigger_error('The ' . __NAMESPACE__ . '\TourTipPluginInterface is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Implement ' . __NAMESPACE__ . '\TipPluginInterface instead. See https://www.drupal.org/node/3340701', E_USER_DEPRECATED);
/**
* Defines an interface for tour items.
......
......@@ -15,7 +15,7 @@ class TourTipLegacyTest extends TestCase {
use ExpectDeprecationTrait;
public function testPluginHelperDeprecation(): void {
$this->expectDeprecation('The Drupal\tour\TourTipPluginInterface is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Implement Drupal\tour\TipPluginInterface instead. See https://www.drupal.org/node/3340701.');
$this->expectDeprecation('The Drupal\tour\TourTipPluginInterface is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Implement Drupal\tour\TipPluginInterface instead. See https://www.drupal.org/node/3340701');
$plugin = $this->createMock(TourTipPluginInterface::class);
$this->assertInstanceOf(TourTipPluginInterface::class, $plugin);
}
......
......@@ -85,7 +85,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Con
$this->workspaceAssociation = $workspace_association;
$this->cacheTagsInvalidator = $cache_tags_invalidator;
if (!$event_dispatcher) {
@trigger_error('The event dispatcher service should be passed to WorkspaceOperationFactory::__construct() since 10.1.0. This will be required in Drupal 11.0.0.', E_USER_DEPRECATED);
@trigger_error('Calling ' . __METHOD__ . '() without the $event_dispatcher argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3242573', E_USER_DEPRECATED);
$event_dispatcher = \Drupal::service('event_dispatcher');
}
$this->eventDispatcher = $event_dispatcher;
......
......@@ -123,6 +123,7 @@
<rule ref="Drupal.Semantics.FunctionT">
<exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
</rule>
<rule ref="Drupal.Semantics.FunctionTriggerError"/>
<rule ref="Drupal.Semantics.FunctionWatchdog"/>
<rule ref="Drupal.Semantics.InstallHooks"/>
<rule ref="Drupal.Semantics.LStringTranslatable"/>
......
......@@ -112,6 +112,7 @@ protected function tearDown(): void {
$warnings = $this->getSession()->evaluateScript("JSON.parse(sessionStorage.getItem('js_testing_log_test.warnings') || JSON.stringify([]))");
foreach ($warnings as $warning) {
if (str_starts_with($warning, '[Deprecation]')) {
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('Javascript Deprecation:' . substr($warning, 13), E_USER_DEPRECATED);
}
}
......
......@@ -545,16 +545,16 @@ public function testResourceDeprecation() {
$image = imagecreate(10, 10);
$this->expectDeprecation('Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::setImage() instead. See https://www.drupal.org/node/3265963');
$toolkit->setResource($image);
$this->expectDeprecation('Checking the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.');
$this->expectDeprecation('Checking the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead. See https://www.drupal.org/node/3265963');
$this->assertTrue(isset($toolkit->resource));
$this->expectDeprecation('Drupal\system\Plugin\ImageToolkit\GDToolkit::getResource() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::getImage() instead. See https://www.drupal.org/node/3265963');
$this->assertSame($image, $toolkit->getResource());
$this->expectDeprecation('Accessing the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.');
$this->expectDeprecation('Accessing the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead. See https://www.drupal.org/node/3265963');
$this->assertSame($image, $toolkit->resource);
$this->expectDeprecation('Setting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.');
$this->expectDeprecation('Setting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead. See https://www.drupal.org/node/3265963');
$toolkit->resource = NULL;
$this->assertNull($toolkit->getImage());
$this->expectDeprecation('Unsetting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead.');
$this->expectDeprecation('Unsetting the \Drupal\system\Plugin\ImageToolkit\GDToolkit::resource property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::image instead. See https://www.drupal.org/node/3265963');
$toolkit->setImage($image);
unset($toolkit->resource);
$this->assertNull($toolkit->getImage());
......
......@@ -16,7 +16,7 @@ class PluginHelperLegacyTest extends TestCase {
use ExpectDeprecationTrait;
public function testPluginHelperDeprecation(): void {
$this->expectDeprecation('The Drupal\Component\Plugin\PluginHelper is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use instanceof() to check for \Drupal\Component\Plugin\ConfigurableInterface. See http://drupal.org/node/3198285');
$this->expectDeprecation('The Drupal\Component\Plugin\PluginHelper is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use instanceof() to check for \Drupal\Component\Plugin\ConfigurableInterface. See https://www.drupal.org/node/3198285');
$this->assertEquals($this instanceof ConfigurableInterface, PluginHelper::isConfigurable($this));
$plugin = $this->createMock(ConfigurableInterface::class);
$this->assertEquals($plugin instanceof ConfigurableInterface, PluginHelper::isConfigurable($plugin));
......
......@@ -192,7 +192,7 @@ public function testBuildTags($prefix, array $suffixes, array $expected, $glue =
* @group legacy
*/
public function testKeyFromQuery() {
$this->expectDeprecation('Drupal\Core\Cache\Cache::keyFromQuery is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. https://www.drupal.org/node/3322044');
$this->expectDeprecation('Drupal\Core\Cache\Cache::keyFromQuery is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. See https://www.drupal.org/node/3322044');
$query = new Select(new StubConnection(new StubPDO(), []), 'dne');
Cache::keyFromQuery($query);
}
......
......@@ -335,7 +335,7 @@ public function testScan() {
* @group legacy
*/
public function testScanDeprecation() {
$this->expectDeprecation('Calling Drupal\Core\Utility\Token::scan() with a $text parameter of type other than string is deprecated in drupal:10.1.0, a typehint will be added in drupal:11.0.0. See https://www.drupal.org/node/3334317');
$this->expectDeprecation('Calling Drupal\Core\Utility\Token::scan() with a $text parameter of type other than string is deprecated in drupal:10.1.0 and will cause an error in drupal:11.0.0. See https://www.drupal.org/node/3334317');
$this->assertSame([], $this->token->scan(NULL));
}
......
......@@ -19,6 +19,7 @@ class ExpectDeprecationTest extends TestCase {
*/
public function testExpectDeprecation() {
$this->expectDeprecation('Test deprecation');
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('Test deprecation', E_USER_DEPRECATED);
}
......@@ -30,6 +31,7 @@ public function testExpectDeprecation() {
*/
public function testExpectDeprecationInIsolation() {
$this->expectDeprecation('Test isolated deprecation');
// phpcs:ignore Drupal.Semantics.FunctionTriggerError
@trigger_error('Test isolated deprecation', E_USER_DEPRECATED);
}
......
......@@ -54,7 +54,7 @@ public function startTest(Test $test): void {
// Check for incorrect visibility of the $modules property.
$class = new \ReflectionClass($test);
if ($class->hasProperty('modules') && !$class->getProperty('modules')->isProtected()) {
@trigger_error('The ' . get_class($test) . '::$modules property must be declared protected. See https://www.drupal.org/node/2909426', E_USER_DEPRECATED);
@trigger_error('Declaring ' . get_class($test) . '::$modules with public visibility is deprecated in drupal:9.1.0 and must be declared protected in drupal:10.0.0. See https://www.drupal.org/node/2909426', E_USER_DEPRECATED);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment