Skip to content

Commit c266898

Browse files
authored
Merge pull request #1927 from jaapio/feature/multi-type-array
Adds testcase for complex return type
2 parents a8c528e + 5d3f9ba commit c266898

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

src/phpDocumentor/Application/Stage/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
use Exception;
1919
use InvalidArgumentException;
2020
use phpDocumentor\Descriptor\Cache\ProjectDescriptorMapper;
21+
use phpDocumentor\Descriptor\Collection as PartialsCollection;
2122
use phpDocumentor\Descriptor\ProjectDescriptor;
2223
use phpDocumentor\Descriptor\ProjectDescriptorBuilder;
2324
use phpDocumentor\DomainModel\Parser\FileCollector;
2425
use phpDocumentor\Event\LogEvent;
2526
use phpDocumentor\Parser\Parser as DocParser;
26-
use phpDocumentor\Descriptor\Collection as PartialsCollection;
2727
use phpDocumentor\Reflection\DocBlock\ExampleFinder;
2828
use Psr\Log\LogLevel;
2929
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

src/phpDocumentor/Plugin/Core/Transformer/Writer/Sourcecode.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public function transform(ProjectDescriptor $project, Transformation $transforma
3636
$artifact = $transformation->getTransformer()->getTarget()
3737
. DIRECTORY_SEPARATOR
3838
. ($transformation->getArtifact()
39-
? $transformation->getArtifact()
40-
: 'source');
39+
?: 'source');
4140

4241
/** @var FileDescriptor $file */
4342
foreach ($project->getFiles() as $file) {

src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ public function buildFunction(\DOMElement $parent, FunctionDescriptor $function,
287287
}
288288

289289
$namespace = $function->getNamespace()
290-
? $function->getNamespace()
291-
: $parent->getAttribute('namespace');
290+
?: $parent->getAttribute('namespace');
292291
$child->setAttribute('namespace', ltrim($namespace, '\\'));
293292
$child->setAttribute('line', $function->getLine());
294293

src/phpDocumentor/Plugin/Scrybe/ServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function register(Container $app): void
5858
};
5959

6060
$app[self::CONVERTER_DEFINITION_FACTORY] = function ($container) {
61-
return new Factory($container[ServiceProvider::FORMATS]);
61+
return new Factory($container[self::FORMATS]);
6262
};
6363

6464
$app[self::CONVERTER_FACTORY] = function ($container) {
@@ -71,7 +71,7 @@ public function register(Container $app): void
7171

7272
$app[self::TEMPLATE_FACTORY] = function ($app) {
7373
return new Template\Factory(
74-
['twig' => new Template\Twig($app[ServiceProvider::TEMPLATE_FOLDER])]
74+
['twig' => new Template\Twig($app[self::TEMPLATE_FOLDER])]
7575
);
7676
};
7777

tests/features/assets/singlefile/tags/return.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public function getReturnWithoutAny()
3333
public function getReturnDescription()
3434
{
3535
}
36+
37+
/**
38+
* @return (integer|string)[]
39+
*/
40+
public function getMultiTypeArray()
41+
{
42+
}
3643
}
3744

3845
function get(): int

tests/features/core/tags/return.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Feature: The @return tag is used to document the return value of functions or me
2222
some value
2323
"""
2424

25+
Scenario: method without docblock with return type
26+
Then class "\ReturnTag" has a method "getMultiTypeArray"
27+
And class "\ReturnTag" has a method "getMultiTypeArray" with returntype '(int|string)[]' without description
28+
2529
Scenario: method with docblock without return type
2630
Then class "\ReturnTag" has a method "getReturnWithDefinedReturn"
2731
And class "\ReturnTag" has a method "getReturnWithDefinedReturn" with returntype 'string' with description:

0 commit comments

Comments
 (0)