Hello community, here is the log from the commit of package php-cs-fixer for openSUSE:Factory checked in at 2020-01-15 16:15:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php-cs-fixer (Old) and /work/SRC/openSUSE:Factory/.php-cs-fixer.new.30080 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php-cs-fixer" Wed Jan 15 16:15:27 2020 rev:4 rq:764442 version:2.16.1 Changes: -------- --- /work/SRC/openSUSE:Factory/php-cs-fixer/php-cs-fixer.changes 2019-06-05 11:46:57.406983858 +0200 +++ /work/SRC/openSUSE:Factory/.php-cs-fixer.new.30080/php-cs-fixer.changes 2020-01-15 16:45:30.769190527 +0100 @@ -1,0 +2,161 @@ +Wed Jan 8 13:21:01 UTC 2020 - Alexei Sorokin <sor.ale...@meowr.ru> + +- Update to version 2.16.1: + * BlankLineAfterNamespaceFixer - do not remove indent, handle comments + * MethodArgumentSpaceFixer - fix for on_multiline:ensure_fully_multiline with trailing comma in function call + * FileLintingIterator - fix current value on end/invalid + * FunctionTypehintSpaceFixer - Ensure single space between type declaration and parameter + * MethodArgumentSpaceFixer - handle misplaced ) + * NoLeadingImportSlashFixer - Add space if needed + * SimpleToComplexStringVariableFixer - Fix $ bug + * Fix preg_match error on 7.4snapshot + * IsNullFixer - fix null coalescing operator handling + * ToolInfo - fix access to reference without checking existence + * Fix non-static closure unbinding this on PHP 7.4 + * Use Box 3 to build the PHAR + * PHP 7.4 - Tests for support + * DX: test that default config is not passed in RuleSet + * DX: test to ensure @PHPUnitMigration rule sets are correctly defined + * DX: static call of markTestSkippedOrFail + * Add apostrophe to possessive "team's" + * ReadmeCommandTest - use CommandTester + * DX: control names of public methods in test's classes + * NewWithBracesFixer - Fix object operator and curly brace open cases + * fix typos in README + * DX: Fix shell script syntax in order to fix Travis builds + * DX: Lock binary SCA tools versions + * Revert PHP7.4 - Add "str_split" => "mb_str_split" mapping + * DX: AutoReview - ensure Travis handle all needed PHP versions + * MethodArgumentSpaceFixerTest - make explicit configuration to prevent fail on configuration change + * IndentationTypeFixer - fix handling 2 spaces indent + * NoSuperfluousElseifFixer - fix invalid escape sequence in character class + * NoUnusedImports - Fix imports detected as used in namespaces + * PhpUnitNoExpectationAnnotationFixer - fix handling expect empty exception message + * HeredocIndentationFixer - remove whitespace in empty lines + * ClassKeywordRemoveFixer - fix for self,static and parent keywords + * TokensAnalyzer - handle nested anonymous classes + * CombineConsecutiveIssetsFixer - fix stop based on precedence + * Fix command exit code on lint error after fixing fix. + * FunctionsAnalyzer: fix for comment in type + * BracesFixer - handle dynamic static method call + * Braces - fix both single line comment styles + * PhpdocTypesOrderFixer - Prevent unexpected default value change + * Add PHPStan + * IncludeFixer - remove braces when the statement is wrapped in block + * Allow running if installed as project specific + * Verify PCRE pattern before use + * Remove superfluous leading backslash, closes 4520 + * DX: ensure data providers are used + * Redo PHP7.4 - Add "str_split" => "mb_str_split" mapping + * DX: use PHIVE for dev tools + * Docs: update Cookbook + * Enhancement: Use default name property to configure command names + * DX: removing unnecessary variable initialization + * DX: use ::class whenever possible + * DX: travis_retry for dev-tools install + * Allow 7.4snapshot to fail due to a bug on it + * GitlabReporter - fix report output + * Move readme-update command to Section 3 + * Update symfony ruleset + * Command::execute() should always return an integer + * Add suport for true/false return type hints. + * Increase PHPStan level to 1 + * Fix deprecation notices + * Output details - Explain why a file was skipped + * Fix STDIN test when path is one level deep + * PhpdocToReturnType - Add support for Foo[][] + * Ensure compatibility with PHP 7.4 typed properties + * Import cannot be used after `::` so can be removed + * Ensure compatibility with PHP 7.4 numeric literal separator + * Fix PHP 7.4 deprecation notices + * Ensure compatibility with PHP 7.4 arrow functions + * Ensure compatibility with PHP 7.4 spread operator in array expression + * Ensure compatibility with PHP 7.4 null coalescing assignment operator + * Configure no_superfluous_phpdoc_tags for Symfony + * Travis CI - Update known files list + * Remove workaround for dev-tools install reg. Phive + * FunctionsAnalyzer - add "isTheSameClassCall" for correct verifying of function calls + * Add typed properties test to VisibilityRequiredFixerTest + * ArrayIndentationFixer - Fix array indentation for multiline values + * TokensAnalyzer::isConstantInvocation - fix for extending multiple interfaces + * TokensAnalyzer::isConstantInvocation - fix for interface method return type + * Allow Symfony 5 components (l-vo) + * Disallow PHP 7.4 failures on Travis CI + * PHP 7.4 integration test + * DX: Update .gitattributes and move ci-integration.sh to root of the project + * Check PHP extensions on runtime + * Improve docs - README + * DX: generate headers in README.rst + * Enable execution under PHP 7.4 + * TravisTest - rewrite tests to allow last supported by tool PHP version to be snapshot + * PhpdocLineSpanFixer - Introduction + * Add FinalPublicMethodForAbstractClassFixer + * FinalStaticAccessFixer - Introduction + * Issue #4274: Let lowercase_constants directive to be configurable. + * GlobalNamespaceImportFixer - Introduction + * SelfStaticAccessorFixer - Introduction + * CommentToPhpdocFixer - allow to ignore tags + * Add NullableTypeDeclarationForDefaultNullValueFixer + * Add SingleLineThrowFixer + * NoSuperfluousPhpdocTags - Add remove_inheritdoc option + * NoSuperfluousPhpdocTagsFixer - allow params that aren't on the signature + * PhpdocAlignFixer - add "property-read" and "property-write" to allowed tags + * Phpdoc to param type fixer rebase + * Raise deprecation warnings on usage of deprecated aliases + * DX: update branch alias + * SelfStaticAccessor - extend itests + * Configure no_superfluous_phpdoc_tags for Symfony + * DX: fix usage of deprecated options + * Fix PHP 7.3 strict mode warnings + * Add single_line_throw to Symfony ruleset + * FunctionsAnalyzer - add "isTheSameClassCall" for correct verifying of function calls + * PhpdocToParamTypeFixer - cover more cases + * FinalPublicMethodForAbstractClassFixer - Do not attempt to mark abstract public methods as final + * NullableTypeDeclarationForDefaultNullValueFixer - fix for not lowercase "null" + * Ensure compatibility with PHP 7.4 + * Add typed properties test to VisibilityRequiredFixerTest + * ArrayIndentationFixer - Fix array indentation for multiline values + * TokensAnalyzer::isConstantInvocation - fix for extending multiple interfaces + * TokensAnalyzer::isConstantInvocation - fix for interface method return type + * Allow Symfony 5 components + * Disallow PHP 7.4 failures on Travis CI + * README - Mark up as code + * PHP 7.4 integration test + * DX: Update .gitattributes and move ci-integration.sh to root of the project + * Check PHP extensions on runtime + * Improve docs - README (mvorisek) + * DX: generate headers in README.rst + * Enable execution under PHP 7.4 + * TravisTest - rewrite tests to allow last supported by tool PHP version to be snapshot +- Update README.rst. +- Define both the minimum and maximum versions in the PHP "build" + dependency. +- Minor spec clean-up. + +------------------------------------------------------------------- +Thu Jul 11 10:28:57 UTC 2019 - ec...@opensuse.org + +- Update to release 2.15.1 + * bug #4418 PhpUnitNamespacedFixer - properly translate classes + which do not follow translation pattern (ktomk) + * bug #4419 PhpUnitTestCaseStaticMethodCallsFixer - skip + anonymous classes and lambda (SpacePossum) + * bug #4420 MethodArgumentSpaceFixer - PHP7.3 trailing commas in + function calls (SpacePossum) + * minor #4345 Travis: PHP 7.4 isn't allowed to fail anymore + (Slamdunk) + * minor #4403 LowercaseStaticReferenceFixer - Fix invalid PHP + version in example (HypeMC) + * minor #4424 DX: cleanup of composer.json - no need for + branch-alias (keradus) + * minor #4425 DX: assertions are static, adjust custom + assertions (keradus) + * minor #4426 DX: handle deprecations of + symfony/event-dispatcher:4.3 (keradus) + * minor #4427 DX: stop using reserved T_FN in code samples + (keradus) + * minor #4428 DX: update dev-tools (keradus) + * minor #4429 DX: MethodArgumentSpaceFixerTest - fix hidden merge + conflict (keradus) + +------------------------------------------------------------------- Old: ---- php-cs-fixer.phar php-cs-fixer.phar.asc New: ---- php-cs-fixer-2.16.1.phar php-cs-fixer-2.16.1.phar.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php-cs-fixer.spec ++++++ --- /var/tmp/diff_new_pack.VeohD0/_old 2020-01-15 16:45:31.337190842 +0100 +++ /var/tmp/diff_new_pack.VeohD0/_new 2020-01-15 16:45:31.337190842 +0100 @@ -1,7 +1,7 @@ # # spec file for package php-cs-fixer # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,19 +17,20 @@ %define package_name PHP-CS-Fixer -%global doc_version 2.14 +%global doc_version 2.16 Name: php-cs-fixer -Version: 2.14.4 +Version: 2.16.1 Release: 0 Summary: PHP Coding Standards Fixer License: MIT Group: Development/Tools/Building URL: https://cs.symfony.com/ -Source: https://github.com/FriendsOfPHP/%{package_name}/releases/download/v%{version}/%{name}.phar -Source1: https://github.com/FriendsOfPHP/%{package_name}/releases/download/v%{version}/%{name}.phar.asc +Source: https://github.com/FriendsOfPHP/%{package_name}/releases/download/v%{version}/%{name}.phar#/%{name}-%{version}.phar +Source1: https://github.com/FriendsOfPHP/%{package_name}/releases/download/v%{version}/%{name}.phar.asc#/%{name}-%{version}.phar.asc Source2: %{name}.keyring Source3: https://raw.githubusercontent.com/FriendsOfPHP/PHP-CS-Fixer/v%{version}/README.rst Source4: https://raw.githubusercontent.com/FriendsOfPHP/PHP-CS-Fixer/v%{version}/LICENSE +BuildRequires: php7 < 7.5.0 BuildRequires: php7 >= 7.0.0 Requires: php7-iconv Requires: php7-json @@ -38,29 +39,31 @@ BuildArch: noarch %description -The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes code to follow -standards; this can be the PHP coding standards as defined in the -PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. -Custom styles can also be defined through configuration. +The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes code to +follow standards; this can be the PHP coding standards as defined +in the PSR-1, PSR-2, etc., or other community driven ones like the +Symfony one. Custom styles can also be defined through +configuration. -It can modernize code (like converting the pow function to the ** operator -on PHP 5.6) and (micro) optimize it. +It can modernise code (like converting the pow function to the ** +operator on PHP 5.6) and (micro) optimize it. %prep %setup -q -c -T -cp %{SOURCE3} %{SOURCE4} . +cp -a %{SOURCE0} %{name} +cp -a %{SOURCE3} %{SOURCE4} . +# Any alteration breaks the phar. +# sed -i '1c\#!%{_bindir}/php' php-cs-fixer %build -# empty section +# Nothing to build. %install -# Install compiled phar file -install -d -m 0750 %{buildroot}%{_bindir} -install -m 0755 %{SOURCE0} %{buildroot}%{_bindir}/php-cs-fixer +install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name} %files -%doc README.rst %license LICENSE -%{_bindir}/* +%doc README.rst +%{_bindir}/%{name} %changelog ++++++ README.rst ++++++ --- /var/tmp/diff_new_pack.VeohD0/_old 2020-01-15 16:45:31.413190884 +0100 +++ /var/tmp/diff_new_pack.VeohD0/_new 2020-01-15 16:45:31.417190887 +0100 @@ -4,7 +4,7 @@ The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. -You can **also** define your (teams) style through configuration. +You can **also** define your (team's) style through configuration. It can modernize your code (like converting the ``pow`` function to the ``**`` operator on PHP 5.6) and (micro) optimize it. @@ -46,7 +46,7 @@ .. code-block:: bash - $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.4/php-cs-fixer.phar -O php-cs-fixer + $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.1/php-cs-fixer.phar -O php-cs-fixer or with curl: @@ -134,7 +134,7 @@ $ brew upgrade php-cs-fixer Locally (PHIVE) -~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~ .. code-block:: bash @@ -159,7 +159,7 @@ $ php php-cs-fixer.phar fix --path-mode=intersection /path/to/dir -The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle`` and ``junit``. +The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle``, ``junit`` and ``gitlab``. NOTE: the output for the following formats are generated in accordance with XML schemas @@ -167,9 +167,9 @@ * ``checkstyle`` follows the common `"checkstyle" xml schema </doc/checkstyle.xsd>`_ -The ``--verbose`` option will show the applied rules. When using the ``txt`` format it will also displays progress notifications. +The ``--verbose`` option will show the applied rules. When using the ``txt`` format it will also display progress notifications. -The ``--rules`` option limits the rules to apply on the +The ``--rules`` option limits the rules to apply to the project: .. code-block:: bash @@ -214,7 +214,7 @@ * ``sbd``: Sebastianbergmann/diff format (default when using `--diff` without specifying `diff-format`). The ``--allow-risky`` option (pass ``yes`` or ``no``) allows you to set whether risky rules may run. Default value is taken from config file. -Risky rule is a rule, which could change code behaviour. By default no risky rules are run. +A rule is considered risky if it could change code behaviour. By default no risky rules are run. The ``--stop-on-violation`` flag stops the execution upon first file that needs to be fixed. @@ -264,7 +264,7 @@ Each element of an array must be indented exactly once. -* **array_syntax** [@PhpCsFixer] +* **array_syntax** [@Symfony, @PhpCsFixer] PHP arrays should be declared using the configured syntax. @@ -404,6 +404,10 @@ *Risky rule: risky as new docblocks might mean more, e.g. a Doctrine entity might have a new column in database.* + Configuration options: + + - ``ignored_tags`` (``array``): list of ignored tags; defaults to ``[]`` + * **compact_nullable_typehint** [@PhpCsFixer] Remove extra spaces in a nullable typehint. @@ -417,6 +421,16 @@ - ``spacing`` (``'none'``, ``'one'``): spacing to apply around concatenation operator; defaults to ``'none'`` +* **constant_case** [@PSR2, @Symfony, @PhpCsFixer] + + The PHP constants ``true``, ``false``, and ``null`` MUST be written using the + correct casing. + + Configuration options: + + - ``case`` (``'lower'``, ``'upper'``): whether to use the ``upper`` or ``lower`` case + syntax; defaults to ``'lower'`` + * **date_time_immutable** Class ``DateTimeImmutable`` should be used instead of ``DateTime``. @@ -639,6 +653,12 @@ Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax. +* **final_class** + + All classes must be final, except abstract ones and Doctrine entities. + + *Risky rule: risky when subclassing non-abstract classes.* + * **final_internal_class** [@PhpCsFixer:risky] Internal classes should be ``final``. @@ -649,10 +669,23 @@ - ``annotation-black-list`` (``array``): class level annotations tags that must be omitted to fix the class, even if all of the white list ones are used - as well. (case insensitive); defaults to ``['@final', '@Entity', '@ORM']`` + as well. (case insensitive); defaults to ``['@final', '@Entity', + '@ORM\\Entity']`` - ``annotation-white-list`` (``array``): class level annotations tags that must be set in order to fix the class. (case insensitive); defaults to ``['@internal']`` + - ``consider-absent-docblock-as-internal-class`` (``bool``): should classes + without any DocBlock be fixed to final?; defaults to ``false`` + +* **final_public_method_for_abstract_class** + + All ``public`` methods of ``abstract`` classes should be ``final``. + + *Risky rule: risky when overriding ``public`` methods of ``abstract`` classes.* + +* **final_static_access** + + Converts ``static`` access to ``self`` access in ``final`` classes. * **fopen_flag_order** [@Symfony:risky, @PhpCsFixer:risky] @@ -705,7 +738,7 @@ * **function_typehint_space** [@Symfony, @PhpCsFixer] - Add missing space between function's argument and its typehint. + Ensure single space between function's argument and its typehint. * **general_phpdoc_annotation_remove** @@ -716,6 +749,19 @@ - ``annotations`` (``array``): list of annotations to remove, e.g. ``["author"]``; defaults to ``[]`` +* **global_namespace_import** + + Imports or fully qualifies global classes/functions/constants. + + Configuration options: + + - ``import_classes`` (``false``, ``null``, ``true``): whether to import, not import or + ignore global classes; defaults to ``true`` + - ``import_constants`` (``false``, ``null``, ``true``): whether to import, not import or + ignore global constants; defaults to ``null`` + - ``import_functions`` (``false``, ``null``, ``true``): whether to import, not import or + ignore global functions; defaults to ``null`` + * **hash_to_slash_comment** Single line comments should use double slashes ``//`` and not hash ``#``. @@ -735,7 +781,7 @@ - ``separate`` (``'both'``, ``'bottom'``, ``'none'``, ``'top'``): whether the header should be separated from the file content with a new line; defaults to ``'both'`` -* **heredoc_indentation** +* **heredoc_indentation** [@PHP73Migration] Heredoc/nowdoc content must be properly indented. Requires PHP >= 7.3. @@ -808,9 +854,10 @@ Cast should be written in lower case. -* **lowercase_constants** [@PSR2, @Symfony, @PhpCsFixer] +* **lowercase_constants** The PHP constants ``true``, ``false``, and ``null`` MUST be in lower case. + DEPRECATED: use ``constant_case`` instead. * **lowercase_keywords** [@PSR2, @Symfony, @PhpCsFixer] @@ -845,6 +892,8 @@ Configuration options: + - ``after_heredoc`` (``bool``): whether the whitespace between heredoc end and + comma should be removed; defaults to ``false`` - ``ensure_fully_multiline`` (``bool``): ensure every argument of a multiline argument list is on its own line; defaults to ``false``. DEPRECATED: use option ``on_multiline`` instead @@ -929,6 +978,10 @@ - ``strict`` (``bool``): whether leading ``\`` of function call not meant to have it should be removed; defaults to ``false`` +* **native_function_type_declaration_casing** [@Symfony, @PhpCsFixer] + + Native type hints for functions should use the correct case. + * **new_with_braces** [@Symfony, @PhpCsFixer] All instances created with new keyword must be followed by braces. @@ -1050,7 +1103,8 @@ * **no_null_property_initialization** [@PhpCsFixer] - Properties MUST not be explicitly initialized with ``null``. + Properties MUST not be explicitly initialized with ``null`` except when + they have a type declaration (PHP 7.4). * **no_php4_constructor** @@ -1094,7 +1148,7 @@ Replaces superfluous ``elseif`` with ``if``. -* **no_superfluous_phpdoc_tags** +* **no_superfluous_phpdoc_tags** [@Symfony, @PhpCsFixer] Removes ``@param`` and ``@return`` tags that don't provide any useful information. @@ -1103,6 +1157,10 @@ - ``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 + signature is allowed (``true``) or considered superfluous (``false``); + defaults to ``false`` + - ``remove_inheritdoc`` (``bool``): remove ``@inheritDoc`` tags; defaults to ``false`` * **no_trailing_comma_in_list_call** [@Symfony, @PhpCsFixer] @@ -1154,7 +1212,7 @@ Properties should be set to ``null`` instead of using ``unset``. - *Risky rule: changing variables to ``null`` instead of unsetting them will mean they still show up when looping over class variables.* + *Risky rule: changing variables to ``null`` instead of unsetting them will mean they still show up when looping over class variables. With PHP 7.4, this rule might introduce ``null`` assignments to property whose type declaration does not allow it.* * **no_unused_imports** [@Symfony, @PhpCsFixer] @@ -1173,6 +1231,11 @@ In array declaration, there MUST NOT be a whitespace before each comma. + Configuration options: + + - ``after_heredoc`` (``bool``): whether the whitespace between heredoc end and + comma should be removed; defaults to ``false`` + * **no_whitespace_in_blank_line** [@Symfony, @PhpCsFixer] Remove trailing whitespace at the end of blank lines. @@ -1202,6 +1265,17 @@ Logical NOT operators (``!``) should have one trailing whitespace. +* **nullable_type_declaration_for_default_null_value** + + Adds or removes ``?`` before type declarations for parameters with a + default ``null`` value. + + Configuration options: + + - ``use_nullable_type_declaration`` (``bool``): whether to add or remove ``?`` + before type declarations for parameters with a default ``null`` value; + defaults to ``true`` + * **object_operator_without_whitespace** [@Symfony, @PhpCsFixer] There should not be space before or after object ``T_OBJECT_OPERATOR`` @@ -1229,7 +1303,7 @@ - ``sortAlgorithm`` (``'alpha'``, ``'none'``): how multiple occurrences of same type statements should be sorted; defaults to ``'none'`` -* **ordered_imports** [@PhpCsFixer] +* **ordered_imports** [@Symfony, @PhpCsFixer] Ordering ``use`` statements. @@ -1241,6 +1315,19 @@ should be sorted alphabetically or by length, or not sorted; defaults to ``'alpha'``; DEPRECATED alias: ``sortAlgorithm`` +* **ordered_interfaces** + + Orders the interfaces in an ``implements`` or ``interface extends`` clause. + + *Risky rule: risky for ``implements`` when specifying both an interface and its parent interface, because PHP doesn't break on ``parent, child`` but does on ``child, parent``.* + + Configuration options: + + - ``direction`` (``'ascend'``, ``'descend'``): which direction the interfaces should + be ordered; defaults to ``'ascend'`` + - ``order`` (``'alpha'``, ``'length'``): how the interfaces should be ordered; + defaults to ``'alpha'`` + * **php_unit_construct** [@Symfony:risky, @PhpCsFixer:risky] PHPUnit assertion method calls like ``->assertSame(true, $foo)`` should be @@ -1255,7 +1342,7 @@ defaults to ``['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']`` -* **php_unit_dedicate_assert** [@PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky] +* **php_unit_dedicate_assert** [@PHPUnit30Migration:risky, @PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky, @PHPUnit75Migration:risky] PHPUnit assertions like ``assertInternalType``, ``assertFileExists``, should be used over ``assertTrue``. @@ -1273,7 +1360,19 @@ - ``target`` (``'3.0'``, ``'3.5'``, ``'5.0'``, ``'5.6'``, ``'newest'``): target version of PHPUnit; defaults to ``'5.0'`` -* **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky] +* **php_unit_dedicate_assert_internal_type** [@PHPUnit75Migration:risky] + + PHPUnit assertions like ``assertIsArray`` should be used over + ``assertInternalType``. + + *Risky rule: risky when PHPUnit methods are overridden or when project has PHPUnit incompatibilities.* + + Configuration options: + + - ``target`` (``'7.5'``, ``'newest'``): target version of PHPUnit; defaults to + ``'newest'`` + +* **php_unit_expectation** [@PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky, @PHPUnit75Migration:risky] Usages of ``->setExpectedException*`` methods MUST be replaced by ``->expectException*`` methods. @@ -1308,7 +1407,7 @@ - ``case`` (``'camel_case'``, ``'snake_case'``): apply camel or snake case to test methods; defaults to ``'camel_case'`` -* **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky] +* **php_unit_mock** [@PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky, @PHPUnit75Migration:risky] Usages of ``->getMock`` and ``->getMockWithoutInvokingTheOriginalConstructor`` methods MUST be @@ -1321,7 +1420,14 @@ - ``target`` (``'5.4'``, ``'5.5'``, ``'newest'``): target version of PHPUnit; defaults to ``'newest'`` -* **php_unit_namespaced** [@PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky] +* **php_unit_mock_short_will_return** [@Symfony:risky, @PhpCsFixer:risky] + + Usage of PHPUnit's mock e.g. ``->will($this->returnValue(..))`` must be + replaced by its shorter equivalent such as ``->willReturn(...)``. + + *Risky rule: risky when PHPUnit classes are overridden or not accessible, or when project has PHPUnit incompatibilities.* + +* **php_unit_namespaced** [@PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky, @PHPUnit75Migration:risky] PHPUnit classes MUST be used in namespaced version, e.g. ``\PHPUnit\Framework\TestCase`` instead of ``\PHPUnit_Framework_TestCase``. @@ -1333,7 +1439,7 @@ - ``target`` (``'4.8'``, ``'5.7'``, ``'6.0'``, ``'newest'``): target version of PHPUnit; defaults to ``'newest'`` -* **php_unit_no_expectation_annotation** [@PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky] +* **php_unit_no_expectation_annotation** [@PHPUnit32Migration:risky, @PHPUnit35Migration:risky, @PHPUnit43Migration:risky, @PHPUnit48Migration:risky, @PHPUnit50Migration:risky, @PHPUnit52Migration:risky, @PHPUnit54Migration:risky, @PHPUnit55Migration:risky, @PHPUnit56Migration:risky, @PHPUnit57Migration:risky, @PHPUnit60Migration:risky, @PHPUnit75Migration:risky] Usages of ``@expectedException*`` annotations MUST be replaced by ``->setExpectedException*`` methods. @@ -1357,6 +1463,16 @@ *Risky rule: this fixer may change functions named ``setUp()`` or ``tearDown()`` outside of PHPUnit tests, when a class is wrongly seen as a PHPUnit test.* +* **php_unit_size_class** + + All PHPUnit test cases should have ``@small``, ``@medium`` or ``@large`` + annotation to enable run time limits. + + Configuration options: + + - ``group`` (``'large'``, ``'medium'``, ``'small'``): define a specific group to be used + in case no group is already in use; defaults to ``'small'`` + * **php_unit_strict** [@PhpCsFixer:risky] PHPUnit methods like ``assertSame`` should be used instead of @@ -1421,9 +1537,10 @@ Configuration options: - ``align`` (``'left'``, ``'vertical'``): align comments; defaults to ``'vertical'`` - - ``tags`` (a subset of ``['param', 'property', 'return', 'throws', 'type', - 'var', 'method']``): the tags that should be aligned; defaults to - ``['param', 'return', 'throws', 'type', 'var']`` + - ``tags`` (a subset of ``['param', 'property', 'property-read', + 'property-write', 'return', 'throws', 'type', 'var', 'method']``): the + tags that should be aligned; defaults to ``['param', 'return', 'throws', + 'type', 'var']`` * **phpdoc_annotation_without_dot** [@Symfony, @PhpCsFixer] @@ -1437,6 +1554,20 @@ Fix PHPDoc inline tags, make ``@inheritdoc`` always inline. +* **phpdoc_line_span** + + Changes doc blocks from single to multi line, or reversed. Works for + class constants, properties and methods only. + + Configuration options: + + - ``const`` (``'multi'``, ``'single'``): whether const blocks should be single or + multi line; defaults to ``'multi'`` + - ``method`` (``'multi'``, ``'single'``): whether method doc blocks should be single + or multi line; defaults to ``'multi'`` + - ``property`` (``'multi'``, ``'single'``): whether property doc blocks should be + single or multi line; defaults to ``'multi'`` + * **phpdoc_no_access** [@Symfony, @PhpCsFixer] ``@access`` annotations should be omitted from PHPDoc. @@ -1451,7 +1582,7 @@ ones; defaults to ``['property-read' => 'property', 'property-write' => 'property', 'type' => 'var', 'link' => 'see']`` -* **phpdoc_no_empty_return** [@Symfony, @PhpCsFixer] +* **phpdoc_no_empty_return** [@PhpCsFixer] ``@return void`` and ``@return null`` annotations should be omitted from PHPDoc. @@ -1511,6 +1642,18 @@ Docblocks should only be used on structural elements. +* **phpdoc_to_param_type** + + EXPERIMENTAL: Takes ``@param`` annotations of non-mixed types and adjusts + accordingly the function signature. Requires PHP >= 7.0. + + *Risky rule: [1] This rule is EXPERIMENTAL and is not covered with backward compatibility promise. [2] ``@param`` annotation is mandatory for the fixer to make changes, signatures of methods without it (no docblock, inheritdocs) will not be fixed. [3] Manual actions are required if inherited signatures are not properly documented.* + + Configuration options: + + - ``scalar_types`` (``bool``): fix also scalar types; may have unexpected + behaviour due to PHP bad type coercion system; defaults to ``true`` + * **phpdoc_to_return_type** EXPERIMENTAL: Takes ``@return`` annotation of non-mixed types and adjusts @@ -1528,7 +1671,7 @@ PHPDoc should start and end with content, excluding the very first and last line of the docblocks. -* **phpdoc_trim_consecutive_blank_line_separation** [@PhpCsFixer] +* **phpdoc_trim_consecutive_blank_line_separation** [@Symfony, @PhpCsFixer] Removes extra blank lines after summary and after description in PHPDoc. @@ -1573,7 +1716,7 @@ Pre incrementation/decrementation should be used if possible. DEPRECATED: use ``increment_style`` instead. -* **protected_to_private** [@Symfony, @PhpCsFixer] +* **protected_to_private** [@PhpCsFixer] Converts ``protected`` variables and methods to ``private`` where possible. @@ -1582,7 +1725,7 @@ Classes must be in a path that matches their namespace, be at least one namespace deep and the class name should match the file name. - *Risky rule: this fixer may change your class name, which will break the code that is depended on old name.* + *Risky rule: this fixer may change your class name, which will break the code that depends on the old name.* Configuration options: @@ -1593,7 +1736,7 @@ Class names should match the file name. - *Risky rule: this fixer may change your class name, which will break the code that is depended on old name.* + *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] @@ -1630,6 +1773,11 @@ *Risky rule: risky when using dynamic calls like get_called_class() or late static binding.* +* **self_static_accessor** + + Inside a ``final`` class or anonymous class ``self`` should be preferred to + ``static``. + * **semicolon_after_instruction** [@Symfony, @PhpCsFixer] Instructions must be terminated with a semicolon. @@ -1653,6 +1801,11 @@ *Risky rule: silencing of deprecation errors might cause changes to code behaviour.* +* **simple_to_complex_string_variable** [@PhpCsFixer] + + Converts explicit variables in double-quoted strings and heredoc syntax + from simple to complex format (``${`` to ``{$``). + * **simplified_null_return** A return statement wishing to return ``void`` should not return ``null``. @@ -1695,6 +1848,10 @@ - ``comment_types`` (a subset of ``['asterisk', 'hash']``): list of comment types to fix; defaults to ``['asterisk', 'hash']`` +* **single_line_throw** [@Symfony] + + Throwing exception must be done in single line. + * **single_quote** [@Symfony, @PhpCsFixer] Convert double quotes to single quotes for simple strings. @@ -1704,6 +1861,10 @@ - ``strings_containing_single_quote_chars`` (``bool``): whether to fix double-quoted strings that contains single-quotes; defaults to ``false`` +* **single_trait_insert_per_statement** [@Symfony, @PhpCsFixer] + + Each trait ``use`` must be done as single statement. + * **space_after_semicolon** [@Symfony, @PhpCsFixer] Fix whitespace after a semicolon. @@ -1757,7 +1918,7 @@ Standardize spaces around ternary operator. -* **ternary_to_null_coalescing** [@PHP70Migration, @PHP71Migration] +* **ternary_to_null_coalescing** [@PHP70Migration, @PHP71Migration, @PHP73Migration] Use ``null`` coalescing operator ``??`` where possible. Requires PHP >= 7.0. @@ -1765,6 +1926,11 @@ PHP multi-line arrays should have a trailing comma. + Configuration options: + + - ``after_heredoc`` (``bool``): whether a trailing comma should also be placed + after heredoc end; defaults to ``false`` + * **trim_array_spaces** [@Symfony, @PhpCsFixer] Arrays should be formatted like function/method arguments, without @@ -1774,7 +1940,7 @@ Unary operators should be placed adjacent to their operands. -* **visibility_required** [@PSR2, @Symfony, @PhpCsFixer, @PHP71Migration] +* **visibility_required** [@PSR2, @Symfony, @PhpCsFixer, @PHP71Migration, @PHP73Migration] Visibility MUST be declared on all properties and methods; ``abstract`` and ``final`` MUST be declared before the visibility; ``static`` MUST be @@ -1788,7 +1954,7 @@ * **void_return** [@PHP71Migration:risky] - Add void return type to functions with missing or empty return + Add ``void`` return type to functions with missing or empty return statements, but priority is given to ``@return`` annotations. Requires PHP >= 7.1. @@ -1827,7 +1993,7 @@ Instead of using command line options to customize the rule, you can save the project configuration in a ``.php_cs.dist`` file in the root directory of your project. -The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.14.4/src/ConfigInterface.php>`_ +The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.16.1/src/ConfigInterface.php>`_ which lets you configure the rules, the files and directories that need to be analyzed. You may also create ``.php_cs`` file, which is the local configuration that will be used instead of the project configuration. It @@ -1857,6 +2023,7 @@ ; **NOTE**: ``exclude`` will work only for directories, so if you need to exclude file, try ``notPath``. +Both ``exclude`` and ``notPath`` methods accept only relative paths to the ones defined with the ``in`` method. See `Symfony\\Finder <https://symfony.com/doc/current/components/finder.html>`_ online documentation for other `Finder` methods. @@ -1959,7 +2126,7 @@ * 32 - Configuration error of a Fixer. * 64 - Exception raised within the application. -(Applies to exit code of the `fix` command only) +(Applies to exit code of the ``fix`` command only) Helpers -------