Skip to content

Commit

Permalink
Fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Oct 13, 2024
1 parent 90154fe commit 67f4308
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"test:e2e": "pest --config tests/e2e/phpunit-e2e.xml",
"check": "php-cs-fixer check",
"fix": "php-cs-fixer fix",
"phpstan": "phpstan analyse -c phpstan.neon",
"phpstan": "phpstan analyse -c phpstan.neon --memory-limit 1G",
"phpstan:baseline": "@phpstan --generate-baseline tests/phpstan-baseline.neon"
},
"bin": [
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ parameters:
- "#^Constant DEPLOYER_BIN not found\\.$#"
- "#CpanelPhp#"
- "#AMQPMessage#"

excludePaths:
- src/Command/BlackjackCommand.php
- src/Component/PharUpdate/*
1 change: 1 addition & 0 deletions src/Command/BlackjackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use function Deployer\Support\array_flatten;

// @phpstan-ignore
class BlackjackCommand extends Command
{
use CommandCommon;
Expand Down
3 changes: 2 additions & 1 deletion src/Command/SshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace Deployer\Command;

use Deployer\Component\Ssh\Client;
use Deployer\Deployer;
use Deployer\Host\Localhost;
use Deployer\Task\Context;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -73,6 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (count($hostsAliases) === 1) {
$host = $this->deployer->hosts->get($hostsAliases[0]);
} else {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ChoiceQuestion(
'<question>Select host:</question>',
Expand Down
4 changes: 2 additions & 2 deletions src/Executor/Master.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

function spinner(string $message = ''): string
{
$frame = FRAMES[(int) ((new \DateTime())->format('u') / 1e5) % count(FRAMES)];
$frame = FRAMES[(int)((int)(new \DateTime())->format('u') / 1e5) % count(FRAMES)];
return " $frame $message\r";
}

Expand Down Expand Up @@ -76,7 +76,7 @@ public function __construct(
*/
public function run(array $tasks, array $hosts, ?Planner $plan = null): int
{
$globalLimit = (int) $this->input->getOption('limit') ?: count($hosts);
$globalLimit = (int)$this->input->getOption('limit') ?: count($hosts);

foreach ($tasks as $task) {
if (!$plan) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/Rsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function call(Host $host, $source, string $destination, array $config = [
];
$config = array_merge($defaults, $config);

$options = $config['options'] ?? [];
$options = $config['options'];
$flags = $config['flags'];
$displayStats = $config['display_stats'] || in_array('--stats', $options, true);

Expand Down

0 comments on commit 67f4308

Please sign in to comment.