Skip to content

Commit

Permalink
DX: fix deprecation tests warnings for PHP 7.4 (#7725)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 14, 2024
1 parent 12bdc76 commit 6d57705
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 43 deletions.
2 changes: 1 addition & 1 deletion tests/AutoReview/ProjectCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function testDataProvidersDeclaredReturnType(string $testClassName, \Refl
{
$methodId = $testClassName.'::'.$method->getName();

self::assertSame('iterable', $method->hasReturnType() ? $method->getReturnType()->__toString() : null, sprintf('DataProvider `%s` must provide `iterable` as return in method prototype.', $methodId));
self::assertSame('iterable', $method->hasReturnType() && $method->getReturnType() instanceof \ReflectionNamedType ? $method->getReturnType()->getName() : null, sprintf('DataProvider `%s` must provide `iterable` as return in method prototype.', $methodId));

$doc = new DocBlock(false !== $method->getDocComment() ? $method->getDocComment() : '/** */');

Expand Down
86 changes: 44 additions & 42 deletions tests/Tokenizer/Transformer/NameQualifiedTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,50 +108,52 @@ public static function provideProcessCases(): iterable
];
}

yield 'name fully qualified 1' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Foo']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_FULLY_QUALIFIED, '\Foo']),
new Token(';'),
],
];
if (\defined('T_NAME_FULLY_QUALIFIED')) { // @TODO: drop condition when PHP 8.0+ is required
yield 'name fully qualified 1' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Foo']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_FULLY_QUALIFIED, '\Foo']),
new Token(';'),
],
];

yield 'name qualified 1' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_STRING, 'Foo']),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Bar']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_QUALIFIED, 'Foo\Bar']),
new Token(';'),
],
];
yield 'name qualified 1' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_STRING, 'Foo']),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Bar']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_QUALIFIED, 'Foo\Bar']),
new Token(';'),
],
];

yield 'name qualified 2' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Foo']),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Bar']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_QUALIFIED, '\Foo\Bar']),
new Token(';'),
],
];
yield 'name qualified 2' => [
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Foo']),
new Token([T_NS_SEPARATOR, '\\']),
new Token([T_STRING, 'Bar']),
new Token(';'),
],
[
new Token([T_OPEN_TAG, "<?php\n"]),
new Token([T_NAME_QUALIFIED, '\Foo\Bar']),
new Token(';'),
],
];
}
}

/**
Expand Down

0 comments on commit 6d57705

Please sign in to comment.