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
6 changes: 6 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
*/

use Rector\Config\RectorConfig;
use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\ReplaceTestAnnotationWithPrefixedFunctionRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames();
Expand All @@ -32,4 +34,8 @@
PHPUnitSetList::PHPUNIT_90,
LevelSetList::UP_TO_PHP_74,
]);
$rectorConfig->rules([
ExplicitNullableParamTypeRector::class,
]);
$rectorConfig->phpVersion(PhpVersion::PHP_84);
};
2 changes: 1 addition & 1 deletion src/Cli/Symfony/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(FactoryInterface $factory, OutputInterface $output,
$this->output = $output;
}

public function run(InputInterface $input = null, OutputInterface $output = null): int
public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
{
return parent::run($input, $this->output);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Clock/ClockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ClockInterface
{
public function currentTime(): int;

public function stringToTime(string $string, int $time = null): int;
public function stringToTime(string $string, ?int $time = null): int;

public function createTimestampFromFormat(string $format, string $time): int;
}
2 changes: 1 addition & 1 deletion src/Domain/Clock/SystemClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function currentTime(): int
return time();
}

public function stringToTime(string $string, int $time = null): int
public function stringToTime(string $string, ?int $time = null): int
{
$time ??= $this->currentTime();
$timestamp = strtotime($string, $time);
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Model/Deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Deployment implements LoggerAwareInterface
private string $deploymentLockIdentifier;
private ContainerInterface $container;

public function __construct(ContainerInterface $container, string $name, string $deploymentLockIdentifier = null)
public function __construct(ContainerInterface $container, string $name, ?string $deploymentLockIdentifier = null)
{
$this->container = $container;
$this->name = $name;
Expand Down
14 changes: 7 additions & 7 deletions src/Domain/Model/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract public function getName(): string;
/**
* Remove the given task from all stages and applications
*/
public function removeTask(string $removeTask, Application $application = null): self
public function removeTask(string $removeTask, ?Application $application = null): self
{
$removeApplicationName = $application instanceof Application ? $application->getName() : null;

Expand Down Expand Up @@ -111,7 +111,7 @@ public function forStage(string $stage, $tasks): self
* @param string $stage The name of the stage when this task shall be executed
* @param string $step A stage has three steps "before", "tasks" and "after"
*/
protected function addTaskToStage($tasks, string $stage, Application $application = null, string $step = 'tasks'): void
protected function addTaskToStage($tasks, string $stage, ?Application $application = null, string $step = 'tasks'): void
{
if (!is_array($tasks)) {
$tasks = [$tasks];
Expand All @@ -137,7 +137,7 @@ protected function addTaskToStage($tasks, string $stage, Application $applicatio
*
* @return Workflow
*/
public function addTask($tasks, string $stage, Application $application = null)
public function addTask($tasks, string $stage, ?Application $application = null)
{
$this->addTaskToStage($tasks, $stage, $application);

Expand All @@ -151,7 +151,7 @@ public function addTask($tasks, string $stage, Application $application = null)
*
* @param array<int, class-string|string>|string $tasks
*/
public function afterTask(string $task, $tasks, Application $application = null): self
public function afterTask(string $task, $tasks, ?Application $application = null): self
{
if (!is_array($tasks)) {
$tasks = [$tasks];
Expand All @@ -174,7 +174,7 @@ public function afterTask(string $task, $tasks, Application $application = null)
*
* @param array<int, class-string|string>|string $tasks
*/
public function beforeTask(string $task, $tasks, Application $application = null): self
public function beforeTask(string $task, $tasks, ?Application $application = null): self
{
if (!is_array($tasks)) {
$tasks = [$tasks];
Expand Down Expand Up @@ -209,7 +209,7 @@ public function defineTask(string $taskName, string $baseTask, array $options):
*
* @param class-string[]|string $tasks
*/
public function beforeStage(string $stage, $tasks, Application $application = null): self
public function beforeStage(string $stage, $tasks, ?Application $application = null): self
{
$this->addTaskToStage($tasks, $stage, $application, 'before');

Expand All @@ -221,7 +221,7 @@ public function beforeStage(string $stage, $tasks, Application $application = nu
*
* @param class-string[]|string $tasks
*/
public function afterStage(string $stage, $tasks, Application $application = null): self
public function afterStage(string $stage, $tasks, ?Application $application = null): self
{
$this->addTaskToStage($tasks, $stage, $application, 'after');

Expand Down
10 changes: 5 additions & 5 deletions src/Integration/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(ContainerInterface $container, FilesystemInterface $
$this->logger = $logger;
}

public function getDeployment(string $deploymentName, string $configurationPath = null, bool $simulateDeployment = true, bool $initialize = true, bool $forceDeployment = false): Deployment
public function getDeployment(string $deploymentName, ?string $configurationPath = null, bool $simulateDeployment = true, bool $initialize = true, bool $forceDeployment = false): Deployment
{
$deployment = $this->createDeployment($deploymentName, $configurationPath);

Expand All @@ -65,7 +65,7 @@ public function getDeployment(string $deploymentName, string $configurationPath
/**
* @inheritDoc
*/
public function getDeploymentNames(string $path = null): array
public function getDeploymentNames(?string $path = null): array
{
$path = $this->getDeploymentsBasePath($path);
$files = $this->filesystem->glob(Files::concatenatePaths([$path, '*.php']));
Expand All @@ -76,7 +76,7 @@ public function getDeploymentNames(string $path = null): array
/**
* @inheritDoc
*/
public function getDeploymentsBasePath(string $path = null): string
public function getDeploymentsBasePath(?string $path = null): string
{
$localDeploymentDescription = $this->filesystem->getRealPath('./.surf');
if (! $path && $this->filesystem->isDirectory($localDeploymentDescription)) {
Expand All @@ -91,7 +91,7 @@ public function getDeploymentsBasePath(string $path = null): string
/**
* @inheritDoc
*/
public function getWorkspacesBasePath(string $path = null): string
public function getWorkspacesBasePath(?string $path = null): string
{
$workspacesBasePath = getenv('SURF_WORKSPACE');

Expand Down Expand Up @@ -124,7 +124,7 @@ public function getWorkspacesBasePath(string $path = null): string
* The script has access to a deployment object as "$deployment". This could change
* in the future.
*/
protected function createDeployment(string $deploymentName, string $path = null): Deployment
protected function createDeployment(string $deploymentName, ?string $path = null): Deployment
{
$deploymentConfigurationPath = $this->getDeploymentsBasePath($path);
$workspacesBasePath = $this->getWorkspacesBasePath();
Expand Down
8 changes: 4 additions & 4 deletions src/Integration/FactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

interface FactoryInterface
{
public function getDeployment(string $deploymentName, string $configurationPath = null, bool $simulateDeployment = true, bool $initialize = true, bool $forceDeployment = false): Deployment;
public function getDeployment(string $deploymentName, ?string $configurationPath = null, bool $simulateDeployment = true, bool $initialize = true, bool $forceDeployment = false): Deployment;

/**
* Get available deployment names
Expand All @@ -24,17 +24,17 @@ public function getDeployment(string $deploymentName, string $configurationPath
*
* @return string[]
*/
public function getDeploymentNames(string $path = null): array;
public function getDeploymentNames(?string $path = null): array;

/**
* Get the root path of the surf deployment declarations
*
* This defaults to ./.surf if a NULL path is given.
*/
public function getDeploymentsBasePath(string $path = null): string;
public function getDeploymentsBasePath(?string $path = null): string;

/**
* Get the base path to local workspaces
*/
public function getWorkspacesBasePath(string $path = null): string;
public function getWorkspacesBasePath(?string $path = null): string;
}
8 changes: 4 additions & 4 deletions tests/Unit/Domain/Service/ShellCommandServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class ShellCommandServiceTest extends TestCase
*/
public function executeRemoteCommandRespectsOptionsInSshCommand(
string $expectedCommandArguments,
string $username = null,
string $password = null,
int $port = null,
string $privateKey = null
?string $username = null,
?string $password = null,
?int $port = null,
?string $privateKey = null
): void {
/** @var MockObject|ShellCommandService $service */
$service = $this->createPartialMock(ShellCommandService::class, ['executeProcess']);
Expand Down