Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 27, 2021
1 parent c1b3718 commit 2032372
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions src/Block/BlockLoaderChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ public function exists(string $type): bool
return false;
}

public function load($block): BlockInterface
public function load($configuration): BlockInterface
{
if (!\is_string($block) && !\is_array($block)) {
if (!\is_string($configuration) && !\is_array($configuration)) {
throw new \TypeError(sprintf(
'Argument 1 passed to %s must be of type string or array, %s given',
__METHOD__,
\is_object($block) ? 'object of type '.\get_class($block) : \gettype($block)
\is_object($configuration) ? 'object of type '.\get_class($configuration) : \gettype($configuration)
));
}

foreach ($this->loaders as $loader) {
if ($loader->support($block)) {
return $loader->load($block);
if ($loader->support($configuration)) {
return $loader->load($configuration);
}
}

throw new BlockNotFoundException();
}

public function support($name): bool
public function support($configuration): bool
{
if (!\is_string($name) && !\is_array($name)) {
if (!\is_string($configuration) && !\is_array($configuration)) {
throw new \TypeError(sprintf(
'Argument 1 passed to %s must be of type string or array, %s given',
__METHOD__,
\is_object($name) ? 'object of type '.\get_class($name) : \gettype($name)
\is_object($configuration) ? 'object of type '.\get_class($configuration) : \gettype($configuration)
));
}

Expand Down
8 changes: 4 additions & 4 deletions src/Block/BlockLoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
interface BlockLoaderInterface
{
/**
* @param string|array $name
* @param string|array $configuration
*
* @throws BlockNotFoundException if no block with that name is found
*/
public function load($name): BlockInterface;
public function load($configuration): BlockInterface;

/**
* @param string|array $name
* @param string|array $configuration
*/
public function support($name): bool;
public function support($configuration): bool;

public function exists(string $type): bool;
}
8 changes: 4 additions & 4 deletions src/Block/BlockServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public function get(BlockInterface $block): BlockServiceInterface
return $this->services[$block->getType()];
}

public function getService($id): BlockServiceInterface
public function getService($name): BlockServiceInterface
{
return $this->load($id);
return $this->load($name);
}

public function has(string $id): bool
public function has(string $name): bool
{
return isset($this->services[$id]);
return isset($this->services[$name]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Menu/MenuRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ final class MenuRegistry implements MenuRegistryInterface
*/
private $names = [];

public function add(string $menu): void
public function add(string $name): void
{
$this->names[$menu] = $menu;
$this->names[$name] = $name;
}

public function getAliasNames(): array
Expand Down
6 changes: 3 additions & 3 deletions src/Model/BaseBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ public function getUpdatedAt(): ?\DateTime
return $this->updatedAt;
}

public function addChildren(BlockInterface $child): void
public function addChildren(BlockInterface $children): void
{
$this->children[] = $child;
$this->children[] = $children;

$child->setParent($this);
$children->setParent($this);
}

public function getChildren(): array
Expand Down

0 comments on commit 2032372

Please sign in to comment.