Skip to content
Snippets Groups Projects
Unverified Commit a40711dd authored by Jonathan Smith's avatar Jonathan Smith Committed by GitHub
Browse files

feat(AlphabeticallySortedUses): Add sniff to check and fix use statement order (#3310013)

parent 5a1779e6
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
phpstan: ['0']
# We only need to run PHPStan once on the latest PHP version.
include:
......
......@@ -121,6 +121,7 @@
<rule ref="PSR2.Namespaces.UseDeclaration" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
<rule ref="Squiz.Arrays.ArrayDeclaration" />
......
......@@ -14,11 +14,11 @@
],
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.1",
"php": ">=7.2",
"ext-mbstring": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1 || ^1.0.0",
"sirbrillig/phpcs-variable-analysis": "^2.11.7",
"slevomat/coding-standard": "^7.0 || ^8.0",
"slevomat/coding-standard": "^8.11",
"squizlabs/php_codesniffer": "^3.7.1",
"symfony/yaml": ">=3.4.0"
},
......
<?php
use Vendor\DateTools\DateInterval;
use Vendor\DateTools;
use Vendor\DateTools\DateInterval;
$x = array(new Foo(), array());
$y = new Foo();
......
......@@ -5,12 +5,12 @@
* Example.
*/
use Test\MultiLineSecond;
use Test\Foo;
use Test\NotUsed;
use Test\Bar;
use Test\Alias as TestAlias;
use Test\Bar;
use Test\Foo;
use Test\MultiLine as MultiLineAlias;
use Test\MultiLineSecond;
use Test\NotUsed;
/**
* Example.
......
......@@ -2,12 +2,12 @@
namespace MyNamespace\Depth;
use Thing\NotUsed;
use Thing\Fail\ActuallyUsed;
use Test\TraitTest;
use Thing\DifferentName as UsedOtherName;
use Example\MyUrlHelper;
use MyNamespace\Depth\SomeClass as CoreSomeClass;
use Test\TraitTest;
use Thing\DifferentName as UsedOtherName;
use Thing\Fail\ActuallyUsed;
use Thing\NotUsed;
/**
* Bla.
......
......@@ -5,9 +5,9 @@
* Example.
*/
use Namespaced\MultiLine2 as MultiLineAlias2;
use Namespaced\TestClass;
use Namespaced\TestClassSecond as NamespacedAlias;
use Namespaced\MultiLine2 as MultiLineAlias2;
use function count;
/**
......
......@@ -20,9 +20,9 @@
declare(strict_types=1);
use Drupal\very_long_module_name_i_am_inventing_here_trololololo\SuperManager;
use Drupal\some_module\ExampleClass as AliasedExampleClass;
use Drupal\mymodule\TestReturnType;
use Drupal\some_module\ExampleClass as AliasedExampleClass;
use Drupal\very_long_module_name_i_am_inventing_here_trololololo\SuperManager;
// Singleline comment before a code line.
$foo = 'bar';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment