1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AppserverIo\Psr\Security\Auth\Login\LoginException |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/appserver-io-psr/security |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Psr\Security\Auth\Login; |
22
|
|
|
|
23
|
|
|
use AppserverIo\Lang\String; |
24
|
|
|
use AppserverIo\Collections\HashMap; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Contain's information about a login module's configuration. |
28
|
|
|
* |
29
|
|
|
* @author Tim Wagner <[email protected]> |
30
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
31
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
32
|
|
|
* @link https://github.com/appserver-io-psr/security |
33
|
|
|
* @link http://www.appserver.io |
34
|
|
|
*/ |
35
|
|
|
class ModuleInfo |
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The login module's class name. |
40
|
|
|
* |
41
|
|
|
* @var \AppserverIo\Lang\String |
42
|
|
|
*/ |
43
|
|
|
protected $type; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The login module's initialization parameters. |
47
|
|
|
* |
48
|
|
|
* @var \AppserverIo\Collections\HashMap |
49
|
|
|
*/ |
50
|
|
|
protected $params; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Initializes the instance with the login module name and initialization params. |
54
|
|
|
* |
55
|
|
|
* @param \AppserverIo\Lang\String $type The login module class name |
56
|
|
|
* @param \AppserverIo\Collections\HashMap $params The parameters for the initialize() method |
57
|
|
|
*/ |
58
|
|
|
public function __construct(String $type, HashMap $params) |
59
|
|
|
{ |
60
|
|
|
$this->type = $type; |
|
|
|
|
61
|
|
|
$this->params = $params; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Return's the login modules class name. |
66
|
|
|
* |
67
|
|
|
* @return \AppserverIo\Lang\String The class name |
68
|
|
|
*/ |
69
|
|
|
public function getType() |
70
|
|
|
{ |
71
|
|
|
return $this->type; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Return's the login modules initialization parameters. |
76
|
|
|
* |
77
|
|
|
* @return \AppserverIo\Collections\HashMap The parameters |
78
|
|
|
*/ |
79
|
|
|
public function getParams() |
80
|
|
|
{ |
81
|
|
|
return $this->params; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.