Skip to content

Commit

Permalink
Merge pull request #56 from jacquesbh/fix-method
Browse files Browse the repository at this point in the history
fix: getParameter method should return mixed
  • Loading branch information
jacquesbh authored Jan 3, 2023
2 parents 8668b3b + f801dd4 commit e109255
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Settings/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getName(bool $aliased = false): string
/**
* @inheritdoc
*/
public function getParameter(string $name): ?string
public function getParameter(string $name)
{
if (!$this->hasParameter($name)) {
throw new InvalidArgumentException(sprintf('Parameter "%s" is not configured for resource "%s".', $name, $this->getAlias()));
Expand Down
5 changes: 4 additions & 1 deletion src/Settings/MetadataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public function getApplicationName(bool $aliased = false): string;
*/
public function getName(bool $aliased = false): string;

public function getParameter(string $name): ?string;
/**
* @return mixed
*/
public function getParameter(string $name);

public function hasParameter(string $name): bool;

Expand Down
15 changes: 10 additions & 5 deletions src/Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,32 @@ public function getAliasAsArray(): array

public function getVendorName(): ?string
{
return $this->metadata->getParameter('vendor_name');
/** @phpstan-ignore-next-line */
return (string) $this->metadata->getParameter('vendor_name');
}

public function getVendorUrl(): ?string
{
return $this->metadata->getParameter('vendor_url');
/** @phpstan-ignore-next-line */
return (string) $this->metadata->getParameter('vendor_url');
}

public function getPluginName(): ?string
{
return $this->metadata->getParameter('plugin_name');
/** @phpstan-ignore-next-line */
return (string) $this->metadata->getParameter('plugin_name');
}

public function getDescription(): ?string
{
return $this->metadata->getParameter('description');
/** @phpstan-ignore-next-line */
return (string) $this->metadata->getParameter('description');
}

public function getIcon(): ?string
{
return $this->metadata->getParameter('icon');
/** @phpstan-ignore-next-line */
return (string) $this->metadata->getParameter('icon');
}

/**
Expand Down

0 comments on commit e109255

Please sign in to comment.