Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP7.4 - clean up tests #6289

Merged
merged 1 commit into from Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/ruleSets/PhpCsFixer.rst
Expand Up @@ -12,7 +12,7 @@ Rules
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
- `blank_line_before_statement <./../rules/whitespace/blank_line_before_statement.rst>`_
config:
``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]``
``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'yield']]``
- `combine_consecutive_issets <./../rules/language_construct/combine_consecutive_issets.rst>`_
- `combine_consecutive_unsets <./../rules/language_construct/combine_consecutive_unsets.rst>`_
- `empty_loop_body <./../rules/control_structure/empty_loop_body.rst>`_
Expand Down
2 changes: 1 addition & 1 deletion doc/rules/whitespace/blank_line_before_statement.rst
Expand Up @@ -235,7 +235,7 @@ The rule is part of the following rule sets:
@PhpCsFixer
Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``blank_line_before_statement`` rule with the config below:

``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try']]``
``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'yield']]``

@Symfony
Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``blank_line_before_statement`` rule with the config below:
Expand Down
1 change: 1 addition & 0 deletions src/Indicator/PhpUnitTestCaseIndicator.php
Expand Up @@ -72,6 +72,7 @@ public function findPhpUnitClasses(Tokens $tokens): \Generator
}

$endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $startIndex);

yield [$startIndex, $endIndex];
}
}
Expand Down
1 change: 1 addition & 0 deletions src/RuleSet/Sets/PhpCsFixerSet.php
Expand Up @@ -45,6 +45,7 @@ public function getRules(): array
'switch',
'throw',
'try',
'yield',
],
],
'combine_consecutive_issets' => true,
Expand Down
13 changes: 13 additions & 0 deletions tests/Console/Command/HelpCommandTest.php
Expand Up @@ -39,15 +39,25 @@ public function testToString(string $expected, $input): void
public function provideToStringCases(): \Generator
{
yield ["['a' => 3, 'b' => 'c']", ['a' => 3, 'b' => 'c']];

yield ['[[1], [2]]', [[1], [2]]];

yield ['[0 => [1], \'a\' => [2]]', [[1], 'a' => [2]]];

yield ['[1, 2, \'foo\', null]', [1, 2, 'foo', null]];

yield ['[1, 2]', [1, 2]];

yield ['[]', []];

yield ['1.5', 1.5];

yield ['false', false];

yield ['true', true];

yield ['1', 1];

yield ["'foo'", 'foo'];
}

Expand All @@ -64,8 +74,11 @@ public function testGetDisplayableAllowedValues($expected, FixerOptionInterface
public function provideGetDisplayableAllowedValuesCases(): \Generator
{
yield [null, new FixerOption('foo', 'bar', false, null, ['int'], [])];

yield [['A', 'B', 'x', 'z'], new FixerOption('foo', 'bar', false, null, ['string'], ['z', 'x', 'B', 'A'])];

yield [[0, 3, 9], new FixerOption('foo', 'bar', false, null, ['int'], [0, 3, 9, static function (): void {}])];

yield [null, new FixerOption('foo', 'bar')];
}
}
20 changes: 20 additions & 0 deletions tests/DocBlock/AnnotationTest.php
Expand Up @@ -555,7 +555,9 @@ public function provideTypeExpressionCases(): \Generator
$useTraversable = new NamespaceUseAnalysis('Traversable', 'Traversable', false, 0, 999, NamespaceUseAnalysis::TYPE_CLASS);

yield ['* @param array|Traversable $foo', null, [], 'iterable'];

yield ['* @param array|Traversable $foo', $appNamespace, [], null];

yield ['* @param array|Traversable $foo', $appNamespace, [$useTraversable], 'iterable'];
}

Expand All @@ -571,23 +573,41 @@ public function testGetVariableName(string $line, ?string $expectedVariableName)
public function provideGetVariableCases(): \Generator
{
yield ['* @param int $foo', '$foo'];

yield ['* @param int $foo some description', '$foo'];

yield ['/** @param int $foo*/', '$foo'];

yield ['* @param int', null];

yield ['* @var int $foo', '$foo'];

yield ['* @var int $foo some description', '$foo'];

yield ['/** @var int $foo*/', '$foo'];

yield ['* @var int', null];

yield ['* @param $foo', '$foo'];

yield ['* @param &$foo', '$foo'];

yield ['* @param & $foo', '$foo'];

yield ['* @param int &$foo', '$foo'];

yield ['* @param int & $foo', '$foo'];

yield ['* @param int ...$foo', '$foo'];

yield ['* @param int ... $foo', '$foo'];

yield ['* @param int&...$foo', '$foo'];

yield ['* @param int &...$foo', '$foo'];

yield ['* @param int & ...$foo', '$foo'];

yield ['* @param int & ... $foo', '$foo'];
}
}