Skip to content

Commit

Permalink
added PHP 8 typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 1, 2021
1 parent 799c9b1 commit 23bb9b7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/ComponentModel/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ final public function getParent(): ?IContainer
/**
* Sets or removes the parent of this component. This method is managed by containers and should
* not be called by applications
* @return static
* @throws Nette\InvalidStateException
* @internal
*/
public function setParent(?IContainer $parent, string $name = null)
public function setParent(?IContainer $parent, string $name = null): self
{
if ($parent === null && $this->parent === null && $name !== null) {
$this->name = $name; // just rename
Expand Down
3 changes: 1 addition & 2 deletions src/ComponentModel/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ class Container extends Component implements IContainer

/**
* Adds the component to the container.
* @return static
* @throws Nette\InvalidStateException
*/
public function addComponent(IComponent $component, ?string $name, string $insertBefore = null)
public function addComponent(IComponent $component, ?string $name, string $insertBefore = null): self
{
if ($name === null) {
$name = $component->getName();
Expand Down
3 changes: 1 addition & 2 deletions src/ComponentModel/IComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function getParent(): ?IContainer;

/**
* Sets the parent of this component.
* @return static
*/
function setParent(?IContainer $parent, string $name = null);
function setParent(?IContainer $parent, string $name = null): self;
}
3 changes: 1 addition & 2 deletions src/ComponentModel/IContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ interface IContainer extends IComponent
{
/**
* Adds the component to the container.
* @return static
*/
function addComponent(IComponent $component, ?string $name);
function addComponent(IComponent $component, ?string $name): self;

/**
* Removes the component from the container.
Expand Down

0 comments on commit 23bb9b7

Please sign in to comment.