Skip to content

Commit 7f6b31b

Browse files
committed
Run php-cs-fixer fix on whole project
1 parent 0903a26 commit 7f6b31b

27 files changed

+72
-44
lines changed

CalculateRootJobStatusProcessor.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Enqueue\Client\MessageProducerInterface;

CalculateRootJobStatusService.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Doctrine\Common\Collections\Collection;
@@ -28,13 +29,13 @@ public function calculate(Job $job)
2829
$rootJob = $job->isRoot() ? $job : $job->getRootJob();
2930
$stopStatuses = [Job::STATUS_SUCCESS, Job::STATUS_FAILED, Job::STATUS_CANCELLED];
3031

31-
if (in_array($rootJob->getStatus(), $stopStatuses)) {
32+
if (in_array($rootJob->getStatus(), $stopStatuses, true)) {
3233
return;
3334
}
3435

3536
$rootStopped = false;
3637
$this->jobStorage->saveJob($rootJob, function (Job $rootJob) use ($stopStatuses, &$rootStopped) {
37-
if (in_array($rootJob->getStatus(), $stopStatuses)) {
38+
if (in_array($rootJob->getStatus(), $stopStatuses, true)) {
3839
return;
3940
}
4041

@@ -47,7 +48,7 @@ public function calculate(Job $job)
4748

4849
$rootJob->setStatus($status);
4950

50-
if (in_array($status, $stopStatuses)) {
51+
if (in_array($status, $stopStatuses, true)) {
5152
$rootStopped = true;
5253
if (!$rootJob->getStoppedAt()) {
5354
$rootJob->setStoppedAt(new \DateTime());

DependentJobContext.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class DependentJobContext

DependentJobProcessor.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Enqueue\Client\Message;

DependentJobService.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class DependentJobService

DuplicateJobException.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class DuplicateJobException extends \Exception

Job.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class Job

JobProcessor.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Enqueue\Client\MessageProducerInterface;
@@ -202,7 +203,7 @@ public function cancelChildJob(Job $job)
202203

203204
$job = $this->jobStorage->findJobById($job->getId());
204205

205-
if (!in_array($job->getStatus(), [Job::STATUS_NEW, Job::STATUS_RUNNING])) {
206+
if (!in_array($job->getStatus(), [Job::STATUS_NEW, Job::STATUS_RUNNING], true)) {
206207
throw new \LogicException(sprintf(
207208
'Can cancel only new or running jobs. id: "%s", status: "%s"',
208209
$job->getId(),

JobRunner.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class JobRunner

JobStorage.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Doctrine\Common\Persistence\ManagerRegistry;

Schema.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
use Doctrine\DBAL\Connection;

Test/DbalPersistedConnection.php

+35-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Test;
34

45
use Doctrine\DBAL\Connection;
@@ -65,40 +66,6 @@ public function rollBack()
6566
$this->wrapTransactionNestingLevel('rollBack');
6667
}
6768

68-
/**
69-
* @param int $level
70-
*/
71-
private function setTransactionNestingLevel($level)
72-
{
73-
$prop = new \ReflectionProperty('Doctrine\DBAL\Connection', '_transactionNestingLevel');
74-
$prop->setAccessible(true);
75-
76-
return $prop->setValue($this, $level);
77-
}
78-
79-
/**
80-
* @param string $method
81-
*
82-
* @throws \Exception
83-
*/
84-
private function wrapTransactionNestingLevel($method)
85-
{
86-
$e = null;
87-
88-
$this->setTransactionNestingLevel($this->getPersistedTransactionNestingLevel());
89-
90-
try {
91-
call_user_func(['parent', $method]);
92-
} catch (\Exception $e) {
93-
}
94-
95-
$this->persistTransactionNestingLevel($this->getTransactionNestingLevel());
96-
97-
if ($e) {
98-
throw $e;
99-
}
100-
}
101-
10269
/**
10370
* @param bool $connected
10471
*/
@@ -161,4 +128,38 @@ protected function getConnectionId()
161128
{
162129
return md5(serialize($this->getParams()));
163130
}
131+
132+
/**
133+
* @param int $level
134+
*/
135+
private function setTransactionNestingLevel($level)
136+
{
137+
$prop = new \ReflectionProperty('Doctrine\DBAL\Connection', '_transactionNestingLevel');
138+
$prop->setAccessible(true);
139+
140+
return $prop->setValue($this, $level);
141+
}
142+
143+
/**
144+
* @param string $method
145+
*
146+
* @throws \Exception
147+
*/
148+
private function wrapTransactionNestingLevel($method)
149+
{
150+
$e = null;
151+
152+
$this->setTransactionNestingLevel($this->getPersistedTransactionNestingLevel());
153+
154+
try {
155+
call_user_func(['parent', $method]);
156+
} catch (\Exception $e) {
157+
}
158+
159+
$this->persistTransactionNestingLevel($this->getTransactionNestingLevel());
160+
161+
if ($e) {
162+
throw $e;
163+
}
164+
}
164165
}

Test/JobRunner.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Test;
34

45
use Enqueue\JobQueue\Job;

Tests/CalculateRootJobStatusProcessorTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\Client\MessageProducerInterface;

Tests/CalculateRootJobStatusServiceTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\JobQueue\CalculateRootJobStatusService;
@@ -23,6 +24,7 @@ public function stopStatusProvider()
2324

2425
/**
2526
* @dataProvider stopStatusProvider
27+
* @param mixed $status
2628
*/
2729
public function testShouldDoNothingIfRootJobHasStopState($status)
2830
{
@@ -71,6 +73,7 @@ public function testShouldCalculateRootJobStatus()
7173

7274
/**
7375
* @dataProvider stopStatusProvider
76+
* @param mixed $stopStatus
7477
*/
7578
public function testShouldCalculateRootJobStatusAndSetStoppedAtTimeIfGotStopStatus($stopStatus)
7679
{

Tests/DependentJobContextTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\JobQueue\DependentJobContext;

Tests/DependentJobProcessorTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\Client\Message;

Tests/DependentJobServiceTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\JobQueue\DependentJobContext;

Tests/Functional/Entity/Job.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests\Functional\Entity;
34

45
use Doctrine\Common\Collections\ArrayCollection;

Tests/Functional/Entity/JobUnique.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests\Functional\Entity;
34

45
use Doctrine\ORM\Mapping as ORM;

Tests/Functional/Job/JobStorageTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests\Functional\Job;
34

45
use Enqueue\JobQueue\DuplicateJobException;

Tests/Functional/WebTestCase.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests\Functional;
34

45
use Symfony\Bundle\FrameworkBundle\Client;

Tests/Functional/app/AppKernel.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public function getLogDir()
3636
return sys_get_temp_dir().'/EnqueueJobQueue/cache/logs';
3737
}
3838

39-
protected function getContainerClass()
40-
{
41-
return parent::getContainerClass().'JobQueue';
42-
}
43-
4439
/**
4540
* @param \Symfony\Component\Config\Loader\LoaderInterface $loader
4641
*/
4742
public function registerContainerConfiguration(LoaderInterface $loader)
4843
{
4944
$loader->load(__DIR__.'/config/config.yml');
5045
}
46+
47+
protected function getContainerClass()
48+
{
49+
return parent::getContainerClass().'JobQueue';
50+
}
5151
}

Tests/JobProcessorTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

5+
use Enqueue\Client\MessageProducer;
46
use Enqueue\JobQueue\DuplicateJobException;
57
use Enqueue\JobQueue\Job;
68
use Enqueue\JobQueue\JobProcessor;
79
use Enqueue\JobQueue\JobStorage;
810
use Enqueue\JobQueue\Topics;
9-
use Enqueue\Client\MessageProducer;
1011

1112
class JobProcessorTest extends \PHPUnit_Framework_TestCase
1213
{

Tests/JobRunnerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Enqueue\JobQueue\Job;

Tests/JobStorageTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue\Tests;
34

45
use Doctrine\Common\Persistence\ManagerRegistry;

Topics.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Enqueue\JobQueue;
34

45
class Topics

0 commit comments

Comments
 (0)