Tests with type resolver v2

This commit is contained in:
Jaapio
2025-12-22 23:04:25 +01:00
parent d075d95973
commit 97db20d534
6 changed files with 306 additions and 234 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
],
"require": {
"php": "^7.4 || ^8.0",
"phpdocumentor/type-resolver": "^1.7",
"phpdocumentor/type-resolver": "^1.7|^2.x-dev",
"webmozart/assert": "^1.9.1 || ^2",
"phpdocumentor/reflection-common": "^2.2",
"ext-filter": "*",
Generated
+293 -221
View File
File diff suppressed because it is too large Load Diff
@@ -335,7 +335,7 @@ DOC;
),
new Param(
'args',
new Compound([new Array_(new Mixed_()), new String_()]),
new Compound([new Array_(), new String_()]),
false,
new Description(
'{' . "\n" .
@@ -356,7 +356,7 @@ DOC;
)
),
new Return_(
new Compound([new Array_(new Mixed_()), new Object_(new Fqsen('\WP_Error'))]),
new Compound([new Array_(), new Object_(new Fqsen('\WP_Error'))]),
new Description('The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.')
),
],
@@ -407,7 +407,7 @@ identifier has already been registered.',
new Since('6.5.0', new Description('')),
new Param(
'deps',
new Array_(new Mixed_()),
new Array_(),
false,
new Description("{
Optional. List of dependencies.
+5 -5
View File
@@ -16,7 +16,7 @@ use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Callable_;
use phpDocumentor\Reflection\Types\CallableParameter;
use phpDocumentor\Reflection\Types\Collection;
use phpDocumentor\Reflection\PseudoTypes\Generic;
use phpDocumentor\Reflection\Types\Integer;
use phpDocumentor\Reflection\Types\Nullable;
use phpDocumentor\Reflection\Types\Object_;
@@ -160,19 +160,19 @@ DOCBLOCK;
],
[
'Collection<int, string>',
new Collection(new Fqsen('\\Collection'), new String_(), new Integer()),
new Generic(new Fqsen('\\Collection'), [new Integer(), new String_()]),
],
[
'Collection<TKey, Tvalue>',
new Collection(new Fqsen('\\Collection'), new Object_(new Fqsen('\\Tvalue')), new Object_(new Fqsen('\\TKey'))),
new Generic(new Fqsen('\\Collection'), [new Object_(new Fqsen('\\TKey')), new Object_(new Fqsen('\\Tvalue'))]),
],
[
'Collection<Tvalue>',
new Collection(new Fqsen('\\Collection'), new Object_(new Fqsen('\\Tvalue'))),
new Generic(new Fqsen('\\Collection'), [new Object_(new Fqsen('\\Tvalue'))]),
],
[
'callable(int $foo, string $bar): void',
new Callable_([new CallableParameter(new Integer(), 'foo'), new CallableParameter(new String_(), 'bar')], new Void_()),
new Callable_('callable', [new CallableParameter(new Integer(), 'foo'), new CallableParameter(new String_(), 'bar')], new Void_()),
],
];
}
+2 -2
View File
@@ -200,8 +200,8 @@ class ReturnTest extends TestCase
$fixture = Return_::create('array<string, string> My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('array<string,string> My Description', (string) $fixture);
$this->assertEquals('array<string,string>', $fixture->getType());
$this->assertSame('array<string, string> My Description', (string) $fixture);
$this->assertEquals('array<string, string>', $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
}
+2 -2
View File
@@ -206,8 +206,8 @@ class ThrowsTest extends TestCase
$fixture = Throws::create('array<string, string> My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('array<string,string> My Description', (string) $fixture);
$this->assertEquals('array<string,string>', $fixture->getType());
$this->assertSame('array<string, string> My Description', (string) $fixture);
$this->assertEquals('array<string, string>', $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
}