Problem/Motivation

  • Run a drupal-rector analysis ./vendor/bin/rector process web/modules/contrib/cloud --dry-run on the module will show:
    1) web/modules/contrib/cloud/modules/cloud_service_providers/vmware/src/Controller/ApiController.php:88
    
        ---------- begin diff ----------
    @@ @@
        *
        * @var array
        */
    -  protected $configuration;
    +  protected $configuration = ['cloud_context' => ''];
    
       /**
        * The current user.
    @@ @@
         $this->database = $database;
         $this->cloudService = $cloud_service;
         $this->currentUser = $current_user;
    -    $this->configuration = ['cloud_context' => ''];
       }
    
       /**
        ----------- end diff -----------
    
    Applied rules:
     * InlineConstructorDefaultToPropertyRector
    
    
    2) web/modules/contrib/cloud/modules/cloud_service_providers/k8s/src/Controller/ApiController.php:110
    
        ---------- begin diff ----------
    @@ @@
        *
        * @var array
        */
    -  private $configuration;
    +  private $configuration = ['cloud_context' => ''];
    
       /**
        * The cloud service provider plugin manager (CloudConfigPluginManager).
    @@ @@
         $this->cloudStorePluginManager = $plugin_manager;
         $this->cloudService = $cloud_service;
         $this->currentUser = $current_user;
    -    $this->configuration = ['cloud_context' => ''];
         $this->cloudConfigPluginManager = $cloud_config_plugin_manager;
       }
        ----------- end diff -----------
    
    Applied rules:
     * InlineConstructorDefaultToPropertyRector
    
    
    3) web/modules/contrib/cloud/modules/cloud_service_providers/openstack/src/Controller/ApiController.php:88
    
        ---------- begin diff ----------
    @@ @@
        *
        * @var array
        */
    -  protected $configuration;
    +  protected $configuration = ['cloud_context' => ''];
    
       /**
        * The current user.
    @@ @@
         $this->renderer = $renderer;
         $this->cloudService = $cloud_service;
         $this->currentUser = $current_user;
    -    $this->configuration = ['cloud_context' => ''];
         $this->openStackOperationsService = $openstack_operations_service;
         $this->openStackService = $openstack_service;
         $this->httpClient = $http_client;
        ----------- end diff -----------
    
    Applied rules:
     * InlineConstructorDefaultToPropertyRector
    
    
    4) web/modules/contrib/cloud/modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php:124
    
        ---------- begin diff ----------
    @@ @@
        *
        * @var array
        */
    -  protected $configuration;
    +  protected $configuration = ['cloud_context' => ''];
    
       /**
        * ApiController constructor.
    @@ @@
         $this->cloudService = $cloud_service;
         $this->entityTypeManager = $entity_type_manager;
         $this->currentUser = $current_user;
    -    $this->configuration = ['cloud_context' => ''];
       }
    
       /**
        ----------- end diff -----------
    
    Applied rules:
     * InlineConstructorDefaultToPropertyRector
    

Proposed resolution

Fix the warnings.

CommentFileSizeAuthor
#2 3400408-2.patch3.76 KBmukhtarm

Issue fork cloud-3400408

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

MukhtarM created an issue. See original summary.

mukhtarm’s picture

Status: Active » Needs review
StatusFileSize
new3.76 KB

Please review the patch.

yas’s picture

Title: InlineConstructorDefaultToPropertyRector Drupal rector » Refactor the initial value in __construct() by using the 'InlineConstructorDefaultToPropertyRector' rule of Drupal rector
Issue summary: View changes
Status: Needs review » Needs work

@mukhtarm

Thank you for providing the patch. Can you create the MR rather than the patch file? Thanks!

mukhtarm’s picture

Please review the MR. thanks

yas’s picture

Status: Needs work » Reviewed & tested by the community

@mukhtarm

Thank you for creating the MR. I'll merge the patch to 5.x and 6.x, and close this issue as Fixed.

  • yas committed fdd68dc6 on 6.x authored by MukhtarM
    Issue #3400408 by MukhtarM, yas: Refactor the initial value in...

  • yas committed e633ff16 on 5.x authored by MukhtarM
    Issue #3400408 by MukhtarM, yas: Refactor the initial value in...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.