Browse Source

Merge branch 'master' into 3.0

* master:
  Fix merge issue
  [Config] Deprecate the static Config constructor so that people can instantiate it with a name by following the README.rst instructions and use a custom one.
  Same requirements for descriptions
  Increase PHPStan level to 3
  Fix typo in no_superfluous_phpdoc_tags
  BlankLineBeforeStatementFixer - add "yield from"
  LineEndingFixer - T_CLOSE_TAG support, StringLineEndingFixer - T_INLINE_HTML support

# Conflicts:
#	src/Console/Command/DescribeCommand.php
#	tests/AutoReview/FixerTest.php
#	tests/Fixer/PhpUnit/PhpUnitTestAnnotationFixerTest.php
#	tests/Fixer/Whitespace/NoExtraBlankLinesFixerTest.php
#	tests/Test/AbstractFixerWithAliasedOptionsTestCase.php
SpacePossum 5 years ago
parent
commit
93e17633e6
10 changed files with 29 additions and 19 deletions
  1. 1 1
      .php_cs.dist
  2. 10 10
      README.rst
  3. 1 1
      UPGRADE.md
  4. 2 1
      dev-tools/composer.json
  5. 1 1
      dev-tools/install.sh
  6. 1 1
      dev-tools/phive.xml
  7. 1 0
      php-cs-fixer
  8. 6 2
      phpstan.neon
  9. 1 1
      src/AbstractFixer.php
  10. 5 1
      src/Config.php

+ 1 - 1
.php_cs.dist

@@ -16,7 +16,7 @@ $finder = PhpCsFixer\Finder::create()
     ->append([__DIR__.'/php-cs-fixer'])
 ;
 
-$config = PhpCsFixer\Config::create()
+$config = (new PhpCsFixer\Config())
     ->setRiskyAllowed(true)
     ->setRules([
         '@PHP56Migration:risky' => true,

+ 10 - 10
README.rst

@@ -304,9 +304,9 @@ Choose from the list of available rules:
   - ``statements`` (a subset of ``['break', 'case', 'continue', 'declare',
     'default', 'die', 'do', 'exit', 'for', 'foreach', 'goto', 'if',
     'include', 'include_once', 'require', 'require_once', 'return',
-    'switch', 'throw', 'try', 'while', 'yield']``): list of statements which
-    must be preceded by an empty line; defaults to ``['break', 'continue',
-    'declare', 'return', 'throw', 'try']``
+    'switch', 'throw', 'try', 'while', 'yield', 'yield_from']``): list of
+    statements which must be preceded by an empty line; defaults to
+    ``['break', 'continue', 'declare', 'return', 'throw', 'try']``
 
 * **braces** [@PSR2, @Symfony, @PhpCsFixer]
 
@@ -1125,7 +1125,7 @@ Choose from the list of available rules:
 
   - ``allow_mixed`` (``bool``): whether type ``mixed`` without description is allowed
     (``true``) or considered superfluous (``false``); defaults to ``false``
-  - ``allow_unused_params`` (``bool``): whether ``param`` annontation without actual
+  - ``allow_unused_params`` (``bool``): whether ``param`` annotation without actual
     signature is allowed (``true``) or considered superfluous (``false``);
     defaults to ``false``
   - ``remove_inheritdoc`` (``bool``): remove ``@inheritDoc`` tags; defaults to ``false``
@@ -1868,7 +1868,7 @@ Choose from the list of available rules:
 
   Lambdas not (indirect) referencing ``$this`` must be declared ``static``.
 
-  *Risky rule: risky when using "->bindTo" on lambdas without referencing to ``$this``.*
+  *Risky rule: risky when using ``->bindTo`` on lambdas without referencing to ``$this``.*
 
 * **strict_comparison** [@PhpCsFixer:risky]
 
@@ -2005,7 +2005,7 @@ The example below will add two rules to the default list of PSR2 set rules:
         ->in(__DIR__)
     ;
 
-    return PhpCsFixer\Config::create()
+    return (new PhpCsFixer\Config())
         ->setRules([
             '@PSR2' => true,
             'strict_param' => true,
@@ -2032,7 +2032,7 @@ The following example shows how to use all ``Symfony`` rules but the ``full_open
         ->in(__DIR__)
     ;
 
-    return PhpCsFixer\Config::create()
+    return (new PhpCsFixer\Config())
         ->setRules([
             '@Symfony' => true,
             'full_opening_tag' => false,
@@ -2047,7 +2047,7 @@ configure them in your config file.
 
     <?php
 
-    return PhpCsFixer\Config::create()
+    return (new PhpCsFixer\Config())
         ->setIndent("\t")
         ->setLineEnding("\r\n")
     ;
@@ -2070,7 +2070,7 @@ Cache can be disabled via ``--using-cache`` option or config file:
 
     <?php
 
-    return PhpCsFixer\Config::create()
+    return (new PhpCsFixer\Config())
         ->setUsingCache(false)
     ;
 
@@ -2080,7 +2080,7 @@ Cache file can be specified via ``--cache-file`` option or config file:
 
     <?php
 
-    return PhpCsFixer\Config::create()
+    return (new PhpCsFixer\Config())
         ->setCacheFile(__DIR__.'/.php_cs.cache')
     ;
 

+ 1 - 1
UPGRADE.md

@@ -169,7 +169,7 @@ $config = Symfony\CS\Config\Config::create()
 ```
 <?php
 // phpcs-fixer v2.*
-$config = PhpCsFixer\Config::create()
+$config = (new PhpCsFixer\Config())
     ->registerCustomFixers([
         new ShopSys\CodingStandards\CsFixer\MissingButtonTypeFixer(),
         new ShopSys\CodingStandards\CsFixer\OrmJoinColumnRequireNullableFixer(),

+ 2 - 1
dev-tools/composer.json

@@ -4,10 +4,11 @@
     },
     "require-dev": {
         "humbug/box": "^3.8",
+        "jangregor/phpstan-prophecy": "^0.6",
         "localheinz/composer-normalize": "^1.1",
         "mi-schi/phpmd-extension": "^4.3",
         "phpmd/phpmd": "^2.6",
-        "phpstan/phpstan-phpunit": "^0.11.2"
+        "phpstan/phpstan-phpunit": "^0.12"
     },
     "conflict": {
         "hhvm": "*"

+ 1 - 1
dev-tools/install.sh

@@ -56,4 +56,4 @@ composer info -D | sort
 
 echo λλλ phive packages
 
-./bin/phive install --trust-gpg-keys D2CCAC42F6295E7D,8E730BA25823D8B5
+./bin/phive install --trust-gpg-keys D2CCAC42F6295E7D,8E730BA25823D8B5,CF1A108D0E7AE720

+ 1 - 1
dev-tools/phive.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <phive xmlns="https://phar.io/phive">
   <phar name="composer-require-checker" version="^2.0" installed="2.0.0" location="./tools/composer-require-checker" copy="false"/>
-  <phar name="phpstan" version="^0.11.15" installed="0.11.15" location="./tools/phpstan" copy="false"/>
+  <phar name="phpstan" version="^0.12" installed="0.12.9" location="./tools/phpstan" copy="true"/>
 </phive>

+ 1 - 0
php-cs-fixer

@@ -55,6 +55,7 @@ if (class_exists('Phar')) {
     // Maybe this file is used as phar-stub? Let's try!
     try {
         Phar::mapPhar('php-cs-fixer.phar');
+
         require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
         $require = false;
     } catch (PharException $e) {

+ 6 - 2
phpstan.neon

@@ -1,14 +1,18 @@
 includes:
+    - dev-tools/vendor/jangregor/phpstan-prophecy/src/extension.neon
     - dev-tools/vendor/phpstan/phpstan-phpunit/extension.neon
 
 parameters:
-    level: 1
+    level: 3
     paths:
         - src
         - tests
     excludes_analyse:
         - tests/Fixtures
     ignoreErrors:
-        - '/^.+::__construct\(\) does not call parent constructor from SplFileInfo\.$/'
         - '/^Return typehint of method PhpCsFixer\\Tests\\Test\\.+::createIsIdenticalStringConstraint\(\) has invalid type PHPUnit_Framework_Constraint_IsIdentical\.$/'
         - '/^Class (Symfony\\Contracts\\EventDispatcher\\Event|Symfony\\Component\\EventDispatcher\\Event) not found.$/'
+        - '/^(Access|Call) to an undefined (property|method) PhpCsFixer\\AccessibleObject\\AccessibleObject::.+$/'
+        -
+            message: '/^Unsafe usage of new static\(\)\.$/'
+            path: src/Config.php

+ 1 - 1
src/AbstractFixer.php

@@ -126,7 +126,7 @@ abstract class AbstractFixer implements FixerInterface
                     'Option "%s" for rule "%s" is deprecated and will be removed in version %d.0. %s',
                     $name,
                     $this->getName(),
-                    (int) Application::VERSION + 1,
+                    Application::getMajorVersion() + 1,
                     str_replace('`', '"', $option->getDeprecationMessage())
                 );
 

+ 5 - 1
src/Config.php

@@ -41,9 +41,13 @@ class Config implements ConfigInterface
 
     /**
      * @return static
+     *
+     * @deprecated since 2.17
      */
     public static function create()
     {
+        @trigger_error(__METHOD__.' is deprecated since 2.17 and will be removed in 3.0.', E_USER_DEPRECATED);
+
         return new static();
     }
 
@@ -64,7 +68,7 @@ class Config implements ConfigInterface
     }
 
     /**
-     * {@inheritdoc}
+     * @return Finder
      */
     public function getFinder()
     {

Some files were not shown because too many files changed in this diff