Permalink
Browse files

configuration: resolve apigen.yml config case-insensitively

  • Loading branch information...
vlastavesely committed Nov 20, 2017
1 parent c16bde5 commit 8141881dc8032fcfbf0a63f8f3e4dce69e566e7e
@@ -34,8 +34,14 @@ public function resolveValue(string $name, $value)
*/
public function resolveValuesWithDefaults(array $values): array
{
$values = array_change_key_case($values, CASE_LOWER);
foreach ($this->getOptionNames() as $name) {
$values[$name] = $this->resolveValue($name, $values[$name] ?? null);
$lowered = strtolower($name);
$values[$name] = $this->resolveValue($name, $values[$lowered] ?? null);
if ($name !== $lowered) {
unset($values[$lowered]);
}
}
return $values;
@@ -13,7 +13,7 @@
interface ClassReflectionInterface extends StartAndEndLineInterface, AnnotationsInterface, AbstractReflectionInterface, InNamespaceInterface, FileNameAwareReflectionInterface
{
public function getParentClass(): ?ClassReflectionInterface;
public function getParentClass(): ?self;
public function getParentClassName(): ?string;
@@ -6,5 +6,5 @@
interface TraitMethodReflectionInterface extends AbstractMethodReflectionInterface, AbstractTraitElementInterface
{
public function getOverriddenMethod(): ?TraitMethodReflectionInterface;
public function getOverriddenMethod(): ?self;
}
@@ -49,16 +49,6 @@ public function resolveOptions(array $options): array
$resolvedOptions = $this->configurationResolver->resolveValuesWithDefaults($options);
// hack to remove duplicated lowercased value
unset($resolvedOptions[strtolower(VisibilityLevelOption::NAME)]);
$baseUrlKeyLowered = strtolower(BaseUrlOption::NAME);
if (isset($resolvedOptions[$baseUrlKeyLowered])) {
$resolvedOptions[BaseUrlOption::NAME] = $resolvedOptions[$baseUrlKeyLowered];
}
unset($resolvedOptions[$baseUrlKeyLowered]);
return $this->options = $resolvedOptions;
}

0 comments on commit 8141881

Please sign in to comment.