Skip to content

Commit f7d8640

Browse files
committed
Apply types
1 parent c76a51c commit f7d8640

File tree

6 files changed

+19
-24
lines changed

6 files changed

+19
-24
lines changed

examples/Alerts.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ class Alerts extends AlertsConfig
1616
{
1717
/**
1818
* Template to use for HTML output.
19-
*
20-
* @var string
2119
*/
22-
public $template = 'Tatter\Alerts\Views\Bootstrap4';
20+
public string $template = 'Tatter\Alerts\Views\Bootstrap4';
2321

2422
/**
2523
* Mapping of Session keys to their CSS classes.
@@ -28,20 +26,26 @@ class Alerts extends AlertsConfig
2826
*
2927
* @var array<string,string>
3028
*/
31-
public $classes = [
29+
public array $classes = [
30+
// Bootstrap classes
3231
'primary' => 'primary',
33-
'message' => 'primary',
3432
'secondary' => 'secondary',
35-
'notice' => 'secondary',
3633
'success' => 'success',
3734
'danger' => 'danger',
35+
'warning' => 'warning',
36+
'info' => 'info',
37+
38+
// Additional log levels
39+
'message' => 'primary',
40+
'notice' => 'secondary',
3841
'error' => 'danger',
39-
'errors' => 'danger',
4042
'critical' => 'danger',
4143
'emergency' => 'danger',
42-
'warning' => 'warning',
4344
'alert' => 'warning',
44-
'info' => 'info',
4545
'debug' => 'info',
46+
47+
// Common framework keys
48+
'messages' => 'primary',
49+
'errors' => 'danger',
4650
];
4751
}

src/Collectors/Alerts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Alerts extends BaseCollector
4444
*
4545
* @var array<string[]>
4646
*/
47-
protected $alerts;
47+
protected array $alerts;
4848

4949
//--------------------------------------------------------------------
5050

src/Config/Alerts.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ class Alerts extends BaseConfig
88
{
99
/**
1010
* Template to use for HTML output.
11-
*
12-
* @var string
1311
*/
14-
public $template = 'Tatter\Alerts\Views\Bootstrap4';
12+
public string $template = 'Tatter\Alerts\Views\Bootstrap4';
1513

1614
/**
1715
* Mapping of Session keys to their CSS classes.
@@ -20,7 +18,7 @@ class Alerts extends BaseConfig
2018
*
2119
* @var array<string,string>
2220
*/
23-
public $classes = [
21+
public array $classes = [
2422
// Bootstrap classes
2523
'primary' => 'primary',
2624
'secondary' => 'secondary',

src/Filters/AlertsFilter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class AlertsFilter implements FilterInterface
2424
public static function gather(AlertsConfig $config): array
2525
{
2626
// Gather alerts from the Session
27-
$session = service('session');
28-
$alerts = [];
27+
$alerts = [];
2928

3029
foreach ($config->classes as $key => $class) {
3130
$content = session($key);

tests/CollectorTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
*/
99
final class CollectorTest extends TestCase
1010
{
11-
/**
12-
* @var Alerts
13-
*/
14-
protected $collector;
11+
protected Alerts $collector;
1512

1613
protected function setUp(): void
1714
{

tests/FilterTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ final class FilterTest extends TestCase
1212
{
1313
use FilterTestTrait;
1414

15-
/**
16-
* @var string
17-
*/
18-
private $body = <<<'EOD'
15+
private string $body = <<<'EOD'
1916
<html>
2017
<head>
2118
<title>Test</title>

0 commit comments

Comments
 (0)