Browse Source

Merge branch '2.16'

* 2.16:
  Fix test
  PHP8 care package
  test 2
  test
  Update CONTRIBUTING.md
  move
  Trigger CI
  Fix file permissions
  Add checking file permissions

# Conflicts:
#	README.rst
#	src/RuleSet.php
#	tests/Fixer/ConstantNotation/NativeConstantInvocationFixerTest.php
#	tests/RuleSetTest.php
SpacePossum 4 years ago
parent
commit
38d7ae0271

+ 4 - 1
.composer-require-checker.json

@@ -19,7 +19,10 @@
         "null", "true", "false",
         "static", "self", "parent",
         "array", "string", "int", "float", "bool", "iterable", "callable", "void",
-        "T_COALESCE_EQUAL", "T_FN"
+        "T_COALESCE_EQUAL", "T_FN",
+        "T_NAME_QUALIFIED",
+        "T_NAME_FULLY_QUALIFIED",
+        "T_NAME_RELATIVE"
     ],
     "php-core-extensions" : [
         "dom", "mbstring", "Phar",

+ 0 - 1
.gitattributes

@@ -11,7 +11,6 @@
 /.* export-ignore
 /benchmark.sh export-ignore
 /box.json.dist export-ignore
-/check_trailing_spaces.sh export-ignore
 /dev-tools/ export-ignore
 /phpmd.xml export-ignore
 /phpstan.neon export-ignore

+ 3 - 2
.travis.yml

@@ -52,12 +52,13 @@ jobs:
                     | grep -v tests/Test/IsIdenticalConstraint.php \
                     | grep -v tests/TestCase.php \
                     && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
-                - ./check_trailing_spaces.sh || travis_terminate 1
+                - ./dev-tools/check_file_permissions.sh || travis_terminate 1
+                - ./dev-tools/check_trailing_spaces.sh || travis_terminate 1
                 - dev-tools/vendor/bin/phpstan analyse
                 - if [ -n "$CHANGED_PHP_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$CHANGED_PHP_FILES" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
                 - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file $(realpath .composer-require-checker.json) || travis_terminate 1
                 - composer normalize --dry-run --working-dir=./dev-tools ../composer.json
-                - ./dev-tools/check-shell-scripts.sh
+                - ./dev-tools/check_shell_scripts.sh
 
         - &STANDARD_TEST_JOB
             stage: Fast Test

+ 2 - 1
CONTRIBUTING.md

@@ -12,7 +12,8 @@ If you need any help, don't hesitate to ask the community on [Gitter](https://gi
 * Create a new branch, e.g. `feature-foo` or `bugfix-bar`.
 * Make changes.
 * If you are adding functionality or fixing a bug - add a test! Prefer adding new test cases over modifying existing ones.
-* Make sure there is no trailing spaces in code: `./check_trailing_spaces.sh`.
+* Make sure there is no wrong file permissions in the repository: `./dev-tools/check_file_permissions.sh`.
+* Make sure there is no trailing spaces in the code: `./dev-tools/check_trailing_spaces.sh`.
 * Regenerate README: `php php-cs-fixer readme > README.rst` (Windows `php.exe php-cs-fixer readme > README.rst`). Do not modify `README.rst` manually!
 * Install dev tools: `dev-tools/install.sh`
 * Run static analysis using PHPStan: `php -d memory_limit=256M dev-tools/vendor/bin/phpstan analyse`

+ 17 - 17
README.rst

@@ -422,7 +422,7 @@ Choose from the list of available rules:
 
   Calling ``unset`` on multiple items should be done in one call.
 
-* **combine_nested_dirname** [@Symfony:risky, @PhpCsFixer:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky]
+* **combine_nested_dirname** [@Symfony:risky, @PhpCsFixer:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Replace multiple nested calls of ``dirname`` by only one call with second
   ``$level`` parameter. Requires PHP >= 7.0.
@@ -479,7 +479,7 @@ Choose from the list of available rules:
   - ``space`` (``'none'``, ``'single'``): spacing to apply around the equal sign;
     defaults to ``'none'``
 
-* **declare_strict_types** [@PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky]
+* **declare_strict_types** [@PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Force strict types declaration in all files. Requires PHP >= 7.0.
 
@@ -862,7 +862,7 @@ Choose from the list of available rules:
 
   Convert ``heredoc`` to ``nowdoc`` where possible.
 
-* **implode_call** [@Symfony:risky, @PhpCsFixer:risky, @PHP74Migration:risky]
+* **implode_call** [@Symfony:risky, @PhpCsFixer:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Function ``implode`` must be called with 2 arguments in the documented
   order.
@@ -1065,7 +1065,7 @@ Choose from the list of available rules:
 
   All instances created with new keyword must be followed by braces.
 
-* **no_alias_functions** [@Symfony:risky, @PhpCsFixer:risky, @PHP74Migration:risky]
+* **no_alias_functions** [@Symfony:risky, @PhpCsFixer:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Master functions shall be used instead of aliases.
 
@@ -1073,10 +1073,10 @@ Choose from the list of available rules:
 
   Configuration options:
 
-  - ``sets`` (a subset of ``['@internal', '@IMAP', '@mbreg', '@all']``): list of
-    sets to fix. Defined sets are ``@internal`` (native functions), ``@IMAP``
-    (IMAP functions), ``@mbreg`` (from ``ext-mbstring``) ``@all`` (all listed
-    sets); defaults to ``['@internal', '@IMAP']``
+  - ``sets`` (a subset of ``['@internal', '@IMAP', '@mbreg', '@all', '@time',
+    '@exif']``): list of sets to fix. Defined sets are ``@internal`` (native
+    functions), ``@IMAP`` (IMAP functions), ``@mbreg`` (from ``ext-mbstring``)
+    ``@all`` (all listed sets); defaults to ``['@internal', '@IMAP']``
 
 * **no_alias_language_construct_call** [@Symfony, @PhpCsFixer]
 
@@ -1288,7 +1288,7 @@ Choose from the list of available rules:
   - ``namespaces`` (``bool``): remove unneeded curly braces from bracketed
     namespaces; defaults to ``false``
 
-* **no_unneeded_final_method** [@Symfony:risky, @PhpCsFixer:risky]
+* **no_unneeded_final_method** [@Symfony:risky, @PhpCsFixer:risky, @PHP8Migration:risky]
 
   A ``final`` class must not have ``final`` methods and ``private`` methods must
   not be ``final``.
@@ -1307,7 +1307,7 @@ Choose from the list of available rules:
 
   *Risky rule: modifies the signature of functions; therefore risky when using systems (such as some Symfony components) that rely on those (for example through reflection).*
 
-* **no_unset_cast** [@Symfony, @PhpCsFixer]
+* **no_unset_cast** [@Symfony, @PhpCsFixer, @PHP8Migration]
 
   Variables must be set ``null`` instead of using ``(unset)`` casting.
 
@@ -1343,7 +1343,7 @@ Choose from the list of available rules:
 
   Remove trailing whitespace at the end of blank lines.
 
-* **non_printable_character** [@Symfony:risky, @PhpCsFixer:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky]
+* **non_printable_character** [@Symfony:risky, @PhpCsFixer:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other
   invisible unicode symbols.
@@ -1355,7 +1355,7 @@ Choose from the list of available rules:
   - ``use_escape_sequences_in_strings`` (``bool``): whether characters should be
     replaced with escape sequences in strings; defaults to ``false``
 
-* **normalize_index_brace** [@Symfony, @PhpCsFixer, @PHP74Migration]
+* **normalize_index_brace** [@Symfony, @PhpCsFixer, @PHP74Migration, @PHP8Migration]
 
   Array index should always be written by using square braces.
 
@@ -1872,7 +1872,7 @@ Choose from the list of available rules:
   ``@var`` and ``@type`` annotations of classy properties should not contain
   the name.
 
-* **pow_to_exponentiation** [@Symfony:risky, @PhpCsFixer:risky, @PHP56Migration:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky]
+* **pow_to_exponentiation** [@Symfony:risky, @PhpCsFixer:risky, @PHP56Migration:risky, @PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Converts ``pow`` to the ``**`` operator.
 
@@ -1905,7 +1905,7 @@ Choose from the list of available rules:
 
   *Risky rule: this fixer may change your class name, which will break the code that depends on the old name.*
 
-* **random_api_migration** [@PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky]
+* **random_api_migration** [@PHP70Migration:risky, @PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Replaces ``rand``, ``srand``, ``getrandmax`` functions calls with their ``mt_*``
   analogs.
@@ -2106,7 +2106,7 @@ Choose from the list of available rules:
 
   *Risky rule: risky when relying on functions called on both sides of the ``?`` operator.*
 
-* **ternary_to_null_coalescing** [@PHP70Migration, @PHP71Migration, @PHP73Migration, @PHP74Migration]
+* **ternary_to_null_coalescing** [@PHP70Migration, @PHP71Migration, @PHP73Migration, @PHP74Migration, @PHP8Migration]
 
   Use ``null`` coalescing operator ``??`` where possible. Requires PHP >= 7.0.
 
@@ -2135,7 +2135,7 @@ Choose from the list of available rules:
 
   *Risky rule: risky when using ``isset()`` on outside variables that are not imported with ``use ()``.*
 
-* **visibility_required** [@PSR2, @Symfony, @PhpCsFixer, @PHP71Migration, @PHP73Migration, @PHP74Migration]
+* **visibility_required** [@PSR2, @Symfony, @PhpCsFixer, @PHP71Migration, @PHP73Migration, @PHP74Migration, @PHP8Migration]
 
   Visibility MUST be declared on all properties and methods; ``abstract``
   and ``final`` MUST be declared before the visibility; ``static`` MUST be
@@ -2147,7 +2147,7 @@ Choose from the list of available rules:
     elements to fix (PHP >= 7.1 required for ``const``); defaults to
     ``['property', 'method']``
 
-* **void_return** [@PHP71Migration:risky, @PHP74Migration:risky]
+* **void_return** [@PHP71Migration:risky, @PHP74Migration:risky, @PHP8Migration:risky]
 
   Add ``void`` return type to functions with missing or empty return
   statements, but priority is given to ``@return`` annotations. Requires

+ 1 - 1
composer.json

@@ -39,7 +39,7 @@
         "php-coveralls/php-coveralls": "^2.1",
         "php-cs-fixer/accessible-object": "^1.0",
         "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1",
-        "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1",
+        "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2",
         "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1",
         "phpunitgoodpractices/traits": "^1.8",
         "symfony/phpunit-bridge": "^5.1",

+ 27 - 0
dev-tools/check_file_permissions.sh

@@ -0,0 +1,27 @@
+#!/bin/sh
+set -eu
+
+files_with_wrong_permissions=$(
+    git ls-files --stage . \
+        ':!*.sh' \
+        ':!php-cs-fixer' \
+    | grep -P "100\d\d(1|3|5|7) " \
+    | sort -fh
+)
+
+if [ "$files_with_wrong_permissions" ]
+then
+    printf '\033[97;41mWrong permissions detected:\033[0m\n'
+    echo "${files_with_wrong_permissions}"
+    exit 3
+fi
+
+if [ -x "php-cs-fixer" ]
+then
+    echo '"php-cs-fixer" is executable'
+else
+    echo '"php-cs-fixer" not is executable'
+    exit 4
+fi
+
+printf '\033[0;32mNo wrong permissions detected.\033[0m\n'

+ 0 - 0
dev-tools/check-shell-scripts.sh → dev-tools/check_shell_scripts.sh


+ 0 - 0
check_trailing_spaces.sh → dev-tools/check_trailing_spaces.sh


+ 1 - 1
dev-tools/install.sh

@@ -40,5 +40,5 @@ fi
 bin/shellcheck --version
 
 echo λλλ composer packages
-composer update
+composer update -v
 composer info -D | sort

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