Skip to content

Commit

Permalink
Merge branch 'master' into fix_phpdoc_in_anony_class_format_7541
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 6, 2024
2 parents 5831ead + 167eb6c commit 3072287
Show file tree
Hide file tree
Showing 41 changed files with 1,040 additions and 284 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
if: env.PHP_MIN == matrix.php-version && matrix.run-fixer == 'yes'
env:
PHP_CS_FIXER_FUTURE_MODE: 1
run: php php-cs-fixer check --diff -v --config .php-cs-fixer.php-lowest.php
run: php php-cs-fixer check --diff -vvv --config .php-cs-fixer.php-lowest.php

deployment:
needs: tests
Expand Down
6 changes: 3 additions & 3 deletions compose.override.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
DOCKER_GROUP_ID: ${DOCKER_GROUP_ID:-1000}
user: ${DOCKER_USER_ID:-1000}:${DOCKER_GROUP_ID:-1000}
extra_hosts:
# Required for Docker Linux until natively supported.
# See https://github.com/docker/for-linux/issues/264
- 'host.docker.internal: 172.17.0.1'
# Allow container to connect to host to use XDebug step debugging.
# This is not needed when using Docker Desktop as it supports this natively.
- 'host.docker.internal:host-gateway'
environment:
XDEBUG_MODE: ${XDEBUG_MODE:-off}
XDEBUG_CONFIG: 'idekey=${XDEBUG_IDEKEY:-PHPSTORM} client_host=${XDEBUG_CLIENT_HOST:-host.docker.internal}'
Expand Down
8 changes: 4 additions & 4 deletions dev-tools/composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"require": {
"php": "^8.3",
"ergebnis/composer-normalize": "^2.39.0",
"ergebnis/composer-normalize": "^2.24.1",
"icanhazstring/composer-unused": "^0.8.11",
"maglnet/composer-require-checker": "^4.7.1",
"maglnet/composer-require-checker": "^4.8.0",
"mi-schi/phpmd-extension": "^4.3.0",
"phpmd/phpmd": "^2.14.1",
"phpmd/phpmd": "^2.15.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.48",
"phpstan/phpstan": "^1.10.51",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2"
},
Expand Down
24 changes: 12 additions & 12 deletions dev-tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 0 additions & 90 deletions dev-tools/phpstan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/SelfUpdateCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Console/Command/SelfUpdateCommand.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
Expand Down Expand Up @@ -156,21 +151,6 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/ClassNotation/OrderedClassElementsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\ClassNotation\\\\OrderedClassElementsFixer\\:\\:sortElements\\(\\) has parameter \\$elements with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/ClassNotation/OrderedClassElementsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Comment\\\\NoEmptyCommentFixer\\:\\:getCommentBlock\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Comment/NoEmptyCommentFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Comment/SingleLineCommentStyleFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\ControlStructure\\\\YodaStyleFixer\\:\\:getCompareFixableInfo\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
Expand Down Expand Up @@ -206,21 +186,11 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\FunctionNotation\\\\PhpdocToPropertyTypeFixer\\:\\:resolveApplicableType\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/FunctionNotation/PhpdocToPropertyTypeFixer.php',
];
$ignoreErrors[] = [
'message' => '#^For loop initial assignment overwrites variable \\$index\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Import/GlobalNamespaceImportFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Import\\\\OrderedImportsFixer\\:\\:getNewOrder\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Import/OrderedImportsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Variable \\$k might not be defined\\.$#',
'count' => 1,
Expand All @@ -231,31 +201,11 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Import/OrderedImportsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Import\\\\SingleImportPerStatementFixer\\:\\:getGroupDeclaration\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Import/SingleImportPerStatementFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Variable method call on \\$this\\(PhpCsFixer\\\\Fixer\\\\LanguageConstruct\\\\DeclareEqualNormalizeFixer\\)\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/LanguageConstruct/DeclareEqualNormalizeFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\LanguageConstruct\\\\FunctionToConstantFixer\\:\\:fixGetClassCall\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/LanguageConstruct/FunctionToConstantFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\LanguageConstruct\\\\FunctionToConstantFixer\\:\\:getReplaceCandidate\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/LanguageConstruct/FunctionToConstantFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\LanguageConstruct\\\\FunctionToConstantFixer\\:\\:getReplacementTokenClones\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/LanguageConstruct/FunctionToConstantFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$configuration \\(array\\{syntax\\: \'long\'\\|\'short\'\\}\\) of method PhpCsFixer\\\\Fixer\\\\ListNotation\\\\ListSyntaxFixer\\:\\:configure\\(\\) should be contravariant with parameter \\$configuration \\(array\\<string, mixed\\>\\) of method PhpCsFixer\\\\AbstractFixer\\:\\:configure\\(\\)$#',
'count' => 1,
Expand All @@ -271,56 +221,16 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Operator/ConcatSpaceFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Operator\\\\OperatorLinebreakFixer\\:\\:getNonBooleanOperators\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Operator/OperatorLinebreakFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Operator\\\\TernaryToElvisOperatorFixer\\:\\:getBeforeOperator\\(\\) has parameter \\$blockEdgeDefinitions with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Operator/TernaryToElvisOperatorFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Variable method call on \\$this\\(PhpCsFixer\\\\Fixer\\\\PhpUnit\\\\PhpUnitConstructFixer\\)\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/PhpUnit/PhpUnitConstructFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Phpdoc\\\\NoSuperfluousPhpdocTagsFixer\\:\\:annotationIsSuperfluous\\(\\) has parameter \\$info with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Phpdoc\\\\NoSuperfluousPhpdocTagsFixer\\:\\:removeSuperfluousModifierAnnotation\\(\\) has parameter \\$element with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Method PhpCsFixer\\\\Fixer\\\\Phpdoc\\\\NoSuperfluousPhpdocTagsFixer\\:\\:toComparableNames\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 2,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/PhpdocAlignFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Foreach overwrites \\$index with its key variable\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Variable \\$index might not be defined\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Fixer/Whitespace/HeredocIndentationFixer.php',
];
$ignoreErrors[] = [
'message' => '#^Variable \\$end might not be defined\\.$#',
'count' => 2,
Expand Down
26 changes: 26 additions & 0 deletions doc/rules/function_notation/phpdoc_to_param_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Allowed types: ``bool``

Default value: ``true``

``union_types``
~~~~~~~~~~~~~~~

Fix also union types; turned on by default on PHP >= 8.0.0.

Allowed types: ``bool``

Default value: ``true``

Examples
--------

Expand Down Expand Up @@ -68,6 +77,23 @@ With configuration: ``['scalar_types' => false]``.
+function foo(Foo $foo) {}
/** @param string $foo */
function bar($foo) {}
Example #3
~~~~~~~~~~

With configuration: ``['union_types' => false]``.

.. code-block:: diff
--- Original
+++ New
<?php
/** @param Foo $foo */
-function foo($foo) {}
+function foo(Foo $foo) {}
/** @param int|string $foo */
function bar($foo) {}
References
----------

Expand Down
27 changes: 27 additions & 0 deletions doc/rules/function_notation/phpdoc_to_property_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Allowed types: ``bool``

Default value: ``true``

``union_types``
~~~~~~~~~~~~~~~

Fix also union types; turned on by default on PHP >= 8.0.0.

Allowed types: ``bool``

Default value: ``true``

Examples
--------

Expand Down Expand Up @@ -69,6 +78,24 @@ With configuration: ``['scalar_types' => false]``.
- private $bar;
+ private \Traversable $bar;
}
Example #3
~~~~~~~~~~

With configuration: ``['union_types' => false]``.

.. code-block:: diff
--- Original
+++ New
<?php
class Foo {
/** @var int|string */
private $foo;
/** @var \Traversable */
- private $bar;
+ private \Traversable $bar;
}
References
----------

Expand Down
26 changes: 26 additions & 0 deletions doc/rules/function_notation/phpdoc_to_return_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Allowed types: ``bool``

Default value: ``true``

``union_types``
~~~~~~~~~~~~~~~

Fix also union types; turned on by default on PHP >= 8.0.0.

Allowed types: ``bool``

Default value: ``true``

Examples
--------

Expand Down Expand Up @@ -79,6 +88,23 @@ With configuration: ``['scalar_types' => false]``.
Example #3
~~~~~~~~~~

With configuration: ``['union_types' => false]``.

.. code-block:: diff
--- Original
+++ New
<?php
/** @return Foo */
-function foo() {}
+function foo(): Foo {}
/** @return int|string */
function bar() {}
Example #4
~~~~~~~~~~

*Default* configuration.

.. code-block:: diff
Expand Down
3 changes: 3 additions & 0 deletions doc/rules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,9 @@ String Notation
- `explicit_string_variable <./string_notation/explicit_string_variable.rst>`_

Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax.
- `heredoc_closing_marker <./string_notation/heredoc_closing_marker.rst>`_

Unify ``heredoc`` or ``nowdoc`` closing marker.
- `heredoc_to_nowdoc <./string_notation/heredoc_to_nowdoc.rst>`_

Convert ``heredoc`` to ``nowdoc`` where possible.
Expand Down

0 comments on commit 3072287

Please sign in to comment.