Skip to content

Commit

Permalink
Fix legacy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed May 6, 2022
1 parent a2605af commit d59d1e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Analysers/ReflectionAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
$definition[$contextType == 'class' ? 'implements' : 'extends'] = array_map($normaliseClass, $details['interfaces']);
$definition['traits'] = array_map($normaliseClass, $details['traits']);

foreach ($this->annotationFactories as $annotationFactory) {
$analysis->addAnnotations($annotationFactory->build($rc, $context), $context);
}

foreach ($rc->getMethods() as $method) {
if (in_array($method->name, $details['methods'])) {
$definition['methods'][$method->getName()] = $ctx = new Context([
Expand Down Expand Up @@ -174,10 +178,6 @@ protected function analyzeFqdn(string $fqdn, Analysis $analysis, array $details)
}
}

foreach ($this->annotationFactories as $annotationFactory) {
$analysis->addAnnotations($annotationFactory->build($rc, $context), $context);
}

$addDefinition = 'add' . ucfirst($contextType) . 'Definition';
$analysis->{$addDefinition}($definition);

Expand Down
4 changes: 2 additions & 2 deletions src/Processors/DocBlockDescriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __invoke(Analysis $analysis)
}
}

private function description($annotation): void
protected function description($annotation): void
{
if (!Generator::isDefault($annotation->description)) {
if ($annotation->description === null) {
Expand All @@ -61,7 +61,7 @@ private function description($annotation): void
$annotation->description = $annotation->_context->phpdocContent();
}

private function summaryAndDescription($annotation): void
protected function summaryAndDescription($annotation): void
{
$ignoreSummary = !Generator::isDefault($annotation->summary);
$ignoreDescription = !Generator::isDefault($annotation->description);
Expand Down
4 changes: 2 additions & 2 deletions tests/Analysers/ReflectionAnalyserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function testClassInheritance(): void
$analyser->fromFqdn(ExtendsClass::class, new Analysis([], $this->getContext()));

$expected = [
'OpenApi\Tests\Fixtures\PHP\Inheritance\ExtendsClass',
'extendsClassFunc',
'extendsClassProp',
'OpenApi\Tests\Fixtures\PHP\Inheritance\ExtendsClass',
];
$this->assertEquals($expected, array_keys($annotationFactory->reflectors));
}
Expand All @@ -66,9 +66,9 @@ public function testTraitInheritance(): void
$analyser->fromFqdn(ExtendsTrait::class, new Analysis([], $this->getContext()));

$expected = [
'OpenApi\Tests\Fixtures\PHP\Inheritance\ExtendsTrait',
'extendsTraitFunc',
'extendsTraitProp',
'OpenApi\Tests\Fixtures\PHP\Inheritance\ExtendsTrait',
];
$this->assertEquals($expected, array_keys($annotationFactory->reflectors));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Processors/ExpandClassesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testExpandClasses(): void
/** @var Schema[] $schemas */
$schemas = $analysis->getAnnotationsOfType(Schema::class);
$this->assertCount(4, $schemas);
$childSchema = $schemas[1];
$childSchema = $schemas[0];
$this->assertSame('Child', $childSchema->schema);
$this->assertCount(1, $childSchema->properties);

Expand Down Expand Up @@ -87,7 +87,7 @@ public function testExpandClassesWithoutDocBlocks(): void
/** @var Schema[] $schemas */
$schemas = $analysis->getAnnotationsOfType(Schema::class);
$this->assertCount(2, $schemas);
$childSchema = $schemas[1];
$childSchema = $schemas[0];
$this->assertSame('ChildWithDocBlocks', $childSchema->schema);
$this->assertCount(1, $childSchema->properties);

Expand Down

0 comments on commit d59d1e2

Please sign in to comment.