Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed Apr 19, 2022
1 parent db12403 commit 5e5c50b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/refgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function formatAnnotationsDetails(string $name, string $fqdn, string $fil
$classDocumentation = $this->extractDocumentation($rc->getDocComment());
echo $classDocumentation['content'] . PHP_EOL;

// todo: anchestor properties
// todo: ancestor properties
$properties = array_filter($details[$fqdn]['properties'], function ($property) use ($fqdn) {
return !in_array($property, $fqdn::$_blacklist) && $property[0] != '_';
});
Expand Down
26 changes: 13 additions & 13 deletions src/Processors/ExpandClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
use OpenApi\Generator;

/**
* Iterate over the chain of anchestors of a schema and:
* - merge anchestor annotations/methods/properties into the schema if the anchestor doesn't have a schema itself
* - inherit from the anchestor if it has a schema (allOf) and stop.
* Iterate over the chain of ancestors of a schema and:
* - merge ancestor annotations/methods/properties into the schema if the ancestor doesn't have a schema itself
* - inherit from the ancestor if it has a schema (allOf) and stop.
*/
class ExpandClasses
{
Expand All @@ -27,20 +27,20 @@ public function __invoke(Analysis $analysis)

foreach ($schemas as $schema) {
if ($schema->_context->is('class')) {
$anchestors = $analysis->getSuperClasses($schema->_context->fullyQualifiedName($schema->_context->class));
$ancestors = $analysis->getSuperClasses($schema->_context->fullyQualifiedName($schema->_context->class));
$existing = [];
foreach ($anchestors as $anchestor) {
$anchestorSchema = $analysis->getSchemaForSource($anchestor['context']->fullyQualifiedName($anchestor['class']));
if ($anchestorSchema) {
$refPath = !Generator::isDefault($anchestorSchema->schema) ? $anchestorSchema->schema : $anchestor['class'];
$this->inheritFrom($schema, $anchestorSchema, $refPath, $anchestor['context']);
foreach ($ancestors as $ancestor) {
$ancestorSchema = $analysis->getSchemaForSource($ancestor['context']->fullyQualifiedName($ancestor['class']));
if ($ancestorSchema) {
$refPath = !Generator::isDefault($ancestorSchema->schema) ? $ancestorSchema->schema : $ancestor['class'];
$this->inheritFrom($schema, $ancestorSchema, $refPath, $ancestor['context']);

// one anchestor is enough
// one ancestor is enough
break;
} else {
$this->mergeAnnotations($schema, $anchestor, $existing);
$this->mergeMethods($schema, $anchestor, $existing);
$this->mergeProperties($schema, $anchestor, $existing);
$this->mergeAnnotations($schema, $ancestor, $existing);
$this->mergeMethods($schema, $ancestor, $existing);
$this->mergeProperties($schema, $ancestor, $existing);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/ExpandInterfaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __invoke(Analysis $analysis)
$interfaces = $analysis->getInterfacesOfClass($className, true);

if (class_exists($className) && ($parent = get_parent_class($className)) && ($inherited = array_keys(class_implements($parent)))) {
// strip interfaces we inherit from anchestor
// strip interfaces we inherit from ancestor
foreach (array_keys($interfaces) as $interface) {
if (in_array(ltrim($interface, '\\'), $inherited)) {
unset($interfaces[$interface]);
Expand Down

0 comments on commit 5e5c50b

Please sign in to comment.