Skip to content

Commit

Permalink
return types
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewandante committed Oct 18, 2023
1 parent 832ad4b commit 7c4534b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/Dev/DevBuildController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DevBuildController extends Controller implements PermissionProvider
'build'
];

protected function init()
protected function init(): void
{
parent::init();

Expand Down Expand Up @@ -52,7 +52,7 @@ public function build(HTTPRequest $request): HTTPResponse
}
}

public function canInit()
public function canInit(): bool
{
return (
Director::isDev()
Expand All @@ -65,7 +65,7 @@ public function canInit()
);
}

public function providePermissions()
public function providePermissions(): array
{
return [
'CAN_DEV_BUILD' => [
Expand Down
6 changes: 3 additions & 3 deletions src/Dev/DevConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DevConfigController extends Controller implements PermissionProvider
'audit',
];

protected function init()
protected function init(): void
{
parent::init();

Expand Down Expand Up @@ -141,7 +141,7 @@ public function audit()
return $this->getResponse()->setBody($body);
}

public function canInit()
public function canInit(): bool
{
return (
Director::isDev()
Expand All @@ -154,7 +154,7 @@ public function canInit()
);
}

public function providePermissions()
public function providePermissions(): array
{
return [
'CAN_DEV_CONFIG' => [
Expand Down
6 changes: 3 additions & 3 deletions src/Dev/DevelopmentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected static function get_links()
return $links;
}

protected function getLinks()
protected function getLinks(): array
{
$canViewAll = $this->canViewAll();
$links = [];
Expand Down Expand Up @@ -266,7 +266,7 @@ public function errors()
$this->redirect("Debug_");
}

public function providePermissions()
public function providePermissions(): array
{
return [
'ALL_DEV_ADMIN' => [
Expand All @@ -283,7 +283,7 @@ public static function permissionsCategory(): string
return _t(__CLASS__ . 'PERMISSIONS_CATEGORY', 'Dev permissions');
}

protected function canViewAll()
protected function canViewAll(): bool
{
// Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957)
$requestedDevBuild = (stripos($this->getRequest()->getURL() ?? '', 'dev/build') === 0)
Expand Down
14 changes: 5 additions & 9 deletions src/Dev/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function getTasks()
return $availableTasks;
}

protected function getTaskList($onlyVisible = true)
protected function getTaskList(bool $onlyVisible = true): array
{
$taskClasses = ClassInfo::subclassesFor(BuildTask::class, false);
if ($onlyVisible) {
Expand Down Expand Up @@ -182,11 +182,7 @@ protected function taskEnabled($class)
return true;
}

/**
* @param string $class
* @return boolean
*/
protected function canViewTask($class)
protected function canViewTask(string $class): bool
{
if ($this->canViewAllTasks()) {
return true;
Expand All @@ -205,7 +201,7 @@ protected function canViewTask($class)
return false;
}

protected function canViewAllTasks()
protected function canViewAllTasks(): bool
{
return (
Director::isDev()
Expand Down Expand Up @@ -243,7 +239,7 @@ protected function addCssToHeader($header)
return $header;
}

public function canInit()
public function canInit(): bool
{
if ($this->canViewAllTasks()) {
return true;
Expand All @@ -256,7 +252,7 @@ public function canInit()
return false;
}

public function providePermissions()
public function providePermissions(): array
{
return [
'BUILDTASK_CAN_RUN' => [
Expand Down

0 comments on commit 7c4534b

Please sign in to comment.