Skip to content

Commit 3193c1f

Browse files
committed
Apply static analysis fixes
1 parent b7382e0 commit 3193c1f

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ parameters:
1010
- src/Config/Routes.php
1111
- src/Views/*
1212
ignoreErrors:
13-
- '#Cannot access property [\$a-z_]+ on (array|object)#'
1413
- '#Unsafe usage of new static\(\)*#'
1514
universalObjectCratesClasses:
1615
- CodeIgniter\Entity

src/Alerts.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
*
2323
***/
2424

25-
use CodeIgniter\Config\BaseConfig;
25+
use CodeIgniter\Session\Session;
2626
use CodeIgniter\View\RendererInterface;
2727
use Config\Services;
28+
use Tatter\Alerts\Config\Alerts as AlertsConfig;
2829
use Tatter\Alerts\Exceptions\AlertsException;
2930

3031
/*** CLASS ***/
@@ -34,7 +35,7 @@ class Alerts
3435
/**
3536
* Our configuration instance.
3637
*
37-
* @var \Tatter\Alerts\Config\Alerts
38+
* @var AlertsConfig
3839
*/
3940
protected $config;
4041

@@ -48,12 +49,12 @@ class Alerts
4849
/**
4950
* The active user session, for loading and storing alerts.
5051
*
51-
* @var \CodeIgniter\Session\Session
52+
* @var Session
5253
*/
5354
protected $session;
5455

5556
// initiate library, check for existing session
56-
public function __construct(BaseConfig $config, RendererInterface $view = null)
57+
public function __construct(AlertsConfig $config, RendererInterface $view = null)
5758
{
5859
// save configuration
5960
$this->config = $config;

src/Config/Services.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
<?php namespace Tatter\Alerts\Config;
22

33
use CodeIgniter\View\RendererInterface;
4+
use Config\Services as BaseServices;
5+
use Tatter\Alerts\Alerts;
6+
use Tatter\Alerts\Config\Alerts as AlertsConfig;
47

5-
class Services extends \Config\Services
8+
class Services extends BaseServices
69
{
7-
public static function alerts(BaseConfig $config = null, RendererInterface $view = null, bool $getShared = true)
10+
public static function alerts(AlertsConfig $config = null, RendererInterface $view = null, bool $getShared = true)
811
{
912
if ($getShared)
1013
{
1114
return static::getSharedInstance('alerts', $config, $view);
1215
}
1316

14-
// If no config was injected then load one
15-
// Prioritizes app/Config if found
16-
if (empty($config))
17-
{
18-
$config = config('Alerts');
19-
}
17+
$config = $config ?? config('Alerts');
2018

21-
return new \Tatter\Alerts\Alerts($config, $view);
19+
return new Alerts($config, $view);
2220
}
2321
}

0 commit comments

Comments
 (0)