Просмотр исходного кода

minor #4585 Fix deprecation notices (julienfalque)

This PR was merged into the 2.15 branch.

Discussion
----------

Fix deprecation notices

Commits
-------

c81295ca Fix deprecation notices
Dariusz Ruminski 5 лет назад
Родитель
Сommit
f031f23432

+ 14 - 14
tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php

@@ -150,7 +150,7 @@ final class ClassDefinitionFixerTest extends AbstractFixerWithAliasedOptionsTest
         );
 
         $fixer = new ClassDefinitionFixer();
-        $fixer->configure(['singleLine' => 'z']);
+        $fixer->configure(['single_line' => 'z']);
     }
 
     public function provideAnonymousClassesCases()
@@ -163,7 +163,7 @@ final class ClassDefinitionFixerTest extends AbstractFixerWithAliasedOptionsTest
             [
                 '<?php $a = new class(1) extends SomeClass implements SomeInterface, D {};',
                 "<?php \$a = new    class(1)     extends\nSomeClass\timplements    SomeInterface, D {};",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php \$a = new class('1a') implements\nA\n{};",
@@ -172,7 +172,7 @@ final class ClassDefinitionFixerTest extends AbstractFixerWithAliasedOptionsTest
             [
                 "<?php \$a = new class('1a') implements A {};",
                 "<?php \$a = new class('1a')   implements\nA{};",
-                ['singleItemSingleLine' => true],
+                ['single_item_single_line' => true],
             ],
             [
                 '<?php $a = new class {};',
@@ -289,7 +289,7 @@ A#
 #
 }#
 ;",
-                ['singleItemSingleLine' => true],
+                ['single_item_single_line' => true],
             ],
             [
                 '<?php $a = new class() #
@@ -315,45 +315,45 @@ A#
             [
                 "<?php class configA implements B, C\n{}",
                 "<?php class configA implements\nB, C{}",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php class configA1 extends B\n{}",
                 "<?php class configA1\n extends\nB{}",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php class configA1a extends B\n{}",
                 "<?php class configA1a\n extends\nB{}",
-                ['singleLine' => false, 'singleItemSingleLine' => true],
+                ['single_line' => false, 'single_item_single_line' => true],
             ],
             [
                 "<?php class configA2 extends D implements B, C\n{}",
                 "<?php class configA2 extends D implements\nB,\nC{}",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php class configA3 extends D implements B, C\n{}",
                 "<?php class configA3\n extends\nD\n\t implements\nB,\nC{}",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php class configA4 extends D implements B, #\nC\n{}",
                 "<?php class configA4\n extends\nD\n\t implements\nB,#\nC{}",
-                ['singleLine' => true],
+                ['single_line' => true],
             ],
             [
                 "<?php class configA5 implements A\n{}",
                 "<?php class configA5 implements\nA{}",
-                ['singleLine' => false, 'singleItemSingleLine' => true],
+                ['single_line' => false, 'single_item_single_line' => true],
             ],
             [
                 "<?php interface TestWithMultiExtendsMultiLine extends\n    A,\nAb,\n    C,\n    D\n{}",
                 "<?php interface TestWithMultiExtendsMultiLine extends A,\nAb,C,D\n{}",
                 [
-                    'singleLine' => false,
-                    'singleItemSingleLine' => false,
-                    'multiLineExtendsEachSingleLine' => true,
+                    'single_line' => false,
+                    'single_item_single_line' => false,
+                    'multi_line_extends_each_single_line' => true,
                 ],
             ],
         ];

+ 9 - 9
tests/Fixer/Comment/HeaderCommentFixerTest.php

@@ -78,7 +78,7 @@ echo 1;',
                     'header' => 'tmp',
                     'location' => 'after_declare_strict',
                     'separate' => 'bottom',
-                    'commentType' => 'PHPDoc',
+                    'comment_type' => 'PHPDoc',
                 ],
                 '<?php
 declare(strict_types=1);
@@ -122,7 +122,7 @@ echo 1;',
             [
                 [
                     'header' => 'new',
-                    'commentType' => 'comment',
+                    'comment_type' => 'comment',
                 ],
                 '<?php
 
@@ -138,7 +138,7 @@ echo 1;',
             [
                 [
                     'header' => 'new',
-                    'commentType' => 'PHPDoc',
+                    'comment_type' => 'PHPDoc',
                 ],
                 '<?php
 
@@ -154,7 +154,7 @@ echo 1;',
             [
                 [
                     'header' => 'def',
-                    'commentType' => 'PHPDoc',
+                    'comment_type' => 'PHPDoc',
                 ],
                 '<?php
 
@@ -194,7 +194,7 @@ echo 1;',
             [
                 [
                     'header' => 'abc',
-                    'commentType' => 'PHPDoc',
+                    'comment_type' => 'PHPDoc',
                 ],
                 '<?php
 
@@ -360,14 +360,14 @@ echo 1;'
             [
                 [
                     'header' => '',
-                    'commentType' => 'foo',
+                    'comment_type' => 'foo',
                 ],
                 'Invalid configuration: The option "comment_type" with value "foo" is invalid. Accepted values are: "PHPDoc", "comment".',
             ],
             [
                 [
                     'header' => '',
-                    'commentType' => new \stdClass(),
+                    'comment_type' => new \stdClass(),
                 ],
                 'Invalid configuration: The option "comment_type" with value stdClass is invalid. Accepted values are: "PHPDoc", "comment".',
             ],
@@ -399,7 +399,7 @@ echo 1;'
     {
         $this->configureFixerWithAliasedOptions([
             'header' => $header,
-            'commentType' => $type,
+            'comment_type' => $type,
         ]);
         $this->doTest(
             '<?php
@@ -547,7 +547,7 @@ declare(strict_types=1)?>',
                     'header' => 'whitemess',
                     'location' => 'after_declare_strict',
                     'separate' => 'bottom',
-                    'commentType' => 'PHPDoc',
+                    'comment_type' => 'PHPDoc',
                 ],
                 "<?php\r\ndeclare(strict_types=1);\r\n/**\r\n * whitemess\r\n */\r\n\r\nnamespace A\\B;\r\n\r\necho 1;",
                 "<?php\r\ndeclare(strict_types=1);\r\n\r\nnamespace A\\B;\r\n\r\necho 1;",

+ 46 - 46
tests/Fixer/Import/OrderedImportsFixerTest.php

@@ -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'

+ 1 - 1
tests/Fixtures/Integration/priority/no_blank_lines_after_phpdoc,header_comment.test

@@ -1,7 +1,7 @@
 --TEST--
 Integration of fixers: no_blank_lines_after_phpdoc,header_comment.
 --RULESET--
-{"no_blank_lines_after_phpdoc": true, "header_comment": {"header": "Header", "commentType": "PHPDoc", "separate": "bottom"}}
+{"no_blank_lines_after_phpdoc": true, "header_comment": {"header": "Header", "comment_type": "PHPDoc", "separate": "bottom"}}
 --EXPECT--
 <?php
 /**