Skip to content

Commit

Permalink
Remove use of deprecated processor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Jun 5, 2024
1 parent 665a911 commit 5e7738d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ public function testRemoveProcessor(): void

protected function assertOperationIdHash(Generator $generator, bool $expected): void
{
foreach ($generator->getProcessors() as $processor) {
$generator->getProcessor()->walk(function ($processor) use ($expected) {
if ($processor instanceof OperationId) {
$this->assertEquals($expected, $processor->isHash());
}
}
});
}

public static function configCases(): iterable
Expand Down
14 changes: 9 additions & 5 deletions tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,17 @@ public static function fixtures(array $files): array
}, $files);
}

public static function processors(array $strip = [], array $add = []): array
public static function processors(array $strip = []): array
{
$processors = (new Generator())->getProcessors();
$processors = [];

$processors = array_filter($processors, function ($processor) use ($strip) {
return !is_object($processor) || !in_array(get_class($processor), $strip);
});
(new Generator())
->getProcessor()
->walk(function ($processor) use (&$processors, $strip) {
if (!is_object($processor) || !in_array(get_class($processor), $strip)) {
$processors[] = $processor;
}
});

return $processors;
}
Expand Down
26 changes: 14 additions & 12 deletions tools/src/Docs/ProcGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ public function getProcessorsDetails(): array
$processors = [];

$defaultProcessors = [];
foreach ((new Generator())->getProcessors() as $processor) {
$rc = new \ReflectionClass($processor);
$class = $rc->getName();
(new Generator())
->getProcessor()
->walk(function ($processor) use (&$processors, &$defaultProcessors) {
$rc = new \ReflectionClass($processor);
$class = $rc->getName();

$defaultProcessors[] = $class;
$processors[] = [
'class' => $class,
'name' => $rc->getShortName(),
'default' => true,
'options' => $this->getOptionsDetails($rc),
'phpdoc' => $this->extractDocumentation($rc->getDocComment()),
];
}
$defaultProcessors[] = $class;
$processors[] = [
'class' => $class,
'name' => $rc->getShortName(),
'default' => true,
'options' => $this->getOptionsDetails($rc),
'phpdoc' => $this->extractDocumentation($rc->getDocComment()),
];
});

$proccesorsDir = dirname((new \ReflectionClass(MergeIntoOpenApi::class))->getFileName());
foreach (glob("$proccesorsDir/*.php") as $processor) {
Expand Down

0 comments on commit 5e7738d

Please sign in to comment.