Browse Source

Use strict equality when comparing strings

tags/0.6.0
J. King 6 months ago
parent
commit
81acba90dc

+ 1
- 1
arsse.php View File

@@ -14,7 +14,7 @@ ini_set("memory_limit", "-1");
14 14
 ini_set("max_execution_time", "0");
15 15
 
16 16
 
17
-if (\PHP_SAPI=="cli") {
17
+if (\PHP_SAPI === "cli") {
18 18
     // initialize the CLI; this automatically handles --help and --version
19 19
     $cli = new CLI;
20 20
     // handle other CLI requests; some do not require configuration

+ 1
- 1
lib/AbstractException.php View File

@@ -83,7 +83,7 @@ abstract class AbstractException extends \Exception {
83 83
     ];
84 84
 
85 85
     public function __construct(string $msgID = "", $vars = null, \Throwable $e = null) {
86
-        if ($msgID=="") {
86
+        if ($msgID === "") {
87 87
             $msg = "Exception.unknown";
88 88
             $code = 10000;
89 89
         } else {

+ 1
- 1
lib/CLI.php View File

@@ -74,7 +74,7 @@ USAGE_TEXT;
74 74
                     return (int) !Arsse::$db->feedUpdate((int) $args['<n>'], true);
75 75
                 case "conf save-defaults":
76 76
                     $file = $args['<file>'];
77
-                    $file = ($file=="-" ? null : $file) ?? "php://output";
77
+                    $file = ($file === "-" ? null : $file) ?? "php://output";
78 78
                     return (int) !($this->getConf())->exportFile($file, true);
79 79
                 case "user":
80 80
                     $this->loadConf();

+ 1
- 1
lib/Conf.php View File

@@ -115,7 +115,7 @@ class Conf {
115 115
      * @param string $import_file Optional file to read configuration data from
116 116
      * @see self::importFile() */
117 117
     public function __construct(string $import_file = "") {
118
-        if ($import_file != "") {
118
+        if ($import_file !== "") {
119 119
             $this->importFile($import_file);
120 120
         }
121 121
     }

+ 1
- 1
lib/Database.php View File

@@ -364,7 +364,7 @@ class Database {
364 364
             $parent = (int) $parent;
365 365
         }
366 366
         // if the target parent is the folder itself, this is a circular dependence
367
-        if ($id==$parent) {
367
+        if ($id == $parent) {
368 368
             throw new Db\ExceptionInput("circularDependence", $errData);
369 369
         }
370 370
         // make sure both that the prospective parent exists, and that the it is not one of its children (a circular dependence);

+ 2
- 2
lib/Db/AbstractDriver.php View File

@@ -131,7 +131,7 @@ abstract class AbstractDriver implements Driver {
131 131
                 default:
132 132
                     throw new Exception("savepointStatusUnknown", $this->transStatus[$index]); // @codeCoverageIgnore
133 133
             }
134
-            if ($index==$this->transDepth) {
134
+            if ($index == $this->transDepth) {
135 135
                 // if we've released the topmost savepoint, clean up all prior savepoints which have already been explicitly committed (or rolled back), if any
136 136
                 while ($this->transDepth > 0 && $this->transStatus[$this->transDepth] > self::TR_PEND) {
137 137
                     array_pop($this->transStatus);
@@ -185,7 +185,7 @@ abstract class AbstractDriver implements Driver {
185 185
                 default:
186 186
                     throw new Exception("savepointStatusUnknown", $this->transStatus[$index]); // @codeCoverageIgnore
187 187
             }
188
-            if ($index==$this->transDepth) {
188
+            if ($index == $this->transDepth) {
189 189
                 while ($this->transDepth > 0 && $this->transStatus[$this->transDepth] > self::TR_PEND) {
190 190
                     array_pop($this->transStatus);
191 191
                     $this->transDepth--;

+ 4
- 4
lib/Db/MySQL/Driver.php View File

@@ -29,11 +29,11 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
29 29
             throw new Exception("extMissing", static::driverName()); // @codeCoverageIgnore
30 30
         }
31 31
         $host = Arsse::$conf->dbMySQLHost;
32
-        if ($host[0] == "/") {
32
+        if ($host[0] === "/") {
33 33
             // host is a Unix socket
34 34
             $socket = $host;
35 35
             $host = "";
36
-        } elseif(substr($host, 0, 9) == "\\\\.\\pipe\\") {
36
+        } elseif(substr($host, 0, 9) === "\\\\.\\pipe\\") {
37 37
             // host is a Windows named piple
38 38
             $socket = substr($host, 10);
39 39
             $host = "";
@@ -183,8 +183,8 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
183 183
 
184 184
     protected function dispatch(string $query) {
185 185
         $r = $this->db->query($query);
186
-        if ($this->db->sqlstate != "00000") {
187
-            if ($this->db->sqlstate == "HY000") {
186
+        if ($this->db->sqlstate !== "00000") {
187
+            if ($this->db->sqlstate === "HY000") {
188 188
                 list($excClass, $excMsg, $excData) = $this->buildEngineException($this->db->errno, $this->db->error);
189 189
             } else {
190 190
                 list($excClass, $excMsg, $excData) = $this->buildStandardException($this->db->sqlstate, $this->db->error);

+ 3
- 3
lib/Db/MySQL/Statement.php View File

@@ -65,8 +65,8 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
65 65
         $this->types = "";
66 66
         $this->values = [];
67 67
         // check for errors
68
-        if ($this->st->sqlstate != "00000") {
69
-            if ($this->st->sqlstate == "HY000") {
68
+        if ($this->st->sqlstate !== "00000") {
69
+            if ($this->st->sqlstate === "HY000") {
70 70
                 list($excClass, $excMsg, $excData) = $this->buildEngineException($this->st->errno, $this->st->error);
71 71
             } else {
72 72
                 list($excClass, $excMsg, $excData) = $this->buildStandardException($this->st->sqlstate, $this->st->error);
@@ -98,7 +98,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
98 98
         $out = "";
99 99
         for ($b = 1; $b < sizeof($query); $b++) {
100 100
             $a = $b - 1;
101
-            $mark = (($types[$a] ?? "") == "datetime") ? "cast(? as datetime(0))" : "?";
101
+            $mark = (($types[$a] ?? "") === "datetime") ? "cast(? as datetime(0))" : "?";
102 102
             $out .= $query[$a].$mark;
103 103
         }
104 104
         $out .= array_pop($query);

+ 1
- 1
lib/Db/PDOError.php View File

@@ -15,7 +15,7 @@ trait PDOError {
15 15
         } else {
16 16
             $err = $this->db->errorInfo();
17 17
         }
18
-        if ($err[0]=="HY000") {
18
+        if ($err[0] === "HY000") {
19 19
             return static::buildEngineException($err[1], $err[2]);
20 20
         } else {
21 21
             return static::buildStandardException($err[0], $err[2]);

+ 10
- 10
lib/Feed.php View File

@@ -135,19 +135,19 @@ class Feed {
135 135
             // id doesn't exist.
136 136
             $content = $f->content.$f->enclosureUrl.$f->enclosureType;
137 137
             // if the item link URL and item title are both equal to the feed link URL, then the item has neither a link URL nor a title
138
-            if ($f->url==$feed->siteUrl && $f->title==$feed->siteUrl) {
138
+            if ($f->url === $feed->siteUrl && $f->title === $feed->siteUrl) {
139 139
                 $f->urlTitleHash = "";
140 140
             } else {
141 141
                 $f->urlTitleHash = hash('sha256', $f->url.$f->title);
142 142
             }
143 143
             // if the item link URL is equal to the feed link URL, it has no link URL; if there is additionally no content, these should not be hashed
144
-            if (!strlen($content) && $f->url==$feed->siteUrl) {
144
+            if (!strlen($content) && $f->url === $feed->siteUrl) {
145 145
                 $f->urlContentHash = "";
146 146
             } else {
147 147
                 $f->urlContentHash = hash('sha256', $f->url.$content);
148 148
             }
149 149
             // if the item's title is the same as its link URL, it has no title; if there is additionally no content, these should not be hashed
150
-            if (!strlen($content) && $f->title==$f->url) {
150
+            if (!strlen($content) && $f->title === $f->url) {
151 151
                 $f->titleContentHash = "";
152 152
             } else {
153 153
                 $f->titleContentHash = hash('sha256', $f->title.$content);
@@ -215,15 +215,15 @@ class Feed {
215 215
         foreach ($items as $item) {
216 216
             foreach ($out as $index => $check) {
217 217
                 // if the two items both have IDs and they differ, they do not match, regardless of hashes
218
-                if ($item->id && $check->id && $item->id != $check->id) {
218
+                if ($item->id && $check->id && $item->id !== $check->id) {
219 219
                     continue;
220 220
                 }
221 221
                 // if the two items have the same ID or any one hash matches, they are two versions of the same item
222 222
                 if (
223
-                    ($item->id && $check->id && $item->id == $check->id) ||
224
-                    ($item->urlTitleHash     && $item->urlTitleHash     == $check->urlTitleHash)      ||
225
-                    ($item->urlContentHash   && $item->urlContentHash   == $check->urlContentHash)    ||
226
-                    ($item->titleContentHash && $item->titleContentHash == $check->titleContentHash)
223
+                    ($item->id && $check->id && $item->id === $check->id) ||
224
+                    ($item->urlTitleHash     && $item->urlTitleHash     === $check->urlTitleHash)      ||
225
+                    ($item->urlContentHash   && $item->urlContentHash   === $check->urlContentHash)    ||
226
+                    ($item->titleContentHash && $item->titleContentHash === $check->titleContentHash)
227 227
                 ) {
228 228
                     if (// because newsfeeds are usually order newest-first, the later item should only be used if...
229 229
                         // the later item has an update date and the existing item does not
@@ -346,9 +346,9 @@ class Feed {
346 346
                     $diff = $dates[$a] - $dates[$a+1];
347 347
                     $offsets[] = $this->normalizeDateDiff($diff);
348 348
                 }
349
-                if ($offsets[0]==$offsets[1] || $offsets[0]==$offsets[2]) {
349
+                if ($offsets[0] === $offsets[1] || $offsets[0] === $offsets[2]) {
350 350
                     return $now->modify("+".$offsets[0]);
351
-                } elseif ($offsets[1]==$offsets[2]) {
351
+                } elseif ($offsets[1] === $offsets[2]) {
352 352
                     return $now->modify("+".$offsets[1]);
353 353
                 } else {
354 354
                     return $now->modify("+ 1 hour");

+ 9
- 9
lib/Lang.php View File

@@ -37,14 +37,14 @@ class Lang {
37 37
             $this->checkRequirements();
38 38
         }
39 39
         // if requesting the same locale as already wanted, just return (but load first if we've requested an immediate load)
40
-        if ($locale==$this->wanted) {
40
+        if ($locale === $this->wanted) {
41 41
             if ($immediate && !$this->synched) {
42 42
                 $this->load();
43 43
             }
44 44
             return $locale;
45 45
         }
46 46
         // if we've requested a locale other than the null locale, fetch the list of available files and find the closest match e.g. en_ca_somedialect -> en_ca
47
-        if ($locale != "") {
47
+        if ($locale !== "") {
48 48
             $list = $this->listFiles();
49 49
             // if the default locale is unavailable, this is (for now) an error
50 50
             if (!in_array(self::DEFAULT, $list)) {
@@ -81,7 +81,7 @@ class Lang {
81 81
             try {
82 82
                 $this->load();
83 83
             } catch (Lang\Exception $e) {
84
-                if ($this->wanted==self::DEFAULT) {
84
+                if ($this->wanted === self::DEFAULT) {
85 85
                     $this->set("", true);
86 86
                 } else {
87 87
                     throw $e;
@@ -112,14 +112,14 @@ class Lang {
112 112
         $out = [];
113 113
         $files = $this->listFiles();
114 114
         foreach ($files as $tag) {
115
-            $out[$tag] = \Locale::getDisplayName($tag, ($locale=="") ? $tag : $locale);
115
+            $out[$tag] = \Locale::getDisplayName($tag, ($locale === "") ? $tag : $locale);
116 116
         }
117 117
         return $out;
118 118
     }
119 119
 
120 120
     public function match(string $locale, array $list = null): string {
121 121
         $list = $list ?? $this->listFiles();
122
-        $default = ($this->locale=="") ? self::DEFAULT : $this->locale;
122
+        $default = ($this->locale === "") ? self::DEFAULT : $this->locale;
123 123
         return \Locale::lookup($list, $locale, true, $default);
124 124
     }
125 125
 
@@ -155,7 +155,7 @@ class Lang {
155 155
             $this->checkRequirements();
156 156
         }
157 157
         // if we've requested no locale (""), just load the fallback strings and return
158
-        if ($this->wanted=="") {
158
+        if ($this->wanted === "") {
159 159
             $this->strings = self::REQUIRED;
160 160
             $this->locale = $this->wanted;
161 161
             $this->synched = true;
@@ -169,7 +169,7 @@ class Lang {
169 169
             $tag = array_pop($tags);
170 170
         }
171 171
         // include the default locale as the base if the most general locale requested is not the default
172
-        if ($tag != self::DEFAULT) {
172
+        if ($tag !== self::DEFAULT) {
173 173
             $files[] = self::DEFAULT;
174 174
         }
175 175
         // save the list of files to be loaded for later reference
@@ -177,14 +177,14 @@ class Lang {
177 177
         // reduce the list of files to be loaded to the minimum necessary (e.g. if we go from "fr" to "fr_ca", we don't need to load "fr" or "en")
178 178
         $files = [];
179 179
         foreach ($loaded as $file) {
180
-            if ($file==$this->locale) {
180
+            if ($file === $this->locale) {
181 181
                 break;
182 182
             }
183 183
             $files[] = $file;
184 184
         }
185 185
         // if we need to load all files, start with the fallback strings
186 186
         $strings = [];
187
-        if ($files==$loaded) {
187
+        if ($files === $loaded) {
188 188
             $strings[] = self::REQUIRED;
189 189
         } else {
190 190
             // otherwise start with the strings we already have if we're going from e.g. "fr" to "fr_ca"

+ 2
- 2
lib/Misc/Date.php View File

@@ -13,9 +13,9 @@ class Date {
13 13
             return null;
14 14
         }
15 15
         $out = ValueInfo::normalize($date, ValueInfo::T_STRING, null, $outFormat);
16
-        if ($outFormat=="unix") {
16
+        if ($outFormat === "unix") {
17 17
             $out = (int) $out;
18
-        } elseif ($outFormat=="float") {
18
+        } elseif ($outFormat === "float") {
19 19
             $out = (float) $out;
20 20
         }
21 21
         return $out;

+ 5
- 5
lib/Misc/ValueInfo.php View File

@@ -157,7 +157,7 @@ class ValueInfo {
157 157
                         return $out;
158 158
                     } else {
159 159
                         $out = sprintf("%F", $value);
160
-                        return substr($out, -2)==".0" ? (string) (int) $out : $out;
160
+                        return preg_match("/\.0{1,}$/", $out) ? (string) (int) $out : $out;
161 161
                     }
162 162
                 }
163 163
                 $info = self::str($value);
@@ -189,7 +189,7 @@ class ValueInfo {
189 189
                     try {
190 190
                         if (!is_null($dateInFormat)) {
191 191
                             $out = false;
192
-                            if ($dateInFormat=="microtime") {
192
+                            if ($dateInFormat === "microtime") {
193 193
                                 // PHP is not able to correctly handle the output of microtime() as the input of DateTime::createFromFormat(), so we fudge it to look like a float
194 194
                                 if (preg_match("<^0\.\d{6}00 \d+$>", $value)) {
195 195
                                     $value = substr($value, 11).".".substr($value, 2, 6);
@@ -198,9 +198,9 @@ class ValueInfo {
198 198
                                 }
199 199
                             }
200 200
                             $f = isset(self::DATE_FORMATS[$dateInFormat]) ? self::DATE_FORMATS[$dateInFormat][0] : $dateInFormat;
201
-                            if ($dateInFormat=="iso8601" || $dateInFormat=="iso8601m") {
201
+                            if ($dateInFormat === "iso8601" || $dateInFormat === "iso8601m") {
202 202
                                 // DateTimeImmutable::createFromFormat() doesn't provide one catch-all for ISO 8601 timezone specifiers, so we try all of them till one works
203
-                                if ($dateInFormat=="iso8601m") {
203
+                                if ($dateInFormat === "iso8601m") {
204 204
                                     $f2 = self::DATE_FORMATS["iso8601"][0];
205 205
                                     $zones = [$f."", $f."\Z", $f."P", $f."O", $f2."", $f2."\Z", $f2."P", $f2."O"];
206 206
                                 } else {
@@ -355,7 +355,7 @@ class ValueInfo {
355 355
         $out = filter_var($value, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE);
356 356
         if (is_null($out) && (ValueInfo::int($value) & ValueInfo::VALID)) {
357 357
             $out = (int) filter_var($value, \FILTER_VALIDATE_FLOAT);
358
-            return ($out==1 || $out==0) ? (bool) $out : $default;
358
+            return ($out == 1 || $out == 0) ? (bool) $out : $default;
359 359
         }
360 360
         return !is_null($out) ? $out : $default;
361 361
     }

+ 11
- 11
lib/REST.php View File

@@ -76,7 +76,7 @@ class REST {
76 76
             // fetch the correct handler
77 77
             $drv = $this->getHandler($class);
78 78
             // generate a response
79
-            if ($req->getMethod()=="HEAD") {
79
+            if ($req->getMethod() === "HEAD") {
80 80
                 // if the request is a HEAD request, we act exactly as if it were a GET request, and simply remove the response body later
81 81
                 $res = $drv->dispatch($req->withMethod("GET"));
82 82
             } else {
@@ -108,7 +108,7 @@ class REST {
108 108
             if (strpos($url, $api['match'])===0) {
109 109
                 // if it matches, perform a more rigorous match and then strip off any defined prefix
110 110
                 $pattern = "<^".preg_quote($api['match'])."([/\?#]|$)>";
111
-                if ($url==$api['match'] || in_array(substr($api['match'], -1, 1), ["/", "?", "#"]) || preg_match($pattern, $url)) {
111
+                if ($url === $api['match'] || in_array(substr($api['match'], -1, 1), ["/", "?", "#"]) || preg_match($pattern, $url)) {
112 112
                     $target = substr($url, strlen($api['strip']));
113 113
                 } else {
114 114
                     // if the match fails we are not able to handle the request
@@ -152,13 +152,13 @@ class REST {
152 152
 
153 153
     public function normalizeResponse(ResponseInterface $res, RequestInterface $req = null): ResponseInterface {
154 154
         // if the response code is 401, issue an HTTP authentication challenge
155
-        if ($res->getStatusCode()==401) {
155
+        if ($res->getStatusCode() == 401) {
156 156
             $res = $this->challenge($res);
157 157
         }
158 158
         // set or clear the Content-Length header field
159 159
         $body = $res->getBody();
160 160
         $bodySize = $body->getSize();
161
-        if ($bodySize || $res->getStatusCode()==200) {
161
+        if ($bodySize || $res->getStatusCode() == 200) {
162 162
             // if there is a message body or the response is 200, make sure Content-Length is included
163 163
             $res = $res->withHeader("Content-Length", (string) $bodySize);
164 164
         } else {
@@ -166,7 +166,7 @@ class REST {
166 166
             $res = $res->withoutHeader("Content-Length");
167 167
         }
168 168
         // if the response is to a HEAD request, the body should be omitted
169
-        if ($req && $req->getMethod()=="HEAD") {
169
+        if ($req && $req->getMethod() === "HEAD") {
170 170
             $res = new EmptyResponse($res->getStatusCode(), $res->getHeaders());
171 171
         }
172 172
         // if an Allow header field is present, normalize it
@@ -190,7 +190,7 @@ class REST {
190 190
     }
191 191
 
192 192
     public function corsApply(ResponseInterface $res, RequestInterface $req = null): ResponseInterface {
193
-        if ($req && $req->getMethod()=="OPTIONS") {
193
+        if ($req && $req->getMethod() === "OPTIONS") {
194 194
             if ($res->hasHeader("Allow")) {
195 195
                 $res = $res->withHeader("Access-Control-Allow-Methods", $res->getHeaderLine("Allow"));
196 196
             }
@@ -211,12 +211,12 @@ class REST {
211 211
         if ($allowed) {
212 212
             // continue if the request has exactly one Origin header
213 213
             $origin = $req->getHeader("Origin");
214
-            if (sizeof($origin)==1) {
214
+            if (sizeof($origin) == 1) {
215 215
                 // continue if the origin is syntactically valid
216 216
                 $origin = $this->corsNormalizeOrigin($origin[0]);
217 217
                 if ($origin) {
218 218
                     // the special "null" origin should not be matched by the wildcard origin
219
-                    $null = ($origin=="null");
219
+                    $null = ($origin === "null");
220 220
                     // pad all strings for simpler comparison
221 221
                     $allowed = " ".$allowed." ";
222 222
                     $denied = " ".$denied." ";
@@ -243,7 +243,7 @@ class REST {
243 243
 
244 244
     public function corsNormalizeOrigin(string $origin, array $ports = null): string {
245 245
         $origin = trim($origin);
246
-        if ($origin=="null") {
246
+        if ($origin === "null") {
247 247
             // if the origin is the special value "null", use it
248 248
             return "null";
249 249
         }
@@ -259,7 +259,7 @@ class REST {
259 259
                 // if the normalized port contains anything but numbers, or the scheme does not follow the generic URL syntax, the origin is invalid
260 260
                 return "";
261 261
             }
262
-            if ($host[0]=="[") {
262
+            if ($host[0] === "[") {
263 263
                 // if the host appears to be an IPv6 address, validate it
264 264
                 $host = rawurldecode(substr($host, 1, strlen($host) - 2));
265 265
                 if (!filter_var($host, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
@@ -279,7 +279,7 @@ class REST {
279 279
             if (strlen($port)) {
280 280
                 $port = (int) substr($port, 1);
281 281
                 $list = array_merge($ports ?? [], self::DEFAULT_PORTS);
282
-                if (isset($list[$scheme]) && $port==$list[$scheme]) {
282
+                if (isset($list[$scheme]) && $port == $list[$scheme]) {
283 283
                     $port = "";
284 284
                 } else {
285 285
                     $port = ":".$port;

+ 1
- 1
lib/REST/AbstractHandler.php View File

@@ -28,7 +28,7 @@ abstract class AbstractHandler implements Handler {
28 28
     protected function fieldMapTypes(array $data, array $map, string $dateFormat = "sql"): array {
29 29
         foreach ($map as $key => $type) {
30 30
             if (array_key_exists($key, $data)) {
31
-                if ($type=="datetime" && $dateFormat != "sql") {
31
+                if ($type === "datetime" && $dateFormat !== "sql") {
32 32
                     $data[$key] = Date::transform($data[$key], $dateFormat, "sql");
33 33
                 } else {
34 34
                     settype($data[$key], $type);

+ 6
- 6
lib/REST/NextCloudNews/V1_2.php View File

@@ -88,7 +88,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
88 88
         // explode and normalize the URL path
89 89
         $target = new Target($req->getRequestTarget());
90 90
         // handle HTTP OPTIONS requests
91
-        if ($req->getMethod()=="OPTIONS") {
91
+        if ($req->getMethod() === "OPTIONS") {
92 92
             return $this->handleHTTPOptions((string) $target);
93 93
         }
94 94
         // normalize the input
@@ -104,7 +104,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
104 104
                 return new EmptyResponse(415, ['Accept' => "application/json"]);
105 105
             }
106 106
             $data = @json_decode($data, true);
107
-            if (json_last_error() != \JSON_ERROR_NONE) {
107
+            if (json_last_error() !== \JSON_ERROR_NONE) {
108 108
                 // if the body could not be parsed as JSON, return "400 Bad Request"
109 109
                 return new EmptyResponse(400);
110 110
             }
@@ -612,7 +612,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
612 612
         $c = new Context;
613 613
         $c->edition((int) $url[1]);
614 614
         // determine whether to mark read or unread
615
-        $set = ($url[2]=="read");
615
+        $set = ($url[2] === "read");
616 616
         try {
617 617
             Arsse::$db->articleMark(Arsse::$user->id, ['read' => $set], $c);
618 618
         } catch (ExceptionInput $e) {
@@ -628,7 +628,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
628 628
         $c = new Context;
629 629
         $c->article((int) $url[2]);
630 630
         // determine whether to mark read or unread
631
-        $set = ($url[3]=="star");
631
+        $set = ($url[3] ==="star");
632 632
         try {
633 633
             Arsse::$db->articleMark(Arsse::$user->id, ['starred' => $set], $c);
634 634
         } catch (ExceptionInput $e) {
@@ -641,7 +641,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
641 641
     // mark an array of articles as read
642 642
     protected function articleMarkReadMulti(array $url, array $data): ResponseInterface {
643 643
         // determine whether to mark read or unread
644
-        $set = ($url[1]=="read");
644
+        $set = ($url[1] ==="read");
645 645
         // initialize the matching context
646 646
         $c = new Context;
647 647
         $c->editions($data['items'] ?? []);
@@ -655,7 +655,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
655 655
     // mark an array of articles as starred
656 656
     protected function articleMarkStarredMulti(array $url, array $data): ResponseInterface {
657 657
         // determine whether to mark starred or unstarred
658
-        $set = ($url[1]=="star");
658
+        $set = ($url[1] ==="star");
659 659
         // initialize the matching context
660 660
         $c = new Context;
661 661
         $c->articles(array_column($data['items'] ?? [], "guidHash"));

+ 7
- 7
lib/REST/Target.php View File

@@ -31,9 +31,9 @@ class Target {
31 31
                 } else {
32 32
                     continue;
33 33
                 }
34
-            } elseif ($segment==".") {
34
+            } elseif ($segment === ".") {
35 35
                 $path[] = "%2E";
36
-            } elseif ($segment=="..") {
36
+            } elseif ($segment === "..") {
37 37
                 $path[] = "%2E%2E";
38 38
             } else {
39 39
                 $path[] = rawurlencode(ValueInfo::normalize($segment, ValueInfo::T_STRING));
@@ -86,7 +86,7 @@ class Target {
86 86
         // note that the function assumes any fragment identifier or query has already been stripped off
87 87
         // syntax-based normalization is applied to the path segments (see RFC 3986 sec. 6.2.2)
88 88
         // duplicate slashes are NOT collapsed
89
-        if (substr($target, 0, 1)=="/") {
89
+        if (substr($target, 0, 1) === "/") {
90 90
             // if the path starts with a slash, strip it off
91 91
             $target = substr($target, 1);
92 92
         } else {
@@ -96,7 +96,7 @@ class Target {
96 96
         if (!strlen($target)) {
97 97
             // if the target is an empty string, this is an index target
98 98
             $this->index = true;
99
-        } elseif (substr($target, -1, 1)=="/") {
99
+        } elseif (substr($target, -1, 1) === "/") {
100 100
             // if the path ends in a slash, this is an index target and the slash should be stripped off
101 101
             $this->index = true;
102 102
             $target = substr($target, 0, strlen($target) -1);
@@ -107,11 +107,11 @@ class Target {
107 107
             $out = [];
108 108
             // resolve relative path segments and decode each retained segment
109 109
             foreach ($target as $index => $segment) {
110
-                if ($segment==".") {
110
+                if ($segment === ".") {
111 111
                     // self-referential segments can be ignored
112 112
                     continue;
113
-                } elseif ($segment=="..") {
114
-                    if ($index==0) {
113
+                } elseif ($segment === "..") {
114
+                    if ($index == 0) {
115 115
                         // if the first path segment refers to its parent (which we don't know about) we cannot output a correct path, so we do the best we can
116 116
                         $out[] = null;
117 117
                     } else {

+ 14
- 14
lib/REST/TinyTinyRSS/API.php View File

@@ -96,7 +96,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
96 96
             // reject paths other than the index
97 97
             return new EmptyResponse(404);
98 98
         }
99
-        if ($req->getMethod()=="OPTIONS") {
99
+        if ($req->getMethod() === "OPTIONS") {
100 100
             // respond to OPTIONS rquests; the response is a fib, as we technically accept any type or method
101 101
             return new EmptyResponse(204, [
102 102
                 'Allow'  => "POST",
@@ -107,7 +107,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
107 107
         if ($data) {
108 108
             // only JSON entities are allowed, but Content-Type is ignored, as is request method
109 109
             $data = @json_decode($data, true);
110
-            if (json_last_error() != \JSON_ERROR_NONE || !is_array($data)) {
110
+            if (json_last_error() !== \JSON_ERROR_NONE || !is_array($data)) {
111 111
                 return new Response(self::FATAL_ERR);
112 112
             }
113 113
             try {
@@ -125,7 +125,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
125 125
                     // otherwise if HTTP authentication failed or is required, deny access at the HTTP level
126 126
                     return new EmptyResponse(401);
127 127
                 }
128
-                if (strtolower((string) $data['op']) != "login") {
128
+                if (strtolower((string) $data['op']) !== "login") {
129 129
                     // unless logging in, a session identifier is required
130 130
                     $this->resumeSession((string) $data['sid']);
131 131
                 }
@@ -432,7 +432,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
432 432
     protected function enumerateFeeds(array $subs, $parent = null): array {
433 433
         $out = [];
434 434
         foreach ($subs as $s) {
435
-            if ($s['folder'] != $parent) {
435
+            if ($s['folder'] !== $parent) {
436 436
                 continue;
437 437
             }
438 438
             $out[] = [
@@ -455,7 +455,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
455 455
         $out = [];
456 456
         $feedTotal = 0;
457 457
         foreach ($cats as $c) {
458
-            if ($c['parent'] != $parent || (!$all && !($c['children'] + $c['feeds']))) {
458
+            if ($c['parent'] !== $parent || (!$all && !($c['children'] + $c['feeds']))) {
459 459
                 // if the category is the wrong level, or if it's empty and we're not including empties, skip it
460 460
                 continue;
461 461
             }
@@ -546,7 +546,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
546 546
         // transform the result and return
547 547
         $out = [];
548 548
         for ($a = 0; $a < sizeof($cats); $a++) {
549
-            if ($cats[$a]['id']==-2) {
549
+            if ($cats[$a]['id'] == -2) {
550 550
                 // the Labels category has its unread count as a string in TTRSS (don't ask me why)
551 551
                 settype($cats[$a]['unread'], "string");
552 552
             }
@@ -573,7 +573,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
573 573
                     // retrieve the ID of the existing folder; duplicating a folder silently returns the existing one
574 574
                     $folders = Arsse::$db->folderList(Arsse::$user->id, $in['parent'], false);
575 575
                     foreach ($folders as $folder) {
576
-                        if ($folder['name']==$in['name']) {
576
+                        if ($folder['name'] === $in['name']) {
577 577
                             return (string) ((int) $folder['id']); // output is a string in TTRSS
578 578
                         }
579 579
                     }
@@ -657,7 +657,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
657 657
         $subs = [];
658 658
         $count = 0;
659 659
         // if the category is the special Labels category or the special All category (which includes labels), add labels to the list
660
-        if ($cat==self::CAT_ALL || $cat==self::CAT_LABELS) {
660
+        if ($cat == self::CAT_ALL || $cat == self::CAT_LABELS) {
661 661
             // NOTE: unused labels are not included
662 662
             foreach (Arsse::$db->labelList($user, false) as $l) {
663 663
                 if ($unread && !$l['unread']) {
@@ -672,7 +672,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
672 672
             }
673 673
         }
674 674
         // if the category is the special Special (!) category or the special All category (which includes "special" feeds), add those feeds to the list
675
-        if ($cat==self::CAT_ALL || $cat==self::CAT_SPECIAL) {
675
+        if ($cat == self::CAT_ALL || $cat == self::CAT_SPECIAL) {
676 676
             // gather some statistics
677 677
             $starred = Arsse::$db->articleStarred($user)['unread'];
678 678
             $fresh = Arsse::$db->articleCount($user, (new Context)->unread(true)->modifiedSince(Date::sub("PT24H")));
@@ -754,10 +754,10 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
754 754
             }
755 755
         }
756 756
         try {
757
-            if ($cat==self::CAT_NOT_SPECIAL || $cat==self::CAT_ALL) {
757
+            if ($cat == self::CAT_NOT_SPECIAL || $cat == self::CAT_ALL) {
758 758
                 // if the "All" or "Not Special" categories were selected this returns all subscription, to any depth
759 759
                 $subs = Arsse::$db->subscriptionList($user, null, true);
760
-            } elseif ($cat==self::CAT_UNCATEGORIZED) {
760
+            } elseif ($cat == self::CAT_UNCATEGORIZED) {
761 761
                 // the "Uncategorized" special category returns subscriptions in the root, without going deeper
762 762
                 $subs = Arsse::$db->subscriptionList($user, null, false);
763 763
             } else {
@@ -1005,7 +1005,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
1005 1005
             // try to rename the folder
1006 1006
             Arsse::$db->labelPropertiesSet(Arsse::$user->id, $id, ['name' => $name]);
1007 1007
         } catch (ExceptionInput $e) {
1008
-            if ($e->getCode()==10237) {
1008
+            if ($e->getCode() == 10237) {
1009 1009
                 // if the supplied ID was invalid, report an error; other errors are to be ignored
1010 1010
                 throw new Exception("INCORRECT_USAGE");
1011 1011
             }
@@ -1352,12 +1352,12 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
1352 1352
             $data['skip'] = null;
1353 1353
         }
1354 1354
         if ($data['include_header']) {
1355
-            if ($data['skip'] > 0 && $data['order_by'] != "date_reverse") {
1355
+            if ($data['skip'] > 0 && $data['order_by'] !== "date_reverse") {
1356 1356
                 // when paginating the header returns the latest ("first") item ID in the full list; we get this ID here
1357 1357
                 $data['skip'] = 0;
1358 1358
                 $data['limit'] = 1;
1359 1359
                 $firstID = ($this->fetchArticles($data, ["id"])->getRow() ?? ['id' => 0])['id'];
1360
-            } elseif ($data['order_by']=="date_reverse") {
1360
+            } elseif ($data['order_by'] === "date_reverse") {
1361 1361
                 // the "date_reverse" sort order doesn't get a first ID because it's meaningless for ascending-order pagination (pages doesn't go stale)
1362 1362
                 $firstID = 0;
1363 1363
             } else {

+ 1
- 1
lib/REST/TinyTinyRSS/Icon.php View File

@@ -23,7 +23,7 @@ class Icon extends \JKingWeb\Arsse\REST\AbstractHandler {
23 23
             // otherwise if HTTP authentication failed or did not occur when it is required, deny access at the HTTP level
24 24
             return new Response(401);
25 25
         }
26
-        if ($req->getMethod() != "GET") {
26
+        if ($req->getMethod() !== "GET") {
27 27
             // only GET requests are allowed
28 28
             return new Response(405, ['Allow' => "GET"]);
29 29
         } elseif (!preg_match("<^(\d+)\.ico$>", $req->getRequestTarget(), $match) || !((int) $match[1])) {

+ 3
- 3
tests/cases/CLI/TestCLI.php View File

@@ -160,8 +160,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
160 160
         Arsse::$user = $this->createMock(User::class);
161 161
         Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) {
162 162
             return (
163
-                ($user == "john.doe@example.com" && $pass == "secret") ||
164
-                ($user == "jane.doe@example.com" && $pass == "superman")
163
+                ($user === "john.doe@example.com" && $pass === "secret") ||
164
+                ($user === "jane.doe@example.com" && $pass === "superman")
165 165
             );
166 166
         }));
167 167
         $this->assertConsole($this->cli, $cmd, $exitStatus, $output);
@@ -182,7 +182,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
182 182
         // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead
183 183
         Arsse::$user = $this->createMock(User::class);
184 184
         Arsse::$user->method("remove")->will($this->returnCallback(function($user) {
185
-            if ($user == "john.doe@example.com") {
185
+            if ($user === "john.doe@example.com") {
186 186
                 return true;
187 187
             }
188 188
             throw new \JKingWeb\Arsse\User\Exception("doesNotExist");

+ 1
- 1
tests/cases/Db/BaseDriver.php View File

@@ -359,7 +359,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest {
359 359
         // SQLite is unaffected by the removal of the metadata table; other backends are
360 360
         // in neither case should a query for the schema version produce an error, however
361 361
         $this->exec("DROP TABLE IF EXISTS arsse_meta");
362
-        $exp = (static::$dbInfo->backend == "SQLite 3") ? 2 : 0;
362
+        $exp = (static::$dbInfo->backend === "SQLite 3") ? 2 : 0;
363 363
         $this->assertSame($exp, $this->drv->schemaVersion());
364 364
     }
365 365
 

+ 4
- 4
tests/cases/Db/BaseStatement.php View File

@@ -58,7 +58,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
58 58
 
59 59
     /** @dataProvider provideBindings */
60 60
     public function testBindATypedValue($value, string $type, string $exp) {
61
-        if ($exp=="null") {
61
+        if ($exp === "null") {
62 62
             $query = "SELECT (? is null) as pass";
63 63
         } else {
64 64
             $query = "SELECT ($exp = ?) as pass";
@@ -75,7 +75,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
75 75
         if (in_array(static::$implementation, ["PostgreSQL", "PDO PostgreSQL"])) {
76 76
             $this->markTestSkipped("Correct handling of binary data with PostgreSQL is currently unknown");
77 77
         }
78
-        if ($exp=="null") {
78
+        if ($exp === "null") {
79 79
             $query = "SELECT (? is null) as pass";
80 80
         } else {
81 81
             $query = "SELECT ($exp = ?) as pass";
@@ -275,7 +275,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
275 275
         ];
276 276
         foreach ($tests as $index => list($value, $type, $exp)) {
277 277
             $t = preg_replace("<^strict >", "", $type);
278
-            $exp = ($exp=="null") ? $exp : $this->decorateTypeSyntax($exp, $t);
278
+            $exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t);
279 279
             yield $index => [$value, $type, $exp];
280 280
         }
281 281
     }
@@ -326,7 +326,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
326 326
         ];
327 327
         foreach ($tests as $index => list($value, $type, $exp)) {
328 328
             $t = preg_replace("<^strict >", "", $type);
329
-            $exp = ($exp=="null") ? $exp : $this->decorateTypeSyntax($exp, $t);
329
+            $exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t);
330 330
             yield $index => [$value, $type, $exp];
331 331
         }
332 332
     }

+ 1
- 1
tests/cases/Db/MySQLPDO/TestStatement.php View File

@@ -20,7 +20,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
20 20
     protected function decorateTypeSyntax(string $value, string $type): string {
21 21
         switch ($type) {
22 22
             case "float":
23
-                return (substr($value, -2)==".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
23
+                return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
24 24
             case "string":
25 25
                 if (preg_match("<^char\((\d+)\)$>", $value, $match)) {
26 26
                     return "'".\IntlChar::chr((int) $match[1])."'";

+ 1
- 1
tests/cases/Db/PostgreSQL/TestCreation.php View File

@@ -25,7 +25,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
25 25
         $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0);
26 26
         $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'";
27 27
         $act = Driver::makeConnectionString($pdo, $user, $pass, $db, $host, $port, $service);
28
-        if ($act==$postfix) {
28
+        if ($act === $postfix) {
29 29
             $this->assertSame($exp, "");
30 30
         } else {
31 31
             $test = substr($act, 0, strlen($act) - (strlen($postfix) + 1));

+ 1
- 1
tests/cases/Db/PostgreSQL/TestStatement.php View File

@@ -20,7 +20,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
20 20
     protected function decorateTypeSyntax(string $value, string $type): string {
21 21
         switch ($type) {
22 22
             case "float":
23
-                return (substr($value, -2)==".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
23
+                return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
24 24
             case "string":
25 25
                 if (preg_match("<^char\((\d+)\)$>", $value, $match)) {
26 26
                     return "U&'\\+".str_pad(dechex((int) $match[1]), 6, "0", \STR_PAD_LEFT)."'";

+ 1
- 1
tests/cases/Db/PostgreSQLPDO/TestCreation.php View File

@@ -25,7 +25,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest {
25 25
         $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0);
26 26
         $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'";
27 27
         $act = Driver::makeConnectionString($pdo, $user, $pass, $db, $host, $port, $service);
28
-        if ($act==$postfix) {
28
+        if ($act === $postfix) {
29 29
             $this->assertSame($exp, "");
30 30
         } else {
31 31
             $test = substr($act, 0, strlen($act) - (strlen($postfix) + 1));

+ 1
- 1
tests/cases/Db/PostgreSQLPDO/TestStatement.php View File

@@ -20,7 +20,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
20 20
     protected function decorateTypeSyntax(string $value, string $type): string {
21 21
         switch ($type) {
22 22
             case "float":
23
-                return (substr($value, -2)==".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
23
+                return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
24 24
             case "string":
25 25
                 if (preg_match("<^char\((\d+)\)$>", $value, $match)) {
26 26
                     return "U&'\\+".str_pad(dechex((int) $match[1]), 6, "0", \STR_PAD_LEFT)."'";

+ 2
- 2
tests/cases/Db/SQLite3PDO/TestStatement.php View File

@@ -17,8 +17,8 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
17 17
     }
18 18
 
19 19
     protected function decorateTypeSyntax(string $value, string $type): string {
20
-        if ($type=="float") {
21
-            return (substr($value, -2)==".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
20
+        if ($type === "float") {
21
+            return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'";
22 22
         } else {
23 23
             return $value;
24 24
         }

+ 5
- 5
tests/cases/REST/TinyTinyRSS/TestAPI.php View File

@@ -350,7 +350,7 @@ LONG_STRING;
350 350
             'userSessionEnforced' => false,
351 351
         ];
352 352
         $http401 = new EmptyResponse(401);
353
-        if ($type=="login") {
353
+        if ($type === "login") {
354 354
             return [
355 355
                 // conf,    user,  data,      result
356 356
                 [$defaults, null,  $johnGood, $johnSess],
@@ -474,7 +474,7 @@ LONG_STRING;
474 474
                 [$fullHttp, "",    $missingU, $http401],
475 475
                 [$fullHttp, "",    $missingP, $http401],
476 476
             ];
477
-        } elseif ($type=="isLoggedIn") {
477
+        } elseif ($type === "isLoggedIn") {
478 478
             return [
479 479
                 // conf,    user,  session,  result
480 480
                 [$defaults, null,  $sidJohn, $john],
@@ -1517,13 +1517,13 @@ LONG_STRING;
1517 1517
 
1518 1518
     protected function filterFolders(int $id = null): array {
1519 1519
         return array_filter($this->folders, function($value) use ($id) {
1520
-            return $value['parent']==$id;
1520
+            return $value['parent'] == $id;
1521 1521
         });
1522 1522
     }
1523 1523
 
1524 1524
     protected function filterSubs(int $folder = null): array {
1525 1525
         return array_filter($this->subscriptions, function($value) use ($folder) {
1526
-            return $value['folder']==$folder;
1526
+            return $value['folder'] == $folder;
1527 1527
         });
1528 1528
     }
1529 1529
 
@@ -1533,7 +1533,7 @@ LONG_STRING;
1533 1533
             $out += $this->reduceFolders($f['id']);
1534 1534
         }
1535 1535
         $out += array_reduce(array_filter($this->subscriptions, function($value) use ($id) {
1536
-            return $value['folder']==$id;
1536
+            return $value['folder'] == $id;
1537 1537
         }), function($sum, $value) {
1538 1538
             return $sum + $value['unread'];
1539 1539
         }, 0);

+ 2
- 2
tests/cases/User/TestUser.php View File

@@ -60,7 +60,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
60 60
         $this->assertSame($exp, $u->auth($user, $password));
61 61
         $this->assertNull($u->id);
62 62
         Phake::verify(Arsse::$db, Phake::times($exp ? 1 : 0))->userExists($user);
63
-        Phake::verify(Arsse::$db, Phake::times($exp && $user == "jane.doe@example.com" ? 1 : 0))->userAdd($user, $password);
63
+        Phake::verify(Arsse::$db, Phake::times($exp && $user === "jane.doe@example.com" ? 1 : 0))->userAdd($user, $password);
64 64
     }
65 65
 
66 66
     public function provideAuthentication() {
@@ -274,7 +274,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
274 274
         } finally {
275 275
             Phake::verify($this->drv, Phake::times($calls))->userPasswordSet;
276 276
             Phake::verify($u, Phake::times($calls / 2))->generatePassword;
277
-            Phake::verify(Arsse::$db, Phake::times($calls==4 ? 2 : 0))->userExists($user);
277
+            Phake::verify(Arsse::$db, Phake::times($calls == 4 ? 2 : 0))->userExists($user);
278 278
             if ($calls == 4) {
279 279
                 Phake::verify(Arsse::$db, Phake::times($exists ? 1 : 0))->userPasswordSet($user, $pass1, null);
280 280
                 Phake::verify(Arsse::$db, Phake::times($exists ? 1 : 0))->userPasswordSet($user, $pass2, null);

+ 4
- 4
tests/lib/DatabaseInformation.php View File

@@ -83,7 +83,7 @@ class DatabaseInformation {
83 83
             } catch (\Throwable $e) {
84 84
             }
85 85
             foreach ($sqlite3TableList($db) as $table) {
86
-                if ($table == "arsse_meta") {
86
+                if ($table === "arsse_meta") {
87 87
                     $db->exec("DELETE FROM $table where key <> 'schema_version'");
88 88
                 } else {
89 89
                     $db->exec("DELETE FROM $table");
@@ -137,9 +137,9 @@ class DatabaseInformation {
137 137
             } catch (\Throwable $e) {
138 138
             }
139 139
             foreach ($pgObjectList($db) as $obj) {
140
-                if ($obj['type'] != "TABLE") {
140
+                if ($obj['type'] !== "TABLE") {
141 141
                     continue;
142
-                } elseif ($obj['name'] == "arsse_meta") {
142
+                } elseif ($obj['name'] === "arsse_meta") {
143 143
                     $pgExecFunction($db, "DELETE FROM {$obj['name']} where key <> 'schema_version'");
144 144
                 } else {
145 145
                     $pgExecFunction($db, "TRUNCATE TABLE {$obj['name']} restart identity cascade");
@@ -181,7 +181,7 @@ class DatabaseInformation {
181 181
             } catch (\Throwable $e) {
182 182
             }
183 183
             foreach ($mysqlTableList($db) as $table) {
184
-                if ($table == "arsse_meta") {
184
+                if ($table === "arsse_meta") {
185 185
                     $db->query("DELETE FROM $table where `key` <> 'schema_version'");
186 186
                 } else {
187 187
                     $db->query("DELETE FROM $table");

Loading…
Cancel
Save