Skip to content

Commit

Permalink
Merge pull request #23 from samsonasik/apply-php74
Browse files Browse the repository at this point in the history
Apply PHP 7.4 syntax and typed property
  • Loading branch information
Ocramius authored Sep 14, 2022
2 parents 5133c59 + 411ac9d commit 595a8f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/FlashMessageMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class FlashMessageMiddleware implements MiddlewareInterface
{
public const FLASH_ATTRIBUTE = 'flash';

/** @var string */
private $attributeKey;
private string $attributeKey;

/** @psalm-var callable(SessionInterface, string): FlashMessagesInterface */
private $flashMessageFactory;

/** @var string */
private $sessionKey;
private string $sessionKey;

public function __construct(
string $flashMessagesClass = FlashMessages::class,
Expand Down
8 changes: 3 additions & 5 deletions src/FlashMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@
class FlashMessages implements FlashMessagesInterface
{
/** @var array<string,mixed> */
private $currentMessages = [];
private array $currentMessages = [];

/** @var SessionInterface */
private $session;
private SessionInterface $session;

/** @var string */
private $sessionKey;
private string $sessionKey;

private function __construct(SessionInterface $session, string $sessionKey)
{
Expand Down
3 changes: 1 addition & 2 deletions test/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

class ConfigProviderTest extends TestCase
{
/** @var ConfigProvider */
private $provider;
private ConfigProvider $provider;

public function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion test/FlashMessageMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testProcessUsesConfiguredClassAndSessionKeyAndAttributeKeyToCrea
->method('withAttribute')
->with(
'non-standard-flash-attr',
$this->callback(function (TestAsset\FlashMessages $flash) use ($session) {
$this->callback(function (TestAsset\FlashMessages $flash) use ($session): bool {
$this->assertSame($session, $flash->session);
$this->assertSame('non-standard-flash-next', $flash->sessionKey);
return true;
Expand Down

0 comments on commit 595a8f6

Please sign in to comment.