Skip to content

Commit

Permalink
codestyle-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cavasin F committed Dec 12, 2023
1 parent 75f8c4a commit a95f49b
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/Event/NotificationEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

namespace KevinPapst\TablerBundle\Event;

use KevinPapst\TablerBundle\Model\NotificationV2Interface;
use KevinPapst\TablerBundle\Model\NotificationInterface;
use KevinPapst\TablerBundle\Model\NotificationV2Interface;

class NotificationEvent extends ThemeEvent
{
Expand All @@ -29,7 +29,7 @@ class NotificationEvent extends ThemeEvent
private int $maxDisplay = 10;

/**
* @var $notifications array<int,NotificationInterface | NotificationV2Interface>
* @var array<int,NotificationInterface | NotificationV2Interface>
*/
private array $notifications = [];

Expand Down
7 changes: 7 additions & 0 deletions src/Event/NotificationEventInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of the Tabler bundle, created by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KevinPapst\TablerBundle\Event;

use KevinPapst\TablerBundle\Model\NotificationInterface;
Expand Down
42 changes: 21 additions & 21 deletions src/Model/NotificationInterface.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

/*
* This file is part of the Tabler bundle, created by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KevinPapst\TablerBundle\Model;

interface NotificationInterface
{
public function getIdentifier(): string;

public function getMessage(): string;

public function getType(): string;

public function getUrl(): ?string;
}
<?php

/*
* This file is part of the Tabler bundle, created by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KevinPapst\TablerBundle\Model;

interface NotificationInterface
{
public function getIdentifier(): string;

public function getMessage(): string;

public function getType(): string;

public function getUrl(): ?string;
}
8 changes: 4 additions & 4 deletions src/Model/NotificationModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

class NotificationModel implements NotificationV2Interface
{
private ?string $url = null;
private bool $active = false;
private bool $disabled = false;
private bool $withBadge = true;
private ?string $url = null;
private bool $active = false;
private bool $disabled = false;
private bool $withBadge = true;
private bool $badgeAnimated = true;

private bool $html = false;
Expand Down
56 changes: 28 additions & 28 deletions src/Model/NotificationV2Interface.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php

/*
* This file is part of the Tabler bundle, created by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KevinPapst\TablerBundle\Model;

/**
* TODO : Implement these in NotificationInterface later
* @internal THIS WILL BE REMOVED WITH THE NEXT MAJOR RELEASE, NO BC PROMISE GIVEN
* @deprecated
*/
interface NotificationV2Interface extends NotificationInterface
{
public function isActive(): bool;

public function isDisabled(): bool;

public function isWithBadge(): bool;

public function isBadgeAnimated(): bool;

public function isHtml(): bool;
}
<?php

/*
* This file is part of the Tabler bundle, created by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KevinPapst\TablerBundle\Model;

/**
* TODO : Implement these in NotificationInterface later
* @internal THIS WILL BE REMOVED WITH THE NEXT MAJOR RELEASE, NO BC PROMISE GIVEN
* @deprecated
*/
interface NotificationV2Interface extends NotificationInterface
{
public function isActive(): bool;

public function isDisabled(): bool;

public function isWithBadge(): bool;

public function isBadgeAnimated(): bool;

public function isHtml(): bool;
}
2 changes: 1 addition & 1 deletion src/Twig/RuntimeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class RuntimeExtension implements RuntimeExtensionInterface
{
/**
* @param array<string, string|null> $routes
* @param array<string, string> $icons
* @param array<string, string> $icons
*/
public function __construct(
private EventDispatcherInterface $eventDispatcher,
Expand Down
6 changes: 3 additions & 3 deletions tests/Event/NotificationEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private function generateNbNotifications(): array

// 2
$defaultNotification = new NotificationModel('default', 'My default Message');
$arr[] = $defaultNotification;
$arr[] = $defaultNotification;

// 3
$disabledNotification = new NotificationModel('disabled', 'My disabled Message', null);

Check failure on line 79 in tests/Event/NotificationEventTest.php

View workflow job for this annotation

GitHub Actions / Linting - PHP 8.1

Parameter #3 $type of class KevinPapst\TablerBundle\Model\NotificationModel constructor expects string, null given.

Check failure on line 79 in tests/Event/NotificationEventTest.php

View workflow job for this annotation

GitHub Actions / Linting - PHP 8.2

Parameter #3 $type of class KevinPapst\TablerBundle\Model\NotificationModel constructor expects string, null given.
Expand Down Expand Up @@ -136,11 +136,11 @@ private function generateNbNotifications(): array
// 8
$moreThanMaxNotification =
new NotificationModel('max', 'Will not be displayed as max notification is set to 7');
$arr[] = $moreThanMaxNotification;
$arr[] = $moreThanMaxNotification;

// 9
$extraNotification = new NotificationModel('extra', 'One more not displayed');
$arr[] = $extraNotification;
$arr[] = $extraNotification;

return $arr;
}
Expand Down

0 comments on commit a95f49b

Please sign in to comment.