Unverified Commit 929d7d4d authored by Alex Pott's avatar Alex Pott Committed by GitHub
Browse files

feat(slevomat): Add dependency on slevomat coding standard to include their...

feat(slevomat): Add dependency on slevomat coding standard to include their sniffs (#3010032 by alexpott)
parent 2daf0c29
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -8,11 +8,6 @@ jobs:
      fail-fast: false
      matrix:
        php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
        phpstan: ['1']
        # Extra run to also test on PHP 7.0 without PHPStan.
        include:
          - php-versions: '7.0'
            phpstan: '0'
    steps:
      - name: Checkout Coder
        uses: actions/checkout@v2
@@ -36,10 +31,7 @@ jobs:
      - name: Install Composer dependencies
        # Running composer install without a lock file will also update cached
        # dependencies in vendor.
        # We have a dedicated composer.json file for PHP 7.0 that does not have
        # PHPStan because it requires >= PHP 7.1.
        run: |
          if [[ ${{ matrix.php-versions }} == "7.0" ]]; then cp composer-php-7-0.json composer.json; fi
          composer install --no-progress --prefer-dist --optimize-autoloader
      - name: Run PHPUnit
        run: ./vendor/bin/phpunit
@@ -54,4 +46,4 @@ jobs:
          ./vendor/bin/phpcs -p --standard=tests/Drupal/phpcs-ruleset.xml tests/Drupal/good/ --ignore=tests/Drupal/good/GoodUnitTest.php
          ./vendor/bin/phpcs -p --standard=coder_sniffer/DrupalPractice tests/DrupalPractice/good/ --ignore=tests/DrupalPractice/good/GoodUnitTest.php
      - name: Run PHPStan
        run: if [[ ${{ matrix.phpstan }} == "1" ]]; then ./vendor/bin/phpstan analyse; fi
        run: ./vendor/bin/phpstan analyse
+3 −0
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@
 <rule ref="PSR2.Namespaces.NamespaceDeclaration" />
 <rule ref="PSR2.Namespaces.UseDeclaration" />

 <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
 <rule ref="SlevomatCodingStandard.PHP.ShortList" />

 <rule ref="Squiz.Arrays.ArrayDeclaration" />
 <!-- Disable some error messages that we do not want. -->
 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">

composer-php-7-0.json

deleted100644 → 0
+0 −32
Original line number Diff line number Diff line
{
    "name": "drupal/coder",
    "type": "phpcodesniffer-standard",
    "description": "Coder is a library to review Drupal code.",
    "homepage": "https://www.drupal.org/project/coder",
    "support": {
        "issues": "https://www.drupal.org/project/issues/coder",
        "source": "https://www.drupal.org/project/coder"
    },
    "keywords": [
        "phpcs",
        "standards",
        "code review"
    ],
    "license": "GPL-2.0-or-later",
    "require": {
        "php": ">=7.0.8",
        "ext-mbstring": "*",
        "squizlabs/php_codesniffer": "^3.5.6",
        "symfony/yaml": ">=2.0.5",
        "sirbrillig/phpcs-variable-analysis": "^2.10"
    },
    "autoload": {
        "psr-4": {
            "Drupal\\": "coder_sniffer/Drupal/",
            "DrupalPractice\\": "coder_sniffer/DrupalPractice/"
        }
    },
    "require-dev": {
        "phpunit/phpunit": "^6.0 || ^7.0"
    }
}
+11 −3
Original line number Diff line number Diff line
@@ -14,11 +14,13 @@
    ],
    "license": "GPL-2.0-or-later",
    "require": {
        "php": ">=7.0.8",
        "php": ">=7.1",
        "ext-mbstring": "*",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
        "sirbrillig/phpcs-variable-analysis": "^2.10",
        "slevomat/coding-standard": "^7.0",
        "squizlabs/php_codesniffer": "^3.6.0",
        "symfony/yaml": ">=2.0.5",
        "sirbrillig/phpcs-variable-analysis": "^2.10"
        "symfony/yaml": ">=2.0.5"
    },
    "autoload": {
        "psr-4": {
@@ -26,6 +28,12 @@
            "DrupalPractice\\": "coder_sniffer/DrupalPractice/"
        }
    },
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        },
        "sort-packages": true
    },
    "require-dev": {
        "phpunit/phpunit": "^6.0 || ^7.0 || ^8.0",
        "phpstan/phpstan": "^1.2.0"
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ function test2() {
   * @var string $x
   * @var string $y
   */
  list($x, $y) = something();
  [$x, $y] = something();

  $date_format = '';
  $time_format = '';
Loading