Skip to content

Commit a71c957

Browse files
updated symfony components (php-task#40)
1 parent da612fe commit a71c957

File tree

8 files changed

+25
-11
lines changed

8 files changed

+25
-11
lines changed

.travis.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@ language: php
33
matrix:
44
fast_finish: true
55
include:
6-
- php: 5.5
76
- php: 5.6
87
env:
9-
- CODE_COVERAGE=true
8+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
9+
- php: 5.6
10+
- php: 7.0
11+
env:
12+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
1013
- php: 7.0
14+
- php: 7.1
15+
env:
16+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
17+
- php: 7.1
18+
env:
19+
- CODE_COVERAGE=true
1120

1221
install:
1322
- composer self-update
14-
- composer update
23+
- composer update $COMPOSER_FLAGS
1524
- composer info
1625

1726
script:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
}
1111
],
1212
"require": {
13-
"php": "~5.5 || ~7.0",
13+
"php": "^5.6 || ^7.0",
1414
"doctrine/common": "^2.6",
1515
"ramsey/uuid": "^3.1",
16-
"symfony/event-dispatcher": "^2.6 || ^3.0",
16+
"symfony/event-dispatcher": "^2.6 || ^3.4 || ^4.0",
1717
"mtdowling/cron-expression": "^1.1"
1818
},
1919
"require-dev": {

src/Task/Runner/TaskRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private function finalize(TaskExecutionInterface $execution, $start)
208208
// invalid (clear in doctrine) after handling an execution.
209209
$execution = $this->taskExecutionRepository->findByUuid($execution->getUuid());
210210

211-
if ($execution->getStatus() !== TaskStatus::PLANNED) {
211+
if (TaskStatus::PLANNED !== $execution->getStatus()) {
212212
$execution->setEndTime(new \DateTime());
213213
$execution->setDuration(microtime(true) - $start);
214214
}

src/Task/Scheduler/TaskScheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected function scheduleTask(TaskInterface $task)
107107
return;
108108
}
109109

110-
if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
110+
if (null === $task->getInterval() && 0 < count($this->taskExecutionRepository->findByTask($task))) {
111111
return;
112112
}
113113

src/Task/Storage/ArrayStorage/ArrayTaskExecutionRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function (TaskExecutionInterface $execution) use ($task) {
8989
}
9090
);
9191

92-
if ($filtered->count() === 0) {
92+
if (0 === $filtered->count()) {
9393
return;
9494
}
9595

@@ -107,7 +107,7 @@ function (TaskExecutionInterface $execution) use ($uuid) {
107107
}
108108
);
109109

110-
if ($filtered->count() === 0) {
110+
if (0 === $filtered->count()) {
111111
return;
112112
}
113113

@@ -153,7 +153,7 @@ public function findNextScheduled(\DateTime $dateTime = null, array $skippedExec
153153

154154
$result = $this->taskExecutionCollection->filter(
155155
function (TaskExecutionInterface $execution) use ($dateTime, $skippedExecutions) {
156-
return $execution->getStatus() === TaskStatus::PLANNED
156+
return TaskStatus::PLANNED === $execution->getStatus()
157157
&& $execution->getScheduleTime() < $dateTime
158158
&& !in_array($execution->getUuid(), $skippedExecutions);
159159
}

src/Task/Storage/ArrayStorage/ArrayTaskRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function findEndBeforeNow()
106106
return array_values(
107107
$this->taskCollection->filter(
108108
function (TaskInterface $task) use ($now) {
109-
return $task->getLastExecution() === null || $task->getLastExecution() > $now;
109+
return null === $task->getLastExecution() || $task->getLastExecution() > $now;
110110
}
111111
)->toArray()
112112
);

src/Task/TaskStatus.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
final class TaskStatus
1818
{
1919
const PLANNED = 'planned';
20+
2021
const RUNNING = 'running';
22+
2123
const COMPLETED = 'completed';
24+
2225
const ABORTED = 'aborted';
26+
2327
const FAILED = 'failed';
2428

2529
/**

tests/Unit/Runner/PendingExecutionFinderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
class PendingExecutionFinderTest extends \PHPUnit_Framework_TestCase
2525
{
2626
const HANDLER = 'AppBundle\\Handler\\TestHandler';
27+
2728
const LOCKING_HANDLER = 'AppBundle\\Handler\\LockingTestHandler';
2829

2930
/**

0 commit comments

Comments
 (0)