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

Merge branch '1.13'

# Conflicts:
#	README.rst
#	Symfony/CS/Fixer.php
#	Symfony/CS/Tests/FixerTest.php
#	src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php
Dariusz Ruminski 8 лет назад
Родитель
Сommit
fe4b7f6b52

+ 1 - 0
.gitattributes

@@ -1,6 +1,7 @@
 /tests export-ignore
 .editorconfig export-ignore
 .gitattributes export-ignore
+.github/ export-ignore
 .gitignore export-ignore
 .travis.yml export-ignore
 appveyor.yml export-ignore

+ 16 - 0
.github/ISSUE_TEMPLATE

@@ -0,0 +1,16 @@
+For configuration or updating questions please read the README and UPGRADE documentation,
+or visit: https://gitter.im/FriendsOfPHP/PHP-CS-Fixer
+
+When reporting an issue (bug) please provide the following information:
+
+The PHP version you are using:
+$ php -v
+
+PHP CS Fixer version you are using:
+$ php-cs-fixer -V
+
+The command you use to run the fixer (and the configuration file you are using if any).
+
+A minimal sample of valid PHP code that is not fixed correctly (if applicable).
+
+The fixed version of that code after you run the fixer and the version you expected.

+ 16 - 0
CHANGELOG.md

@@ -3,6 +3,22 @@ CHANGELOG for PHP CS Fixer
 
 This file contains changelogs for stable releases only.
 
+Changelog for v1.13.0
+---------------------
+
+* bug #2303 ClassDefinitionFixer - Anonymous classes fixing (SpacePossum)
+* feature #2208 Added fixer for PHPUnit's @expectedException annotation (ro0NL)
+* feature #2249 Added ProtectedToPrivateFixer (Slamdunk, SpacePossum)
+* feature #2264 SelfUpdateCommand - Do not update to next major version by default (SpacePossum)
+* feature #2328 ClassDefinitionFixer - Anonymous classes format by PSR12 (SpacePossum)
+* feature #2333 PhpUnitFqcnAnnotationFixer - support more annotations (keradus)
+* minor #2256 EmptyReturnFixer - it's now risky fixer due to null vs void (keradus)
+* minor #2281 Add issue template (SpacePossum)
+* minor #2307 Update .editorconfig (SpacePossum)
+* minor #2310 CI: update AppVeyor to use newest PHP, silence the composer (keradus)
+* minor #2315 Token - Deprecate getLine() (SpacePossum)
+* minor #2320 Clear up status code on 1.x (SpacePossum)
+
 Changelog for v1.12.4
 ---------------------
 

+ 4 - 5
README.rst

@@ -30,13 +30,13 @@ your system:
 
 .. code-block:: bash
 
-    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.12.4/php-cs-fixer.phar -O php-cs-fixer
+    $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.13.0/php-cs-fixer.phar -O php-cs-fixer
 
 or with curl:
 
 .. code-block:: bash
 
-    $ curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.12.4/php-cs-fixer.phar -o php-cs-fixer
+    $ curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.13.0/php-cs-fixer.phar -o php-cs-fixer
 
 then:
 
@@ -440,8 +440,7 @@ Choose from the list of available rules:
    | *Rule is: configurable, risky.*
 
 * **php_unit_fqcn_annotation** [@Symfony]
-   | PHPUnit @expectedException annotation should be a FQCN including a root
-   | namespace.
+   | PHPUnit annotations should be a FQCNs including a root namespace.
 
 * **php_unit_strict**
    | PHPUnit methods like "assertSame" should be used instead of
@@ -794,7 +793,7 @@ scanned by the tool when run in the directory of your project. It is useful for
 projects that follow a well-known directory structures (like for Symfony
 projects for instance).
 
-.. _php-cs-fixer.phar: https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.12.4/php-cs-fixer.phar
+.. _php-cs-fixer.phar: https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v1.13.0/php-cs-fixer.phar
 .. _Atom:              https://github.com/Glavin001/atom-beautify
 .. _NetBeans:          http://plugins.netbeans.org/plugin/49042/php-cs-fixer
 .. _PhpStorm:          http://tzfrs.de/2015/01/automatically-format-code-to-match-psr-standards-with-phpstorm

+ 5 - 2
src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php

@@ -35,7 +35,10 @@ final class PhpUnitFqcnAnnotationFixer extends AbstractFixer
     {
         foreach ($tokens as $token) {
             if ($token->isGivenKind(T_DOC_COMMENT)) {
-                $token->setContent(preg_replace('~^(\s*\*\s*@expectedException\h+)(\w.*)$~m', '$1\\\\$2', $token->getContent()));
+                $token->setContent(preg_replace(
+                    '~^(\s*\*\s*@(?:expectedException|covers|coversDefaultClass|uses)\h+)(\w.*)$~m', '$1\\\\$2',
+                    $token->getContent()
+                ));
             }
         }
     }
@@ -54,6 +57,6 @@ final class PhpUnitFqcnAnnotationFixer extends AbstractFixer
      */
     protected function getDescription()
     {
-        return 'PHPUnit @expectedException annotation should be a FQCN including a root namespace.';
+        return 'PHPUnit annotations should be a FQCNs including a root namespace.';
     }
 }

+ 10 - 0
tests/Fixer/PhpTag/PhpUnitFqcnAnnotationFixerTest.php

@@ -33,6 +33,11 @@ final class PhpUnitFqcnAnnotationFixerTest extends AbstractFixerTestCase
          * @expectedException \Some\Exception\ClassName
  * @expectedExceptionCode 123
      * @expectedExceptionMessage Foo bar
+     *
+     * @covers \Foo
+     * @covers ::fooMethod
+     * @coversDefaultClass \Bar
+     * @uses \Baz
      */
 EOF;
         $input = <<<'EOF'
@@ -45,6 +50,11 @@ EOF;
          * @expectedException Some\Exception\ClassName
  * @expectedExceptionCode 123
      * @expectedExceptionMessage Foo bar
+     *
+     * @covers Foo
+     * @covers ::fooMethod
+     * @coversDefaultClass Bar
+     * @uses Baz
      */
 EOF;
 

+ 10 - 10
tests/FixerFactoryTest.php

@@ -53,7 +53,7 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::create
+     * @covers \PhpCsFixer\FixerFactory::create
      */
     public function testCreate()
     {
@@ -63,7 +63,7 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::registerBuiltInFixers
+     * @covers \PhpCsFixer\FixerFactory::registerBuiltInFixers
      */
     public function testRegisterBuiltInFixers()
     {
@@ -74,8 +74,8 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::getFixers
-     * @covers PhpCsFixer\FixerFactory::sortFixers
+     * @covers \PhpCsFixer\FixerFactory::getFixers
+     * @covers \PhpCsFixer\FixerFactory::sortFixers
      */
     public function testThatFixersAreSorted()
     {
@@ -96,9 +96,9 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::getFixers
-     * @covers PhpCsFixer\FixerFactory::registerCustomFixers
-     * @covers PhpCsFixer\FixerFactory::registerFixer
+     * @covers \PhpCsFixer\FixerFactory::getFixers
+     * @covers \PhpCsFixer\FixerFactory::registerCustomFixers
+     * @covers \PhpCsFixer\FixerFactory::registerFixer
      */
     public function testThatCanRegisterAndGetFixers()
     {
@@ -117,7 +117,7 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::registerFixer
+     * @covers \PhpCsFixer\FixerFactory::registerFixer
      * @expectedException        \UnexpectedValueException
      * @expectedExceptionMessage Fixer named "non_unique_name" is already registered.
      */
@@ -132,7 +132,7 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::useRuleSet
+     * @covers \PhpCsFixer\FixerFactory::useRuleSet
      */
     public function testUseRuleSet()
     {
@@ -152,7 +152,7 @@ final class FixerFactoryTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @covers PhpCsFixer\FixerFactory::useRuleSet
+     * @covers \PhpCsFixer\FixerFactory::useRuleSet
      * @expectedException        \UnexpectedValueException
      * @expectedExceptionMessage Rule "non_existing_rule" does not exist.
      */

+ 1 - 1
tests/Linter/LinterTest.php

@@ -19,7 +19,7 @@ use PhpCsFixer\Linter\Linter;
  *
  * @internal
  *
- * @covers PhpCsFixer\Linter\Linter
+ * @covers \PhpCsFixer\Linter\Linter
  */
 final class LinterTest extends AbstractLinterTestCase
 {

+ 2 - 2
tests/Linter/ProcessLinterTest.php

@@ -21,8 +21,8 @@ use Symfony\Component\Process\ProcessUtils;
  *
  * @internal
  *
- * @covers PhpCsFixer\Linter\ProcessLinter
- * @covers PhpCsFixer\Linter\ProcessLintingResult
+ * @covers \PhpCsFixer\Linter\ProcessLinter
+ * @covers \PhpCsFixer\Linter\ProcessLintingResult
  */
 final class ProcessLinterTest extends AbstractLinterTestCase
 {

+ 2 - 2
tests/Linter/TokenizerLinterTest.php

@@ -20,8 +20,8 @@ use PhpCsFixer\Linter\TokenizerLinter;
  * @internal
  *
  * @requires PHP 7.0
- * @covers PhpCsFixer\Linter\TokenizerLinter
- * @covers PhpCsFixer\Linter\TokenizerLintingResult
+ * @covers \PhpCsFixer\Linter\TokenizerLinter
+ * @covers \PhpCsFixer\Linter\TokenizerLintingResult
  */
 final class TokenizerLinterTest extends AbstractLinterTestCase
 {

Некоторые файлы не были показаны из-за большого количества измененных файлов