Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit d8c737b

Browse files
BaranekDvyskocilpavel
authored andcommitted
Using identity comparison instead of equality comparison
1 parent 7e997c7 commit d8c737b

File tree

13 files changed

+41
-41
lines changed

13 files changed

+41
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
- Slightly modified text displayed on WAYF
77
- Updated phpcs ruleset to PSR-12
88
- is_null() changed to === null
9+
- Using identity comparison instead of equality comparison
910

1011
#### Fixed
1112
- Fixed wrong dictionary name in post.php

lib/AdapterLdap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function getMemberGroups($user, $vo)
9292
$groups = [];
9393
foreach ($userWithMembership['memberOf'] as $groupDn) {
9494
$voId = explode('=', explode(',', $groupDn)[1], 2)[1];
95-
if ($voId != $vo->getId()) {
95+
if ($voId !== $vo->getId()) {
9696
continue;
9797
}
9898

lib/AdapterRpc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function getUsersGroupsOnFacility($spEntityId, $userId)
324324

325325
foreach ($usersGroupsOnFacility as $usersGroupOnFacility) {
326326
if (isset($usersGroupOnFacility['attributes'][0]['friendlyName']) &&
327-
$usersGroupOnFacility['attributes'][0]['friendlyName'] == 'voShortName') {
327+
$usersGroupOnFacility['attributes'][0]['friendlyName'] === 'voShortName') {
328328
$uniqueName = $usersGroupOnFacility['attributes'][0]['value'] . ":" . $usersGroupOnFacility['name'];
329329

330330
array_push($groups, new Group(

lib/Auth/Process/ForceAup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,15 @@ public function getVoAups(&$voShortNames)
246246
$vos = [];
247247
foreach ($voShortNames as $voShortName) {
248248
$vo = $this->adapter->getVoByShortName($voShortName);
249-
if ($vo != null) {
249+
if ($vo !== null) {
250250
array_push($vos, $vo);
251251
}
252252
}
253253

254254
$voAups = [];
255255
foreach ($vos as $vo) {
256256
$aups = $this->adapter->getVoAttributes($vo, [$this->perunVoAupAttr])[$this->perunVoAupAttr];
257-
if ($aups != null) {
257+
if ($aups !== null) {
258258
$voAups[$vo->getShortName()] = $aups;
259259
}
260260
}

lib/Auth/Process/ProxyFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function process(&$request)
8383

8484
foreach ($this->filterSPs as $sp) {
8585
$currentSp = $request['Destination']['entityid'];
86-
if ($sp == $currentSp) {
86+
if ($sp === $currentSp) {
8787
Logger::info(
8888
sprintf(
8989
"perun.ProxyFilter: Filtering out filter %s for SP %s",

lib/Auth/Process/StringifyTargetedID.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function process(&$request)
5555
*/
5656
private function stringify($attributeValue)
5757
{
58-
if (is_object($attributeValue) && get_class($attributeValue) == "SAML2\XML\saml\NameID") {
58+
if (is_object($attributeValue) && get_class($attributeValue) === "SAML2\XML\saml\NameID") {
5959
return $attributeValue->NameQualifier . '!' . $attributeValue->SPNameQualifier . '!'
6060
. $attributeValue->value;
6161
} else {

lib/DatabaseCommand.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public static function getAllIdps($tableName)
2727
$greyListTableName = $databaseConnector->getGreyListTableName();
2828
$table = null;
2929
$listOfIdPs = [];
30-
assert($conn != null);
30+
assert($conn !== null);
3131

32-
if ($tableName == self::WHITELIST) {
32+
if ($tableName === self::WHITELIST) {
3333
$table = $whiteListTableName;
34-
} elseif ($tableName == self::GREYLIST) {
34+
} elseif ($tableName === self::GREYLIST) {
3535
$table = $greyListTableName;
3636
}
3737

@@ -74,11 +74,11 @@ public static function getAllEntityIds($tableName)
7474
$greyListTableName = $databaseConnector->getGreyListTableName();
7575
$table = null;
7676
$listOfIdPs = [];
77-
assert($conn != null);
77+
assert($conn !== null);
7878

79-
if ($tableName == self::WHITELIST) {
79+
if ($tableName === self::WHITELIST) {
8080
$table = $whiteListTableName;
81-
} elseif ($tableName == self::GREYLIST) {
81+
} elseif ($tableName === self::GREYLIST) {
8282
$table = $greyListTableName;
8383
}
8484

@@ -117,11 +117,11 @@ public static function insertTolist($tableName, $entityId, $reason)
117117
$whiteListTableName = $databaseConnector->getWhiteListTableName();
118118
$greyListTableName = $databaseConnector->getGreyListTableName();
119119
$table = null;
120-
assert($conn != null);
120+
assert($conn !== null);
121121

122-
if ($tableName == self::WHITELIST) {
122+
if ($tableName === self::WHITELIST) {
123123
$table = $whiteListTableName;
124-
} elseif ($tableName == self::GREYLIST) {
124+
} elseif ($tableName === self::GREYLIST) {
125125
$table = $greyListTableName;
126126
}
127127

@@ -155,11 +155,11 @@ public static function deleteFromList($tableName, $entityId)
155155
$whiteListTableName = $databaseConnector->getWhiteListTableName();
156156
$greyListTableName = $databaseConnector->getGreyListTableName();
157157
$table = null;
158-
assert($conn != null);
158+
assert($conn !== null);
159159

160-
if ($tableName == self::WHITELIST) {
160+
if ($tableName === self::WHITELIST) {
161161
$table = $whiteListTableName;
162-
} elseif ($tableName == self::GREYLIST) {
162+
} elseif ($tableName === self::GREYLIST) {
163163
$table = $greyListTableName;
164164
}
165165

templates/choose-vo-and-group-tpl.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
if ($spMetadata['name']['en']) {
3131
$serviceName = $spMetadata['name']['en'];
3232
}
33-
3433
if ($spMetadata['InformationURL']['en']) {
3534
$informationURL = $spMetadata['InformationURL']['en'];
3635
}

templates/listOfSps-tpl.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,31 +155,31 @@ function printServiceName($service)
155155
function printAttributeValue($attribute, $service, $attr)
156156
{
157157
$value = $attribute['value'];
158-
if (($value === null || empty($value)) && $attribute['type'] != "java.lang.Boolean") {
158+
if (($value === null || empty($value)) && $attribute['type'] !== "java.lang.Boolean") {
159159
return "<td class='center'>&horbar;</td>";
160160
}
161161
$string = '';
162-
if ($attribute['type'] == "java.lang.String" || $attribute['type'] == "java.lang.LargeString") {
162+
if ($attribute['type'] === "java.lang.String" || $attribute['type'] === "java.lang.LargeString") {
163163
if (filter_var($value, FILTER_VALIDATE_URL)) {
164164
$string = "<a class='customLink' href='" . $value . "'>" . $value . "</a>";
165165
} else {
166166
$string = $value;
167167
}
168-
} elseif ($attribute['type'] == "java.lang.Integer") {
168+
} elseif ($attribute['type'] === "java.lang.Integer") {
169169
$string = $value;
170-
} elseif ($attribute['type'] == "java.lang.Boolean") {
170+
} elseif ($attribute['type'] === "java.lang.Boolean") {
171171
if ($value !== null && $value) {
172172
$string = "&#x2714;";
173173
} else {
174174
$string = "&#x2715;";
175175
}
176-
} elseif ($attribute['type'] == "java.util.ArrayList" || $attribute['type'] == "java.lang.LargeArrayList") {
176+
} elseif ($attribute['type'] === "java.util.ArrayList" || $attribute['type'] === "java.lang.LargeArrayList") {
177177
$string = "<ul>";
178178
foreach ($value as $v) {
179179
$string .= "<li>" . $v . "</li>";
180180
}
181181
$string .= "</ul>";
182-
} elseif ($attribute['type'] == "java.util.LinkedHashMap") {
182+
} elseif ($attribute['type'] === "java.util.LinkedHashMap") {
183183
$string = "<ul>";
184184
foreach ($value as $k => $v) {
185185
$string .= "<li>" . $k . " &rarr; " . $v . "</li>";
@@ -195,15 +195,15 @@ function printAttributeValue($attribute, $service, $attr)
195195

196196
function getClass($attribute)
197197
{
198-
if ($attribute['type'] == "java.lang.String") {
198+
if ($attribute['type'] === "java.lang.String") {
199199
return "string";
200-
} elseif ($attribute['type'] == "java.lang.Integer") {
200+
} elseif ($attribute['type'] === "java.lang.Integer") {
201201
return "integer";
202-
} elseif ($attribute['type'] == "java.lang.Boolean") {
202+
} elseif ($attribute['type'] === "java.lang.Boolean") {
203203
return "boolean";
204-
} elseif ($attribute['type'] == "java.util.ArrayList" || $attribute['type'] == "java.util.LargeArrayList") {
204+
} elseif ($attribute['type'] === "java.util.ArrayList" || $attribute['type'] === "java.util.LargeArrayList") {
205205
return "array";
206-
} elseif ($attribute['type'] == "java.util.LinkedHashMap") {
206+
} elseif ($attribute['type'] === "java.util.LinkedHashMap") {
207207
return "map";
208208
} else {
209209
return '';

themes/perun/perun/disco-tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
} else {
9595
$this->includeAtTemplateBase('includes/header.php');
9696

97-
if ($authContextClassRef != null) {
97+
if ($authContextClassRef !== null) {
9898
foreach ($authContextClassRef as $value) {
9999
if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID))
100100
=== URN_CESNET_PROXYIDP_IDPENTITYID) {

0 commit comments

Comments
 (0)