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

Fix tests and CS #6171

Merged
merged 1 commit into from Dec 14, 2021
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -124,7 +124,9 @@ jobs:
env:
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.PHP_CS_FIXER_IGNORE_ENV }}
FAST_LINT_TEST_CASES: ${{ matrix.FAST_LINT_TEST_CASES }}
run: vendor/bin/phpunit ${{ matrix.phpunit-flags }}
run: |
php -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SpacePossum
why we need this?
isn't it already part of the workflow, to set up configured version of PHP?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> #6172

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah if test locally work but no gitlab it is very much handly to know the patch version (like 8.0.0 vs. 8.0.1)

vendor/bin/phpunit ${{ matrix.phpunit-flags }}

- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == 'yes'
Expand Down
6 changes: 4 additions & 2 deletions src/Tokenizer/Tokens.php
Expand Up @@ -859,8 +859,10 @@ public function insertSlices(array $slices): void

krsort($slices);

if (array_key_first($slices) > $oldSize) {
throw new \OutOfBoundsException('Cannot insert outside of collection.');
$firstIndex = key($slices);

if (!\is_int($firstIndex) || $firstIndex > $oldSize) {
throw new \OutOfBoundsException(sprintf('Invalid index "%s".', $firstIndex));
}

$insertBound = $oldSize - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizer/Transformer/ReturnRefTransformer.php
Expand Up @@ -46,7 +46,7 @@ public function process(Tokens $tokens, Token $token, int $index): void
$prevKinds[] = T_FN;
}

if (($token->equals('&')) && $tokens[$tokens->getPrevMeaningfulToken($index)]->isGivenKind($prevKinds)) {
if ($token->equals('&') && $tokens[$tokens->getPrevMeaningfulToken($index)]->isGivenKind($prevKinds)) {
$tokens[$index] = new Token([CT::T_RETURN_REF, '&']);
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/Fixer/ClassNotation/VisibilityRequiredFixerTest.php
Expand Up @@ -518,7 +518,6 @@ public function testInvalidConfigurationValue(): void
}

/**
* @requires PHP 7.1
* @dataProvider provideFixClassConstCases
*/
public function testFixClassConst(string $expected, string $input): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Tokenizer/TokensTest.php
Expand Up @@ -1485,8 +1485,8 @@ public function provideInsertSlicesCases(): iterable

$slices = [
[0 => $openTagToken],
[0 => [$openTagToken]],
[0 => Tokens::fromArray([$openTagToken])],
[0 => [clone $openTagToken]],
[0 => clone Tokens::fromArray([$openTagToken])],
];

foreach ($slices as $i => $slice) {
Expand Down