Skip to content

Commit de7f7d0

Browse files
committed
minor #162 Fix some PHP CS rules (phansys)
This PR was merged into the 3.x branch. Discussion ---------- |Q |A | |--- |---| |Branch |3.x| |Bug fix? |no | |New feature? |no | |BC breaks? |no | |Deprecations?|no | |Tests pass? |yes| |Fixed tickets|n/a| |License |MIT| |Doc PR |n/a| Commits ------- 19758c6 Fix some PHP CS rules
2 parents fa5b09d + 19758c6 commit de7f7d0

22 files changed

+186
-157
lines changed

.php_cs renamed to .php_cs.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ if (\class_exists(PhpCsFixer\Config::class, false)) {
1313
'align_equals' => true,
1414
],
1515
'blank_line_after_opening_tag' => true,
16+
'combine_consecutive_issets' => true,
17+
'combine_consecutive_unsets' => true,
18+
'logical_operators' => true,
19+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
20+
'no_extra_blank_lines' => true,
21+
'no_php4_constructor' => true,
22+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
23+
'no_useless_else' => true,
24+
'no_useless_return' => true,
25+
'ordered_class_elements' => true,
1626
'ordered_imports' => true,
1727
'php_unit_construct' => true,
28+
'php_unit_set_up_tear_down_visibility' => true,
29+
'php_unit_strict' => true,
30+
'phpdoc_order' => true,
1831
])
1932
->setFinder(
2033
PhpCsFixer\Finder::create()->exclude(['Tests/Functional/cache'])->in(__DIR__)

Form/DataTransformer/StatusTransformer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public function transform($number)
1919
if (TicketMessage::STATUS_CLOSED == $number) {
2020
return 1;
2121
}
22-
23-
return;
2422
}
2523

2624
/**
@@ -35,7 +33,5 @@ public function reverseTransform($number)
3533
if (1 == $number) {
3634
return TicketMessage::STATUS_CLOSED;
3735
}
38-
39-
return;
4036
}
4137
}

Model/TicketMessageInterface.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,45 @@
44

55
interface TicketMessageInterface
66
{
7+
const STATUS_INVALID = 0;
8+
9+
const STATUS_OPEN = 10;
10+
11+
const STATUS_IN_PROGRESS = 11;
12+
13+
const STATUS_INFORMATION_REQUESTED = 12;
14+
15+
const STATUS_ON_HOLD = 13;
16+
17+
const STATUS_RESOLVED = 14;
18+
19+
const STATUS_CLOSED = 15;
20+
21+
const STATUSES = [
22+
self::STATUS_INVALID => 'STATUS_INVALID',
23+
self::STATUS_OPEN => 'STATUS_OPEN',
24+
self::STATUS_IN_PROGRESS => 'STATUS_IN_PROGRESS',
25+
self::STATUS_INFORMATION_REQUESTED => 'STATUS_INFORMATION_REQUESTED',
26+
self::STATUS_ON_HOLD => 'STATUS_ON_HOLD',
27+
self::STATUS_RESOLVED => 'STATUS_RESOLVED',
28+
self::STATUS_CLOSED => 'STATUS_CLOSED',
29+
];
30+
31+
const PRIORITY_INVALID = 0;
32+
33+
const PRIORITY_LOW = 20;
34+
35+
const PRIORITY_MEDIUM = 21;
36+
37+
const PRIORITY_HIGH = 22;
38+
39+
const PRIORITIES = [
40+
self::PRIORITY_INVALID => 'PRIORITY_INVALID',
41+
self::PRIORITY_LOW => 'PRIORITY_LOW',
42+
self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM',
43+
self::PRIORITY_HIGH => 'PRIORITY_HIGH',
44+
];
45+
746
/**
847
* Get id.
948
*
@@ -143,43 +182,4 @@ public function setTicket(TicketInterface $ticket = null);
143182
* @return TicketInterface
144183
*/
145184
public function getTicket();
146-
147-
const STATUS_INVALID = 0;
148-
149-
const STATUS_OPEN = 10;
150-
151-
const STATUS_IN_PROGRESS = 11;
152-
153-
const STATUS_INFORMATION_REQUESTED = 12;
154-
155-
const STATUS_ON_HOLD = 13;
156-
157-
const STATUS_RESOLVED = 14;
158-
159-
const STATUS_CLOSED = 15;
160-
161-
const STATUSES = [
162-
self::STATUS_INVALID => 'STATUS_INVALID',
163-
self::STATUS_OPEN => 'STATUS_OPEN',
164-
self::STATUS_IN_PROGRESS => 'STATUS_IN_PROGRESS',
165-
self::STATUS_INFORMATION_REQUESTED => 'STATUS_INFORMATION_REQUESTED',
166-
self::STATUS_ON_HOLD => 'STATUS_ON_HOLD',
167-
self::STATUS_RESOLVED => 'STATUS_RESOLVED',
168-
self::STATUS_CLOSED => 'STATUS_CLOSED',
169-
];
170-
171-
const PRIORITY_INVALID = 0;
172-
173-
const PRIORITY_LOW = 20;
174-
175-
const PRIORITY_MEDIUM = 21;
176-
177-
const PRIORITY_HIGH = 22;
178-
179-
const PRIORITIES = [
180-
self::PRIORITY_INVALID => 'PRIORITY_INVALID',
181-
self::PRIORITY_LOW => 'PRIORITY_LOW',
182-
self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM',
183-
self::PRIORITY_HIGH => 'PRIORITY_HIGH',
184-
];
185185
}

Tests/Component/TicketFeaturesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment;
88
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
99

10-
class TicketFeaturesTest extends WebTestCase
10+
final class TicketFeaturesTest extends WebTestCase
1111
{
1212
/**
1313
* @dataProvider constructProvider
@@ -41,7 +41,7 @@ public function testFeatureAttachment($features, $class, $compare)
4141
$obj = new TicketFeatures($features, $class);
4242

4343
$this->assertInstanceOf(TicketFeatures::class, $obj);
44-
$this->assertEquals($obj->hasFeature('attachment'), $compare);
44+
$this->assertSame($obj->hasFeature('attachment'), $compare);
4545
}
4646

4747
public function featureAttachmentProvider()

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Hackzilla\Bundle\TicketBundle\DependencyInjection\Configuration;
66
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
77

8-
class ConfigurationTest extends WebTestCase
8+
final class ConfigurationTest extends WebTestCase
99
{
1010
private $object;
1111

12-
public function setUp()
12+
protected function setUp()
1313
{
1414
$this->object = new Configuration();
1515
}
1616

17-
public function tearDown()
17+
protected function tearDown()
1818
{
1919
unset($this->object);
2020
}

Tests/DependencyInjection/HackzillaTicketExtensionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Hackzilla\Bundle\TicketBundle\DependencyInjection\HackzillaTicketExtension;
66
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
77

8-
class HackzillaTicketExtensionTest extends WebTestCase
8+
final class HackzillaTicketExtensionTest extends WebTestCase
99
{
1010
private $object;
1111

12-
public function setUp()
12+
protected function setUp()
1313
{
1414
$this->object = new HackzillaTicketExtension();
1515
}
1616

17-
public function tearDown()
17+
protected function tearDown()
1818
{
1919
unset($this->object);
2020
}

Tests/Entity/TicketMessageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessage;
66
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
77

8-
class TicketMessageTest extends WebTestCase
8+
final class TicketMessageTest extends WebTestCase
99
{
1010
private $object;
1111

12-
public function setUp()
12+
protected function setUp()
1313
{
1414
$this->object = new TicketMessage();
1515
}
1616

17-
public function tearDown()
17+
protected function tearDown()
1818
{
1919
unset($this->object);
2020
}

Tests/Entity/TicketMessageWithAttachmentTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment;
66
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
77

8-
class TicketMessageWithAttachmentTest extends WebTestCase
8+
final class TicketMessageWithAttachmentTest extends WebTestCase
99
{
1010
private $object;
1111

12-
public function setUp()
12+
protected function setUp()
1313
{
1414
$this->object = new TicketMessageWithAttachment();
1515
}
1616

17-
public function tearDown()
17+
protected function tearDown()
1818
{
1919
unset($this->object);
2020
}

Tests/Entity/TicketTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
use Hackzilla\Bundle\TicketBundle\Model\TicketMessageInterface;
77
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
88

9-
class TicketTest extends WebTestCase
9+
final class TicketTest extends WebTestCase
1010
{
1111
private $object;
1212

13-
public function setUp()
13+
protected function setUp()
1414
{
1515
$this->object = new Ticket();
1616
}
1717

18-
public function tearDown()
18+
protected function tearDown()
1919
{
2020
unset($this->object);
2121
}

Tests/EventListener/UserLoadTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
use Hackzilla\Bundle\TicketBundle\Manager\UserManager;
77
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
88

9-
class UserLoadTest extends WebTestCase
9+
final class UserLoadTest extends WebTestCase
1010
{
1111
private $object;
1212

13-
public function setUp()
13+
protected function setUp()
1414
{
1515
$userManager = $this->getUserManagerMock();
1616

1717
$this->object = new UserLoad($userManager);
1818
}
1919

20-
public function getUserManagerMock()
20+
protected function tearDown()
2121
{
22-
return $this->createMock(UserManager::class);
22+
unset($this->object);
2323
}
2424

25-
public function tearDown()
25+
public function getUserManagerMock()
2626
{
27-
unset($this->object);
27+
return $this->createMock(UserManager::class);
2828
}
2929

3030
public function testObjectCreated()

0 commit comments

Comments
 (0)