Unverified Commit 2b5ae544 authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

fix(ScopeClosingBrace): Fix infinite phpcbf loop with indentation (#3032222)

parent fd4fa41d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -972,6 +972,7 @@ class ScopeIndentSniff implements Sniff
                            T_CLOSE_CURLY_BRACKET,
                            T_OPEN_CURLY_BRACKET,
                            T_COLON,
                            T_OPEN_TAG,
                        ]
                    ) === false
                    ) {
+29 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Test file.
 */

 /**
  * ScopeIndentSniff already handles this correctly.
  */
 function example_entity_info_alter(&$entity_info) {
  $entity_info['node']['view modes']['new_display_machine_name'] = array(
    'label' => t('New Display Name'),
    'custom settings' => '',
  );
}

/**
 * Closing brace not aligned correctly.
 */
function test2() {
  return 5;
  }

/**
 * Closing brace not on line by itself.
 */
function test3() {
  return 7; }
+30 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Test file.
 */

/**
 * ScopeIndentSniff already handles this correctly.
 */
function example_entity_info_alter(&$entity_info) {
  $entity_info['node']['view modes']['new_display_machine_name'] = array(
    'label' => t('New Display Name'),
    'custom settings' => '',
  );
}

/**
 * Closing brace not aligned correctly.
 */
function test2() {
  return 5;
}

/**
 * Closing brace not on line by itself.
 */
function test3() {
  return 7;
}
+45 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Sniffs\WhiteSpace;

use Drupal\Test\CoderSniffUnitTest;

class ScopeClosingBraceUnitTest extends CoderSniffUnitTest
{


    /**
     * Returns the lines where errors should occur.
     *
     * The key of the array should represent the line number and the value
     * should represent the number of errors that should occur on that line.
     *
     * @return array(int => int)
     */
    public function getErrorList()
    {
        return [
            16 => 1,
            23 => 1,
            29 => 1,
        ];

    }//end getErrorList()


    /**
     * Returns the lines where warnings should occur.
     *
     * The key of the array should represent the line number and the value
     * should represent the number of warnings that should occur on that line.
     *
     * @return array(int => int)
     */
    public function getWarningList()
    {
        return [];

    }//end getWarningList()


}//end class