Skip to content

Commit

Permalink
Added PHP type declarations in page getter/setter
Browse files Browse the repository at this point in the history
  • Loading branch information
hbugdoll committed Apr 6, 2024
1 parent 574f64f commit 4a5ab13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/base/BlockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace luya\cms\base;

use luya\cms\models\NavItemPage;

/**
* Interface for all Blocks.
*
Expand Down Expand Up @@ -102,14 +104,14 @@ public function getFieldHelp();
*
* @param NavItemPage $page The page object.
*/
public function setPage($page);
public function setPage(NavItemPage $page);

/**
* Returns the block's {{luya\cms\models\NavItemPage}} object.
*
* @return NavItemPage
*/
public function getPage();
public function getPage(): NavItemPage;

/**
* Set an environment option informations to the block with key value pairing.
Expand Down
5 changes: 3 additions & 2 deletions src/base/InternalBaseBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use luya\admin\base\TypesInterface;
use luya\cms\frontend\blockgroups\MainGroup;
use luya\cms\models\NavItemPage;
use luya\helpers\ArrayHelper;
use luya\helpers\FileHelper;
use luya\helpers\Html;
Expand Down Expand Up @@ -295,15 +296,15 @@ public function isFrontendContext()
/**
* @inheritdoc
*/
public function setPage($page)
public function setPage(NavItemPage $page)
{
$this->_page = $page;
}

/**
* @inheritdoc
*/
public function getPage()
public function getPage(): NavItemPage
{
return $this->_page;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/data/blocks/ConcreteImplementationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use luya\cms\base\BlockInterface;
use luya\cms\frontend\blockgroups\DevelopmentGroup;
use luya\cms\models\NavItemPage;

class ConcreteImplementationBlock implements BlockInterface
{
Expand Down Expand Up @@ -101,7 +102,7 @@ public function getFieldHelp()
*
* @param NavItemPage $page The page object.
*/
public function setPage($page)
public function setPage(NavItemPage $page)
{
$this->_page = $page;
}
Expand All @@ -111,7 +112,7 @@ public function setPage($page)
*
* @return NavItemPage
*/
public function getPage()
public function getPage(): NavItemPage
{
return $this->_page;
}
Expand Down

0 comments on commit 4a5ab13

Please sign in to comment.