Problem/Motivation

remove WARNING \Drupal calls should be avoided in classes, use dependency injection instead

Steps to reproduce

Run the command:
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml instagram_posts_block/

Proposed resolution

Fix the following coding standards issues and upload the patch or create an MR with fixes.

FILE: C:\xampp\htdocs\drupal_9\web\modules\contrib\instagram_posts_block\src\Plugin\Block\InstagramPostsBlock.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
82 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------

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

    arti_parmar created an issue. See original summary.

    arti_parmar’s picture

    Status: Active » Needs review
    StatusFileSize
    new5.1 KB

    Kindly review patch.

    kenyoowen’s picture

    Status: Needs review » Needs work
    StatusFileSize
    new190.35 KB

    Hi arti_parmar

    I applied your patch in two ways which are git apply and patch -p1 and both have an error. Please see the screenshots attached.

    Thank you.

    ashutosh ahirwal’s picture

    Assigned: arti_parmar » Unassigned
    Priority: Normal » Minor
    Status: Needs work » Needs review
    Issue tags: +Coding standards
    StatusFileSize
    new7.86 KB

    Providing new patch with phpcs issue fixes.
    using phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/custom/instagram_posts_block

    • c074512e committed on 1.0.x
      Issue #3363538 by arti_parmar, Ashutosh Ahirwal, kenyoOwen: Drupal calls...
    ahmad abbad’s picture

    Merged, Thank you

    ahmad abbad’s picture

    Status: Needs review » Fixed

    • 9374018c committed on 1.0.x
      Issue #3363538 by ahmad-abbad Revert changes
      
    ahmad abbad’s picture

    Status: Needs review » Needs work
    ahmad abbad’s picture

    @Ashutosh Ahirwal The block is not functioning correctly after applying the patch.

    • 9374018c committed on project-update-bot-only
      Issue #3363538 by ahmad-abbad Revert changes
      
    ahmad abbad’s picture

    Status: Needs work » Fixed

    Now that this issue is closed, review the contribution record.

    As a contributor, attribute any organization that helped you, or if you volunteered your own time.

    Maintainers, credit people who helped resolve this issue.

    Status: Fixed » Closed (fixed)

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