Commit 8a63c77a authored by Tim Rohaly's avatar Tim Rohaly Committed by Tim Rohaly
Browse files

Issue #3178551 by jonathan1055, TR: [9.1] Drupal\Core\Plugin\ContextAwarePluginBase is deprecated

parent 5c23deb5
Loading
Loading
Loading
Loading
+30 −27
Changes for .travis.yml: 30 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -16,23 +16,23 @@ env:
jobs:
  fast_finish: true
  include:
    - php: 7.1
      env: DRUPAL_CORE=8.8.x
    - php: 7.2
      env: DRUPAL_CORE=8.9.x
    - php: 7.3
      env: DRUPAL_CORE=9.0.x
    - php: 7.4
      env:
        - DRUPAL_CORE=9.1.x
        # --- Remaining self deprecation notices (0)
        # --- Remaining direct deprecation notices (781)
        #  50 Support for keys without a placeholder prefix is deprecated
        # 516 EventDispatcherInterface::dispatch() with a string event name
        #  13 UnitTestCase::assertArrayEquals() is deprecated
        # 202 Drupal\Core\Plugin\ContextAwarePluginBase
        - DEPRECATIONS=1000
        # Temporarily allow for many deprecations. The precise number will change as new tests are developed.
        # --- Remaining direct deprecation notices (676)
        #  50 Support for keys without a placeholder prefix
        # 626 EventDispatcherInterface::dispatch() with a string event name
        - DEPRECATIONS=676
    - php: 7.4
      env:
        - DRUPAL_CORE=9.2.x
        # --- Remaining self deprecation notices (0)
        # --- Remaining direct deprecation notices (1322)
        #  50 Support for keys without a placeholder prefix
        # 626 EventDispatcherInterface::dispatch() with a string event name
        # 646 core/jquery.ui... asset library is deprecated
        - DEPRECATIONS=1322

services:
  - mysql
@@ -59,7 +59,8 @@ before_script:
  - mysql -e "create database $MODULE"
  # Export database variable for kernel tests.
  - export SIMPLETEST_DB=mysql://root:@127.0.0.1/$MODULE
  # Download Drupal 8 core from the Github mirror because it is faster.

  # Download Drupal core from the Github mirror because it is faster.
  - travis_retry git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git
  - cd drupal
  # Store the path to Drupal root.
@@ -82,9 +83,6 @@ before_script:
  # Set the phpcs installed_paths to pick up the Drupal standards.
  - $DRUPAL_ROOT/vendor/bin/phpcs --config-set installed_paths $DRUPAL_ROOT/vendor/drupal/coder/coder_sniffer

  # Show the allowed number of deprecation warnings.
  - echo $SYMFONY_DEPRECATIONS_HELPER

  # Start a web server on port 8888, run in the background.
  - php -S localhost:8888 &

@@ -97,21 +95,26 @@ before_script:

script:
  # Run the PHPUnit tests which also include the kernel tests.
  - cd $DRUPAL_ROOT;
  - ./vendor/bin/phpunit -c ./core/phpunit.xml.dist ./modules/$MODULE/tests/

  # Check for coding standards. First change directory to our module.
  # Check for coding standards. First show the Coder, Codesniffer and phpcs versions.
  - composer show drupal/coder | egrep 'name |vers'
  - composer show squizlabs/php_codesniffer | egrep 'name |vers'
  - $DRUPAL_ROOT/vendor/bin/phpcs --version

  # Change into $MODULE directory to avoid having to add --standard=$DRUPAL_ROOT/modules/$MODULE/phpcs.xml.dist
  - cd $DRUPAL_ROOT/modules/$MODULE

  # Show the phpcs version, standards and all the sniffs that are used.
  - $DRUPAL_ROOT/vendor/bin/phpcs --version
  # List all the sniffs that are used.
  - $DRUPAL_ROOT/vendor/bin/phpcs -i
  - $DRUPAL_ROOT/vendor/bin/phpcs -e

  # Show the violations in detail but do not fail for any errors or warnings.
  - $DRUPAL_ROOT/vendor/bin/phpcs --report-width=100 --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1

  # Run again to give a summary and totals, and fail for errors and warnings.
  # Skip this second run for 9.1.x as there are known failures.
  - if [ "$DRUPAL_CORE" != "9.1.x" ]; then
      $DRUPAL_ROOT/vendor/bin/phpcs --report-width=100 --report=summary;
  # Show the errors and warnings in detail, in summary and by source sniff.
  # Do not fail for 9.1.x or 9.2.x as there are known errors.
  - |
    if [[ "$DRUPAL_CORE" == "9.1.x" || "$DRUPAL_CORE" == "9.2.x" ]]; then
      $DRUPAL_ROOT/vendor/bin/phpcs . --report-width=100 --report-full --report-summary --report-source -s --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1
    else
      $DRUPAL_ROOT/vendor/bin/phpcs . --report-width=100 --report-full --report-summary --report-source -s
    fi
+7 −4
Changes for src/Core/RulesActionBase.php: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -4,15 +4,18 @@ namespace Drupal\rules\Core;

use Drupal\Component\Plugin\Exception\ContextException;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Plugin\ContextAwarePluginBase;
use Drupal\Core\Plugin\ContextAwarePluginTrait;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\rules\Context\ContextProviderTrait;

/**
 * Base class for rules actions.
 */
abstract class RulesActionBase extends ContextAwarePluginBase implements RulesActionInterface {

abstract class RulesActionBase extends PluginBase implements RulesActionInterface {
  use ContextAwarePluginTrait {
    getContextValue as protected traitGetContextValue;
  }
  use ContextProviderTrait;
  use ExecutablePluginTrait;
  use ConfigurationAccessControlTrait;
@@ -29,7 +32,7 @@ abstract class RulesActionBase extends ContextAwarePluginBase implements RulesAc
   */
  public function getContextValue($name) {
    try {
      return parent::getContextValue($name);
      return $this->traitGetContextValue($name);
    }
    catch (ContextException $e) {
      // Catch the undocumented exception thrown when no context value is set