FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add explicit null types to parameters with null defaults by benr77 · Pull Request #55 · php-task/php-task · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .php  (8) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 6 additions & 6 deletions src/Task/Builder/TaskBuilder.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(TaskInterface $task, TaskSchedulerInterface $taskSch
/**
* {@inheritdoc}
*/
public function hourly(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function hourly(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory('@hourly'), $firstExecution, $lastExecution);

Expand All @@ -53,7 +53,7 @@ public function hourly(\DateTimeImmutable $firstExecution = null, \DateTimeImmut
/**
* {@inheritdoc}
*/
public function daily(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function daily(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory('@daily'), $firstExecution, $lastExecution);

Expand All @@ -63,7 +63,7 @@ public function daily(\DateTimeImmutable $firstExecution = null, \DateTimeImmuta
/**
* {@inheritdoc}
*/
public function weekly(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function weekly(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory('@weekly'), $firstExecution, $lastExecution);

Expand All @@ -73,7 +73,7 @@ public function weekly(\DateTimeImmutable $firstExecution = null, \DateTimeImmut
/**
* {@inheritdoc}
*/
public function monthly(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function monthly(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory('@monthly'), $firstExecution, $lastExecution);

Expand All @@ -83,7 +83,7 @@ public function monthly(\DateTimeImmutable $firstExecution = null, \DateTimeImmu
/**
* {@inheritdoc}
*/
public function yearly(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function yearly(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory('@yearly'), $firstExecution, $lastExecution);

Expand All @@ -93,7 +93,7 @@ public function yearly(\DateTimeImmutable $firstExecution = null, \DateTimeImmut
/**
* {@inheritdoc}
*/
public function cron($cronExpression, \DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null)
public function cron($cronExpression, ?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null)
{
$this->task->setInterval(CronExpression::factory($cronExpression), $firstExecution, $lastExecution);

Expand Down
12 changes: 6 additions & 6 deletions src/Task/Builder/TaskBuilderInterface.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface TaskBuilderInterface
*
* @return $this
*/
public function hourly(\DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null);
public function hourly(?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null);

/**
* Use daily interval.
Expand All @@ -36,7 +36,7 @@ public function hourly(\DateTimeImmutable $firstExecution = null, \DateTimeImmut
*
* @return $this
*/
public function daily(\DateTimeImmutable $start = null, \DateTimeImmutable $end = null);
public function daily(?\DateTimeImmutable $start = null, ?\DateTimeImmutable $end = null);

/**
* Use weekly interval.
Expand All @@ -46,7 +46,7 @@ public function daily(\DateTimeImmutable $start = null, \DateTimeImmutable $end
*
* @return $this
*/
public function weekly(\DateTimeImmutable $start = null, \DateTimeImmutable $end = null);
public function weekly(?\DateTimeImmutable $start = null, ?\DateTimeImmutable $end = null);

/**
* Use monthly interval.
Expand All @@ -56,7 +56,7 @@ public function weekly(\DateTimeImmutable $start = null, \DateTimeImmutable $end
*
* @return $this
*/
public function monthly(\DateTimeImmutable $start = null, \DateTimeImmutable $end = null);
public function monthly(?\DateTimeImmutable $start = null, ?\DateTimeImmutable $end = null);

/**
* Use yearly interval.
Expand All @@ -66,7 +66,7 @@ public function monthly(\DateTimeImmutable $start = null, \DateTimeImmutable $en
*
* @return $this
*/
public function yearly(\DateTimeImmutable $start = null, \DateTimeImmutable $end = null);
public function yearly(?\DateTimeImmutable $start = null, ?\DateTimeImmutable $end = null);

/**
* Use given cron-interval.
Expand All @@ -77,7 +77,7 @@ public function yearly(\DateTimeImmutable $start = null, \DateTimeImmutable $end
*
* @return $this
*/
public function cron($cronExpression, \DateTimeImmutable $start = null, \DateTimeImmutable $end = null);
public function cron($cronExpression, ?\DateTimeImmutable $start = null, ?\DateTimeImmutable $end = null);

/**
* Set execution-date.
Expand Down
4 changes: 2 additions & 2 deletions src/Task/Runner/PendingExecutionFinder.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class PendingExecutionFinder implements ExecutionFinderInterface
* @param TaskExecutionRepositoryInterface $taskExecutionRepository
* @param TaskHandlerFactoryInterface $taskHandlerFactory
* @param LockInterface $lock
* @param LoggerInterface $logger
* @param LoggerInterface|null $logger
*/
public function __construct(
TaskExecutionRepositoryInterface $taskExecutionRepository,
TaskHandlerFactoryInterface $taskHandlerFactory,
LockInterface $lock,
LoggerInterface $logger = null
?LoggerInterface $logger = null
) {
$this->taskExecutionRepository = $taskExecutionRepository;
$this->taskHandlerFactory = $taskHandlerFactory;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class ArrayTaskExecutionRepository implements TaskExecutionRepositoryInterface
private $taskExecutionCollection;

/**
* @param Collection $taskExecutions
* @param Collection|null $taskExecutions
*/
public function __construct(Collection $taskExecutions = null)
public function __construct(?Collection $taskExecutions = null)
{
$this->taskExecutionCollection = $taskExecutions ?: new ArrayCollection();
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function findAllPaginated(int $page = 1, ?int $pageSize = null): array
/**
* {@inheritdoc}
*/
public function findNextScheduled(\DateTimeImmutable $dateTime = null, array $skippedExecutions = [])
public function findNextScheduled(?\DateTimeImmutable $dateTime = null, array $skippedExecutions = [])
{
$dateTime = $dateTime ?: new \DateTimeImmutable();

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class ArrayTaskRepository implements TaskRepositoryInterface
private $taskCollection;

/**
* @param Collection $tasks
* @param Collection|null $tasks
*/
public function __construct(Collection $tasks = null)
public function __construct(?Collection $tasks = null)
{
$this->taskCollection = $tasks ?: new ArrayCollection();
}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ public function findAllPaginated(int $page = 1, ?int $pageSize = null): array;
*
* @return TaskExecutionInterface
*/
public function findNextScheduled(\DateTimeImmutable $dateTime = null, array $skippedExecutions = []);
public function findNextScheduled(?\DateTimeImmutable $dateTime = null, array $skippedExecutions = []);
}
4 changes: 2 additions & 2 deletions src/Task/Task.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public function getLastExecution()
*/
public function setInterval(
CronExpression $interval,
\DateTimeImmutable $firstExecution = null,
\DateTimeImmutable $lastExecution = null
?\DateTimeImmutable $firstExecution = null,
?\DateTimeImmutable $lastExecution = null
) {
$this->interval = $interval;
$this->firstExecution = $firstExecution ?: new \DateTimeImmutable();
Expand Down
2 changes: 1 addition & 1 deletion src/Task/TaskInterface.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ public function getLastExecution();
*
* @return $this
*/
public function setInterval(CronExpression $interval, \DateTimeImmutable $firstExecution = null, \DateTimeImmutable $lastExecution = null);
public function setInterval(CronExpression $interval, ?\DateTimeImmutable $firstExecution = null, ?\DateTimeImmutable $lastExecution = null);
}
Loading

Back | FazBrowse Home | New Git URL