|
@@ -991,8 +991,8 @@ use A\A1;
|
|
|
$this->expectExceptionMessage('[ordered_imports] Invalid configuration: Missing sort type "function".');
|
|
|
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
- 'importsOrder' => ['class', 'const'],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
+ 'imports_order' => ['class', 'const'],
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -1002,8 +1002,8 @@ use A\A1;
|
|
|
$this->expectExceptionMessage('[ordered_imports] Invalid configuration: Missing sort type "class".');
|
|
|
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
- 'importsOrder' => ['const', 'function', 'bar'],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
+ 'imports_order' => ['const', 'function', 'bar'],
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -1028,22 +1028,22 @@ use A\A1;
|
|
|
return [
|
|
|
[
|
|
|
[
|
|
|
- 'sortAlgorithm' => 'dope',
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => 'dope',
|
|
|
+ 'imports_order' => null,
|
|
|
],
|
|
|
'"dope"',
|
|
|
],
|
|
|
[
|
|
|
[
|
|
|
- 'sortAlgorithm' => [OrderedImportsFixer::SORT_ALPHA, OrderedImportsFixer::SORT_LENGTH],
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => [OrderedImportsFixer::SORT_ALPHA, OrderedImportsFixer::SORT_LENGTH],
|
|
|
+ 'imports_order' => null,
|
|
|
],
|
|
|
'array',
|
|
|
],
|
|
|
[
|
|
|
[
|
|
|
- 'sortAlgorithm' => new \stdClass(),
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => new \stdClass(),
|
|
|
+ 'imports_order' => null,
|
|
|
],
|
|
|
\stdClass::class,
|
|
|
],
|
|
@@ -1053,8 +1053,8 @@ use A\A1;
|
|
|
public function testFixByLength()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1143,8 +1143,8 @@ EOF;
|
|
|
public function testByLengthFixWithSameLength()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1201,8 +1201,8 @@ EOF;
|
|
|
public function testByLengthFixWithMultipleNamespace()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1329,8 +1329,8 @@ EOF;
|
|
|
public function testByLengthFixWithComment()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1419,8 +1419,8 @@ EOF;
|
|
|
public function testByLength()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1499,8 +1499,8 @@ EOF;
|
|
|
public function testByLengthFixWithTraitImports()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1595,8 +1595,8 @@ EOF;
|
|
|
public function testByLengthFixWithDifferentCases()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1639,8 +1639,8 @@ EOF;
|
|
|
public function testByLengthOrderWithTrailingDigit()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1679,8 +1679,8 @@ EOF;
|
|
|
public function testByLengthCodeWithImportsOnly()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1703,8 +1703,8 @@ EOF;
|
|
|
public function testByLengthWithoutUses()
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|
|
@@ -1727,8 +1727,8 @@ EOF
|
|
|
public function testFix70ByLength($expected, $input = null)
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$this->doTest($expected, $input);
|
|
@@ -1794,8 +1794,8 @@ use const ZZZ;
|
|
|
public function testFix70TypesOrderAndLength($expected, $input = null)
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
]);
|
|
|
|
|
|
$this->doTest($expected, $input);
|
|
@@ -1854,8 +1854,8 @@ use function some\f\{fn_c, fn_d, fn_e};
|
|
|
public function testFix70TypesOrderAndAlphabet($expected, $input = null, array $importOrder = null)
|
|
|
{
|
|
|
$this->configureFixerWithAliasedOptions([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
- 'importsOrder' => $importOrder,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
+ 'imports_order' => $importOrder,
|
|
|
]);
|
|
|
|
|
|
$this->doTest($expected, $input);
|
|
@@ -1925,8 +1925,8 @@ use function some\a\{fn_a, fn_b};
|
|
|
public function testFix70TypesOrderAndNone($expected, $input = null, array $importOrder = null)
|
|
|
{
|
|
|
$this->fixer->configure([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
- 'importsOrder' => $importOrder,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
+ 'imports_order' => $importOrder,
|
|
|
]);
|
|
|
|
|
|
$this->doTest($expected, $input);
|
|
@@ -2031,8 +2031,8 @@ use function some\a\{fn_a, fn_b, fn_c,};
|
|
|
',
|
|
|
$input,
|
|
|
[
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
- 'importsOrder' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_ALPHA,
|
|
|
+ 'imports_order' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
],
|
|
|
],
|
|
|
[
|
|
@@ -2045,8 +2045,8 @@ use function some\a\{fn_a, fn_b, fn_c,};
|
|
|
',
|
|
|
$input,
|
|
|
[
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
- 'importsOrder' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_LENGTH,
|
|
|
+ 'imports_order' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
],
|
|
|
],
|
|
|
[
|
|
@@ -2059,8 +2059,8 @@ use function some\a\{fn_a, fn_b, fn_c,};
|
|
|
',
|
|
|
$input,
|
|
|
[
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
- 'importsOrder' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
+ 'imports_order' => [OrderedImportsFixer::IMPORT_TYPE_CLASS, OrderedImportsFixer::IMPORT_TYPE_CONST, OrderedImportsFixer::IMPORT_TYPE_FUNCTION],
|
|
|
],
|
|
|
],
|
|
|
];
|
|
@@ -2069,8 +2069,8 @@ use function some\a\{fn_a, fn_b, fn_c,};
|
|
|
public function testFixByNone()
|
|
|
{
|
|
|
$this->fixer->configure([
|
|
|
- 'sortAlgorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
- 'importsOrder' => null,
|
|
|
+ 'sort_algorithm' => OrderedImportsFixer::SORT_NONE,
|
|
|
+ 'imports_order' => null,
|
|
|
]);
|
|
|
|
|
|
$expected = <<<'EOF'
|