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 Nov 13, 2023
1 parent 4065203 commit b9623c8
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 @@ -158,11 +158,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): static
{
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): static
{
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 @@ -30,7 +30,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): static;
}
3 changes: 1 addition & 2 deletions src/ComponentModel/IContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,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): static;

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

0 comments on commit b9623c8

Please sign in to comment.