Skip to content

Fix some PHP CS rules #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2020
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
13 changes: 13 additions & 0 deletions .php_cs → .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,21 @@ if (\class_exists(PhpCsFixer\Config::class, false)) {
'align_equals' => true,
],
'blank_line_after_opening_tag' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'logical_operators' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_extra_blank_lines' => true,
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
])
->setFinder(
PhpCsFixer\Finder::create()->exclude(['Tests/Functional/cache'])->in(__DIR__)
Expand Down
4 changes: 0 additions & 4 deletions Form/DataTransformer/StatusTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public function transform($number)
if (TicketMessage::STATUS_CLOSED == $number) {
return 1;
}

return;
}

/**
Expand All @@ -35,7 +33,5 @@ public function reverseTransform($number)
if (1 == $number) {
return TicketMessage::STATUS_CLOSED;
}

return;
}
}
78 changes: 39 additions & 39 deletions Model/TicketMessageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@

interface TicketMessageInterface
{
const STATUS_INVALID = 0;

const STATUS_OPEN = 10;

const STATUS_IN_PROGRESS = 11;

const STATUS_INFORMATION_REQUESTED = 12;

const STATUS_ON_HOLD = 13;

const STATUS_RESOLVED = 14;

const STATUS_CLOSED = 15;

const STATUSES = [
self::STATUS_INVALID => 'STATUS_INVALID',
self::STATUS_OPEN => 'STATUS_OPEN',
self::STATUS_IN_PROGRESS => 'STATUS_IN_PROGRESS',
self::STATUS_INFORMATION_REQUESTED => 'STATUS_INFORMATION_REQUESTED',
self::STATUS_ON_HOLD => 'STATUS_ON_HOLD',
self::STATUS_RESOLVED => 'STATUS_RESOLVED',
self::STATUS_CLOSED => 'STATUS_CLOSED',
];

const PRIORITY_INVALID = 0;

const PRIORITY_LOW = 20;

const PRIORITY_MEDIUM = 21;

const PRIORITY_HIGH = 22;

const PRIORITIES = [
self::PRIORITY_INVALID => 'PRIORITY_INVALID',
self::PRIORITY_LOW => 'PRIORITY_LOW',
self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM',
self::PRIORITY_HIGH => 'PRIORITY_HIGH',
];

/**
* Get id.
*
Expand Down Expand Up @@ -143,43 +182,4 @@ public function setTicket(TicketInterface $ticket = null);
* @return TicketInterface
*/
public function getTicket();

const STATUS_INVALID = 0;

const STATUS_OPEN = 10;

const STATUS_IN_PROGRESS = 11;

const STATUS_INFORMATION_REQUESTED = 12;

const STATUS_ON_HOLD = 13;

const STATUS_RESOLVED = 14;

const STATUS_CLOSED = 15;

const STATUSES = [
self::STATUS_INVALID => 'STATUS_INVALID',
self::STATUS_OPEN => 'STATUS_OPEN',
self::STATUS_IN_PROGRESS => 'STATUS_IN_PROGRESS',
self::STATUS_INFORMATION_REQUESTED => 'STATUS_INFORMATION_REQUESTED',
self::STATUS_ON_HOLD => 'STATUS_ON_HOLD',
self::STATUS_RESOLVED => 'STATUS_RESOLVED',
self::STATUS_CLOSED => 'STATUS_CLOSED',
];

const PRIORITY_INVALID = 0;

const PRIORITY_LOW = 20;

const PRIORITY_MEDIUM = 21;

const PRIORITY_HIGH = 22;

const PRIORITIES = [
self::PRIORITY_INVALID => 'PRIORITY_INVALID',
self::PRIORITY_LOW => 'PRIORITY_LOW',
self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM',
self::PRIORITY_HIGH => 'PRIORITY_HIGH',
];
}
4 changes: 2 additions & 2 deletions Tests/Component/TicketFeaturesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class TicketFeaturesTest extends WebTestCase
final class TicketFeaturesTest extends WebTestCase
{
/**
* @dataProvider constructProvider
Expand Down Expand Up @@ -41,7 +41,7 @@ public function testFeatureAttachment($features, $class, $compare)
$obj = new TicketFeatures($features, $class);

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

public function featureAttachmentProvider()
Expand Down
6 changes: 3 additions & 3 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class ConfigurationTest extends WebTestCase
final class ConfigurationTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new Configuration();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/DependencyInjection/HackzillaTicketExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\DependencyInjection\HackzillaTicketExtension;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class HackzillaTicketExtensionTest extends WebTestCase
final class HackzillaTicketExtensionTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new HackzillaTicketExtension();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Entity/TicketMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessage;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class TicketMessageTest extends WebTestCase
final class TicketMessageTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new TicketMessage();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Entity/TicketMessageWithAttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class TicketMessageWithAttachmentTest extends WebTestCase
final class TicketMessageWithAttachmentTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new TicketMessageWithAttachment();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Entity/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
use Hackzilla\Bundle\TicketBundle\Model\TicketMessageInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class TicketTest extends WebTestCase
final class TicketTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new Ticket();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
12 changes: 6 additions & 6 deletions Tests/EventListener/UserLoadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
use Hackzilla\Bundle\TicketBundle\Manager\UserManager;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class UserLoadTest extends WebTestCase
final class UserLoadTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$userManager = $this->getUserManagerMock();

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

public function getUserManagerMock()
protected function tearDown()
{
return $this->createMock(UserManager::class);
unset($this->object);
}

public function tearDown()
public function getUserManagerMock()
{
unset($this->object);
return $this->createMock(UserManager::class);
}

public function testObjectCreated()
Expand Down
6 changes: 3 additions & 3 deletions Tests/Form/DataTransformer/StatusTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
use Hackzilla\Bundle\TicketBundle\Form\DataTransformer\StatusTransformer;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class StatusTransformerTest extends WebTestCase
final class StatusTransformerTest extends WebTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new StatusTransformer();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Form/Type/PriorityTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\Form\Type\PriorityType;
use Symfony\Component\Form\Test\TypeTestCase;

class PriorityTypeTest extends TypeTestCase
final class PriorityTypeTest extends TypeTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new PriorityType();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Form/Type/StatusTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use Hackzilla\Bundle\TicketBundle\Form\Type\StatusType;
use Symfony\Component\Form\Test\TypeTestCase;

class StatusTypeTest extends TypeTestCase
final class StatusTypeTest extends TypeTestCase
{
private $object;

public function setUp()
protected function setUp()
{
$this->object = new StatusType();
}

public function tearDown()
protected function tearDown()
{
unset($this->object);
}
Expand Down
Loading