@@ -44,32 +44,17 @@ class DistinguishedName
44
44
/** @var array */
45
45
private $ subjectAlternativeNames ;
46
46
47
- /**
48
- * @param string $commonName
49
- * @param string $countryName
50
- * @param string $stateOrProvinceName
51
- * @param string $localityName
52
- * @param string $organizationName
53
- * @param string $organizationalUnitName
54
- * @param string $emailAddress
55
- */
56
47
public function __construct (
57
- $ commonName ,
58
- $ countryName = null ,
59
- $ stateOrProvinceName = null ,
60
- $ localityName = null ,
61
- $ organizationName = null ,
62
- $ organizationalUnitName = null ,
63
- $ emailAddress = null ,
48
+ string $ commonName ,
49
+ string $ countryName = null ,
50
+ string $ stateOrProvinceName = null ,
51
+ string $ localityName = null ,
52
+ string $ organizationName = null ,
53
+ string $ organizationalUnitName = null ,
54
+ string $ emailAddress = null ,
64
55
array $ subjectAlternativeNames = []
65
56
) {
66
57
Assert::stringNotEmpty ($ commonName , __CLASS__ .'::$commonName expected a non empty string. Got: %s ' );
67
- Assert::nullOrStringNotEmpty ($ countryName , __CLASS__ .'::$countryName expected a string. Got: %s ' );
68
- Assert::nullOrStringNotEmpty ($ stateOrProvinceName , __CLASS__ .'::$stateOrProvinceName expected a string. Got: %s ' );
69
- Assert::nullOrStringNotEmpty ($ localityName , __CLASS__ .'::$localityName expected a string. Got: %s ' );
70
- Assert::nullOrStringNotEmpty ($ organizationName , __CLASS__ .'::$organizationName expected a string. Got: %s ' );
71
- Assert::nullOrStringNotEmpty ($ organizationalUnitName , __CLASS__ .'::$organizationalUnitName expected a string. Got: %s ' );
72
- Assert::nullOrStringNotEmpty ($ emailAddress , __CLASS__ .'::$emailAddress expected a string. Got: %s ' );
73
58
Assert::allStringNotEmpty (
74
59
$ subjectAlternativeNames ,
75
60
__CLASS__ .'::$subjectAlternativeNames expected an array of non empty string. Got: %s '
@@ -85,66 +70,42 @@ public function __construct(
85
70
$ this ->subjectAlternativeNames = array_diff (array_unique ($ subjectAlternativeNames ), [$ commonName ]);
86
71
}
87
72
88
- /**
89
- * @return string
90
- */
91
- public function getCommonName ()
73
+ public function getCommonName (): string
92
74
{
93
75
return $ this ->commonName ;
94
76
}
95
77
96
- /**
97
- * @return string
98
- */
99
- public function getCountryName ()
78
+ public function getCountryName (): ?string
100
79
{
101
80
return $ this ->countryName ;
102
81
}
103
82
104
- /**
105
- * @return string
106
- */
107
- public function getStateOrProvinceName ()
83
+ public function getStateOrProvinceName (): ?string
108
84
{
109
85
return $ this ->stateOrProvinceName ;
110
86
}
111
87
112
- /**
113
- * @return string
114
- */
115
- public function getLocalityName ()
88
+ public function getLocalityName (): ?string
116
89
{
117
90
return $ this ->localityName ;
118
91
}
119
92
120
- /**
121
- * @return string
122
- */
123
- public function getOrganizationName ()
93
+ public function getOrganizationName (): ?string
124
94
{
125
95
return $ this ->organizationName ;
126
96
}
127
97
128
- /**
129
- * @return string
130
- */
131
- public function getOrganizationalUnitName ()
98
+ public function getOrganizationalUnitName (): ?string
132
99
{
133
100
return $ this ->organizationalUnitName ;
134
101
}
135
102
136
- /**
137
- * @return string
138
- */
139
- public function getEmailAddress ()
103
+ public function getEmailAddress (): ?string
140
104
{
141
105
return $ this ->emailAddress ;
142
106
}
143
107
144
- /**
145
- * @return array
146
- */
147
- public function getSubjectAlternativeNames ()
108
+ public function getSubjectAlternativeNames (): array
148
109
{
149
110
return $ this ->subjectAlternativeNames ;
150
111
}
0 commit comments