Browse Source

DX: apply rules configuration cleanups for PHP 7.1+

Dariusz Ruminski 4 years ago
parent
commit
82f5857b87

+ 1 - 1
doc/rules/class_notation/visibility_required.rst

@@ -16,7 +16,7 @@ The structural elements to fix (PHP >= 7.1 required for ``const``).
 
 Allowed values: a subset of ``['property', 'method', 'const']``
 
-Default value: ``['property', 'method']``
+Default value: ``['property', 'method', 'const']``
 
 Examples
 --------

+ 2 - 2
src/Console/Application.php

@@ -34,8 +34,8 @@ use Symfony\Component\Console\Output\OutputInterface;
  */
 final class Application extends BaseApplication
 {
-    const VERSION = '3.0.0-DEV';
-    const VERSION_CODENAME = '';
+    public const VERSION = '3.0.0-DEV';
+    public const VERSION_CODENAME = '';
 
     /**
      * @var ToolInfo

+ 5 - 5
src/Console/Command/FixCommandExitStatusCalculator.php

@@ -20,11 +20,11 @@ namespace PhpCsFixer\Console\Command;
 final class FixCommandExitStatusCalculator
 {
     // Exit status 1 is reserved for environment constraints not matched.
-    const EXIT_STATUS_FLAG_HAS_INVALID_FILES = 4;
-    const EXIT_STATUS_FLAG_HAS_CHANGED_FILES = 8;
-    const EXIT_STATUS_FLAG_HAS_INVALID_CONFIG = 16;
-    const EXIT_STATUS_FLAG_HAS_INVALID_FIXER_CONFIG = 32;
-    const EXIT_STATUS_FLAG_EXCEPTION_IN_APP = 64;
+    public const EXIT_STATUS_FLAG_HAS_INVALID_FILES = 4;
+    public const EXIT_STATUS_FLAG_HAS_CHANGED_FILES = 8;
+    public const EXIT_STATUS_FLAG_HAS_INVALID_CONFIG = 16;
+    public const EXIT_STATUS_FLAG_HAS_INVALID_FIXER_CONFIG = 32;
+    public const EXIT_STATUS_FLAG_EXCEPTION_IN_APP = 64;
 
     /**
      * @param bool $isDryRun

+ 2 - 2
src/Console/ConfigurationResolver.php

@@ -53,8 +53,8 @@ use Symfony\Component\Finder\Finder as SymfonyFinder;
  */
 final class ConfigurationResolver
 {
-    const PATH_MODE_OVERRIDE = 'override';
-    const PATH_MODE_INTERSECTION = 'intersection';
+    public const PATH_MODE_OVERRIDE = 'override';
+    public const PATH_MODE_INTERSECTION = 'intersection';
 
     /**
      * @var null|bool

+ 1 - 1
src/DocBlock/Annotation.php

@@ -29,7 +29,7 @@ final class Annotation
      *
      * @internal
      */
-    const REGEX_TYPES = '
+    public const REGEX_TYPES = '
     # <simple> is any non-array, non-generic, non-alternated type, eg `int` or `\Foo`
     # <array> is array of <simple>, eg `int[]` or `\Foo[]`
     # <generic> is generic collection type, like `array<string, int>`, `Collection<Item>` and more complex like `Collection<int, \null|SubCollection<string>>`

+ 3 - 3
src/Error/Error.php

@@ -24,17 +24,17 @@ final class Error
     /**
      * Error which has occurred in linting phase, before applying any fixers.
      */
-    const TYPE_INVALID = 1;
+    public const TYPE_INVALID = 1;
 
     /**
      * Error which has occurred during fixing phase.
      */
-    const TYPE_EXCEPTION = 2;
+    public const TYPE_EXCEPTION = 2;
 
     /**
      * Error which has occurred in linting phase, after applying any fixers.
      */
-    const TYPE_LINT = 3;
+    public const TYPE_LINT = 3;
 
     /**
      * @var int

+ 2 - 2
src/Fixer/Basic/BracesFixer.php

@@ -36,12 +36,12 @@ final class BracesFixer extends AbstractFixer implements ConfigurableFixerInterf
     /**
      * @internal
      */
-    const LINE_NEXT = 'next';
+    public const LINE_NEXT = 'next';
 
     /**
      * @internal
      */
-    const LINE_SAME = 'same';
+    public const LINE_SAME = 'same';
 
     /**
      * {@inheritdoc}

+ 1 - 1
src/Fixer/Basic/NonPrintableCharacterFixer.php

@@ -104,7 +104,7 @@ final class NonPrintableCharacterFixer extends AbstractFixer implements Configur
         return new FixerConfigurationResolver([
             (new FixerOptionBuilder('use_escape_sequences_in_strings', 'Whether characters should be replaced with escape sequences in strings.'))
                 ->setAllowedTypes(['bool'])
-                ->setDefault(\PHP_VERSION_ID >= 70000) // @TODO 3.0 replace with `true` when changing PHP requirement to 7+
+                ->setDefault(true)
                 ->setNormalizer(static function (Options $options, $value) {
                     if (\PHP_VERSION_ID < 70000 && $value) {
                         throw new InvalidOptionsForEnvException('Escape sequences require PHP 7.0+.');

+ 1 - 1
src/Fixer/CastNotation/CastSpacesFixer.php

@@ -29,7 +29,7 @@ final class CastSpacesFixer extends AbstractFixer implements ConfigurableFixerIn
     /**
      * @internal
      */
-    const INSIDE_CAST_SPACE_REPLACE_MAP = [
+    public const INSIDE_CAST_SPACE_REPLACE_MAP = [
         ' ' => '',
         "\t" => '',
         "\n" => '',

+ 4 - 4
src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php

@@ -38,22 +38,22 @@ final class ClassAttributesSeparationFixer extends AbstractFixer implements Conf
     /**
      * @internal
      */
-    const SPACING_NONE = 'none';
+    public const SPACING_NONE = 'none';
 
     /**
      * @internal
      */
-    const SPACING_ONE = 'one';
+    public const SPACING_ONE = 'one';
 
     /**
      * @internal
      */
-    const SUPPORTED_SPACINGS = [self::SPACING_NONE, self::SPACING_ONE];
+    public const SUPPORTED_SPACINGS = [self::SPACING_NONE, self::SPACING_ONE];
 
     /**
      * @internal
      */
-    const SUPPORTED_TYPES = ['const', 'method', 'property'];
+    public const SUPPORTED_TYPES = ['const', 'method', 'property'];
 
     /**
      * @var array<string, string>

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