Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/cpanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function getCpanel()
return $cpanel;
}

function getDomainInfo()
function getDomainInfo(): array
{
$domain = vsprintf(get('cpanel')['create_domain_format'], get('cpanel')['create_domain_values']);
$cleanDomain = str_replace(['.', ',', ' ', '/', '-'], '', $domain);
Expand Down
10 changes: 5 additions & 5 deletions contrib/ispmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
}
});

function ispmanagerRequest($method, $requestData)
function ispmanagerRequest(string $method, array $requestData): mixed
{
$config = get('ispmanager');
$dsnData = parse_url($config['api']['dsn']);
Expand Down Expand Up @@ -722,7 +722,7 @@ function ispmanagerRequest($method, $requestData)
}
}

function ispmanagerAuthRequest($url, $login, $pass)
function ispmanagerAuthRequest(string $url, string $login, string $pass): void
{
$authRequestData = [
'func' => 'auth',
Expand All @@ -743,7 +743,7 @@ function ispmanagerAuthRequest($url, $login, $pass)
}
}

function prepareRequest($requestData)
function prepareRequest(array $requestData): array
{
$config = get('ispmanager');
$dsnData = parse_url($config['api']['dsn']);
Expand All @@ -763,9 +763,9 @@ function prepareRequest($requestData)
return $requestData;
}

function generatePassword($lenght)
function generatePassword(int $length): string
{
return substr(md5(uniqid()), 0, $lenght);
return substr(md5(uniqid()), 0, $length);
}

// Callbacks before actions under domains
Expand Down
4 changes: 2 additions & 2 deletions contrib/sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static function (&$value) use ($config) {
},
);

function getPreviousReleaseRevision()
function getPreviousReleaseRevision(): ?string
{
switch (get('update_code_strategy')) {
case 'local_archive':
Expand All @@ -206,7 +206,7 @@ function getPreviousReleaseRevision()
}
}

function getCurrentReleaseRevision()
function getCurrentReleaseRevision(): string
{
switch (get('update_code_strategy')) {
case 'local_archive':
Expand Down
2 changes: 1 addition & 1 deletion contrib/slack.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
set('slack_failure_color', '#ff0909');
set('slack_rollback_color', '#eba211');

function checkSlackAnswer($result)
function checkSlackAnswer(mixed $result): bool
{
if ('invalid_token' === $result) {
warning('Invalid Slack token');
Expand Down
8 changes: 4 additions & 4 deletions contrib/supervisord-monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

use Deployer\Utility\Httpie;

function supervisordCheckConfig()
function supervisordCheckConfig(): void
{
$config = get('supervisord', []);
foreach ($config as $key => $value) {
Expand All @@ -108,12 +108,12 @@ function supervisordCheckConfig()
}
}

function supervisordGetBasicAuthToken()
function supervisordGetBasicAuthToken(): string
{
return 'Basic ' . base64_encode(get('supervisord_basic_auth_user') . ':' . get('supervisord_basic_auth_password'));
}

function supervisordIsAuthenticated()
function supervisordIsAuthenticated(): bool
{
supervisordCheckConfig();

Expand All @@ -123,7 +123,7 @@ function supervisordIsAuthenticated()
return $authResponseInfo['http_code'] === 200;
}

function supervisordControlAction($name, $action = 'stop')
function supervisordControlAction(string $name, string $action = 'stop'): bool
{
$stopResponseInfo = [];
Httpie::post(get('supervisord_uri') . '/control/' . $action . '/localhost/' . $name)->header('Authorization', supervisordGetBasicAuthToken())->send($stopResponseInfo);
Expand Down
17 changes: 14 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@ includes:
- tests/phpstan-baseline.neon

parameters:
level: 5
level: 6
paths:
- bin
- src
- recipe
- contrib

bootstrapFiles:
- tests/constants.php

dynamicConstantNames:
DEPLOYER_VERSION: string
DEPLOYER_BIN: string
MASTER_ENDPOINT: string
MASTER_TOKEN: string

ignoreErrors:
- "#^Constant DEPLOYER_VERSION not found\\.$#"
- "#^Constant DEPLOYER_BIN not found\\.$#"
- "#^Constant MASTER_ENDPOINT not found\\.$#"
- "#^Constant MASTER_TOKEN not found\\.$#"
- "#CpanelPhp#"
- "#AMQPMessage#"
- identifier: missingType.iterableValue
-
identifier: missingType.generics
path: src/Component/Pimple/Container.php
2 changes: 1 addition & 1 deletion recipe/codeigniter4.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function spark($command, $options = [])
};
}

function codeigniter4_version_compare($version, $comparator)
function codeigniter4_version_compare(string $version, string $comparator): bool
{
return version_compare(get('codeigniter4_version'), $version, $comparator);
}
Expand Down
2 changes: 1 addition & 1 deletion recipe/laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function artisan($command, $options = [])
};
}

function laravel_version_compare($version, $comparator)
function laravel_version_compare(string $version, string $comparator): bool
{
return version_compare(get('laravel_version'), $version, $comparator);
}
Expand Down
2 changes: 1 addition & 1 deletion recipe/magento2.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
*
* @throws ConfigurationException
*/
function magentoDeployAssetsSplit(string $area)
function magentoDeployAssetsSplit(string $area): void
{
if (!in_array($area, ['frontend', 'backend'], true)) {
throw new ConfigurationException("\$area must be either 'frontend' or 'backend', '$area' given");
Expand Down
5 changes: 4 additions & 1 deletion src/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Countable;
use IteratorAggregate;

/**
* @implements IteratorAggregate<string, mixed>
*/
class Collection implements Countable, IteratorAggregate
{
protected array $values = [];
Expand All @@ -35,7 +38,7 @@ public function has(string $name): bool
return array_key_exists($name, $this->values);
}

public function set(string $name, mixed $object)
public function set(string $name, mixed $object): void
{
$this->values[$name] = $object;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Command/BlackjackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ public static function handValue(array $hand): int
return $sum;
}

private function print(string $text = "")
private function print(string $text = ""): void
{
$this->output->writeln(" $text");
}

private function printHand(array $hand, int $offset = 1)
private function printHand(array $hand, int $offset = 1): void
{
$cards = [];
for ($i = 0; $i < count($hand) - $offset; $i++) {
Expand Down Expand Up @@ -345,7 +345,7 @@ private function printHand(array $hand, int $offset = 1)
}
}

private function printWhiskey(int $whiskeyLevel)
private function printWhiskey(int $whiskeyLevel): void
{
if ($whiskeyLevel == 4) {
echo <<<ASCII
Expand Down
2 changes: 1 addition & 1 deletion src/Command/CustomOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait CustomOption
* @param Host[] $hosts
* @param string[] $options
*/
protected function applyOverrides(array $hosts, array $options)
protected function applyOverrides(array $hosts, array $options): void
{
$override = [];
foreach ($options as $option) {
Expand Down
4 changes: 2 additions & 2 deletions src/Command/MainCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function execute(Input $input, Output $output): int
return $exitCode;
}

private function checkUpdates()
private function checkUpdates(): void
{
try {
fwrite(STDERR, Httpie::get('https://deployer.org/check-updates/' . DEPLOYER_VERSION)->send()->body());
Expand All @@ -176,7 +176,7 @@ private function checkUpdates()
}
}

private function showBanner()
private function showBanner(): void
{
if (getenv('DO_NOT_SHOW_BANNER') === 'true') {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/Command/TreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ protected function execute(Input $input, Output $output): int
return 0;
}

private function buildTree(string $taskName)
private function buildTree(string $taskName): void
{
$this->createTreeFromTaskName($taskName, '', true);
}

private function createTreeFromTaskName(string $taskName, string $postfix = '', bool $isLast = false)
private function createTreeFromTaskName(string $taskName, string $postfix = '', bool $isLast = false): void
{
$task = $this->deployer->tasks->get($taskName);

Expand Down Expand Up @@ -130,7 +130,7 @@ private function createTreeFromTaskName(string $taskName, string $postfix = '',
}
}

private function addTaskToTree(string $taskName, bool $isLast = false)
private function addTaskToTree(string $taskName, bool $isLast = false): void
{
$this->tree[] = [
'taskName' => $taskName,
Expand All @@ -140,7 +140,7 @@ private function addTaskToTree(string $taskName, bool $isLast = false)
];
}

private function outputTree(string $taskName)
private function outputTree(string $taskName): void
{
$this->output->writeln("The task-tree for <info>$taskName</info>:");

Expand Down
2 changes: 2 additions & 0 deletions src/Component/Pimple/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Container main class.
*
* @author Fabien Potencier
*
* @implements \ArrayAccess<string, mixed>
*/
class Container implements \ArrayAccess
{
Expand Down
3 changes: 3 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use function Deployer\Support\is_closure;
use function Deployer\Support\normalize_line_endings;

/**
* @implements \ArrayAccess<string, mixed>
*/
class Configuration implements \ArrayAccess
{
private ?Configuration $parent;
Expand Down
4 changes: 2 additions & 2 deletions src/Documentation/DocGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function gen(string $destination): ?string
return null;
}

public function generateRecipesIndex(string $destination)
public function generateRecipesIndex(string $destination): void
{
$index = "# All Recipes\n\n";
$list = [];
Expand All @@ -333,7 +333,7 @@ public function generateRecipesIndex(string $destination)
file_put_contents("$destination/recipe/README.md", $index);
}

public function generateContribIndex(string $destination)
public function generateContribIndex(string $destination): void
{
$index = "# All Contrib Recipes\n\n";
$list = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Executor/Planner.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function commit(array $hosts, Task $task): void
$this->table->addRow($row);
}

public function render()
public function render(): void
{
$this->table->render();
}
Expand Down
5 changes: 3 additions & 2 deletions src/Import/MamlRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Deployer\Exception\Exception;
use Deployer\Exception\SchemaException;
use Deployer\Task\Task;
use Maml\Ast\ArrayNode;
use Maml\Ast\BooleanNode;
use Maml\Ast\ObjectNode;
Expand Down Expand Up @@ -293,7 +294,7 @@ protected function tasks(Property $property): void
}
}

private function createTask(string $name, ArrayNode $array, string $desc)
private function createTask(string $name, ArrayNode $array, string $desc): ?Task
{
$isGroupTask = true;
$groupTasks = [];
Expand All @@ -307,7 +308,7 @@ private function createTask(string $name, ArrayNode $array, string $desc)

if ($isGroupTask) {
task($name, $groupTasks)->desc($desc);
return;
return null;
}

$body = function () {
Expand Down
10 changes: 5 additions & 5 deletions src/Import/YamlRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected static function import(mixed $paths): void
Import::import($paths);
}

protected static function hosts(array $hosts)
protected static function hosts(array $hosts): void
{
foreach ($hosts as $alias => $config) {
if ($config['local'] ?? false) {
Expand All @@ -69,14 +69,14 @@ protected static function hosts(array $hosts)
}
}

protected static function config(array $config)
protected static function config(array $config): void
{
foreach ($config as $key => $value) {
set($key, $value);
}
}

protected static function tasks(array $tasks)
protected static function tasks(array $tasks): void
{
$buildTask = function ($name, $steps) {
$body = function () {};
Expand Down Expand Up @@ -181,7 +181,7 @@ protected static function tasks(array $tasks)
}
}

protected static function after(array $after)
protected static function after(array $after): void
{
foreach ($after as $key => $value) {
if (is_array($value)) {
Expand All @@ -194,7 +194,7 @@ protected static function after(array $after)
}
}

protected static function before(array $before)
protected static function before(array $before): void
{
foreach ($before as $key => $value) {
if (is_array($value)) {
Expand Down
5 changes: 1 addition & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
set_include_path(__DIR__ . '/..' . PATH_SEPARATOR . get_include_path());

putenv('DEPLOYER_LOCAL_WORKER=true');
define('DEPLOYER_BIN', __DIR__ . '/../bin/dep');
define('__FIXTURES__', __DIR__ . '/fixtures');
define('__REPOSITORY__', __DIR__ . '/fixtures/repository');
define('__TEMP_DIR__', sys_get_temp_dir() . '/deployer');
require_once __DIR__ . '/constants.php';

require_once __DIR__ . '/spec/SpecTest.php';

Expand Down
Loading