Skip to content

Commit a6f4ed2

Browse files
authored
Merge pull request #57902 from nextcloud/useStrictOperator
refactor: use strict operator
2 parents c4e2159 + 3bbe0ee commit a6f4ed2

14 files changed

Lines changed: 26 additions & 26 deletions

File tree

lib/base.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public static function initPaths(): void {
120120
if (substr($scriptName, -1) == '/') {
121121
$scriptName .= 'index.php';
122122
//make sure suburi follows the same rules as scriptName
123-
if (substr(OC::$SUBURI, -9) != 'index.php') {
124-
if (substr(OC::$SUBURI, -1) != '/') {
123+
if (substr(OC::$SUBURI, -9) !== 'index.php') {
124+
if (substr(OC::$SUBURI, -1) !== '/') {
125125
OC::$SUBURI = OC::$SUBURI . '/';
126126
}
127127
OC::$SUBURI = OC::$SUBURI . 'index.php';
@@ -134,7 +134,7 @@ public static function initPaths(): void {
134134
if (substr($scriptName, 0 - strlen(OC::$SUBURI)) === OC::$SUBURI) {
135135
OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
136136

137-
if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
137+
if (OC::$WEBROOT !== '' && OC::$WEBROOT[0] !== '/') {
138138
OC::$WEBROOT = '/' . OC::$WEBROOT;
139139
}
140140
} else {
@@ -239,7 +239,7 @@ public static function checkInstalled(\OC\SystemConfig $systemConfig): void {
239239

240240
public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): void {
241241
// Allow ajax update script to execute without being stopped
242-
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') {
242+
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI !== '/core/ajax/update.php') {
243243
// send http status 503
244244
http_response_code(503);
245245
header('X-Nextcloud-Maintenance-Mode: 1');

lib/private/App/AppManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function getAllAppsInAppsFolders(): array {
203203
if (is_resource($dh)) {
204204
while (($file = readdir($dh)) !== false) {
205205
if (
206-
$file[0] != '.'
206+
$file[0] !== '.'
207207
&& is_dir($apps_dir['path'] . '/' . $file)
208208
&& is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')
209209
) {
@@ -734,7 +734,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
734734
return __DIR__ . '/../../../core';
735735
}
736736

737-
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) != false) {
737+
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) !== false) {
738738
return $dir['path'] . '/' . $appId;
739739
}
740740
throw new AppPathNotFoundException('Could not find path for ' . $appId);
@@ -747,7 +747,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
747747
*/
748748
#[\Override]
749749
public function getAppWebPath(string $appId): string {
750-
if (($dir = $this->findAppInDirectories($appId)) != false) {
750+
if (($dir = $this->findAppInDirectories($appId)) !== false) {
751751
return \OC::$WEBROOT . $dir['url'] . '/' . $appId;
752752
}
753753
throw new AppPathNotFoundException('Could not find web path for ' . $appId);

lib/private/Contacts/ContactsMenu/ContactsStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private function filterContacts(
184184
$decodedExcludeGroups = json_decode($excludedGroups, true);
185185
$excludeGroupsList = $decodedExcludeGroups ?? [];
186186

187-
if ($excludeGroups != 'allow') {
187+
if ($excludeGroups !== 'allow') {
188188
if (count($selfGroups) > 0 && count(array_diff($selfGroups, $excludeGroupsList)) === 0) {
189189
// all the groups of the current user are excluded -> filter all local users
190190
$skipLocal = true;

lib/private/Files/Cache/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ private function getParentPath($path) {
551551
*/
552552
#[\Override]
553553
public function inCache($file) {
554-
return $this->getId($file) != -1;
554+
return $this->getId($file) !== -1;
555555
}
556556

557557
/**

lib/private/Files/Cache/Updater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private function updateStorageMTimeOnly(string $internalPath): void {
225225
private function correctParentStorageMtime(string $internalPath): void {
226226
$parentId = $this->cache->getParentId($internalPath);
227227
$parent = dirname($internalPath);
228-
if ($parentId != -1) {
228+
if ($parentId !== -1) {
229229
$mtime = $this->storage->filemtime($parent);
230230
if ($mtime !== false) {
231231
try {

lib/private/Files/Mount/MountPoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private function formatPath($path) {
225225
public function wrapStorage($wrapper) {
226226
$storage = $this->getStorage();
227227
// storage can be null if it couldn't be initialized
228-
if ($storage != null) {
228+
if ($storage !== null) {
229229
$this->storage = $wrapper($this->mountPoint, $storage, $this);
230230
}
231231
}

lib/private/Files/ObjectStore/S3ObjectTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, array $m
164164
$totalWritten += $command['ContentLength'];
165165
},
166166
'before_complete' => function ($_command) use (&$totalWritten, $size, &$uploader, &$attempts): void {
167-
if ($size !== null && $totalWritten != $size) {
167+
if ($size !== null && $totalWritten !== $size) {
168168
$e = new \Exception('Incomplete multi part upload, expected ' . $size . ' bytes, wrote ' . $totalWritten);
169169
throw new MultipartUploadException($uploader->getState(), $e);
170170
}

lib/private/Installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ private function copyRecursive(string $src, string $dest): void {
632632
}
633633
$files = scandir($src);
634634
foreach ($files as $file) {
635-
if ($file != '.' && $file != '..') {
635+
if ($file !== '.' && $file !== '..') {
636636
$this->copyRecursive("$src/$file", "$dest/$file");
637637
}
638638
}

lib/private/Log/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
public function write(string $app, $message, int $level): void {
5050
$entry = $this->logDetailsAsJSON($app, $message, $level);
5151
$handle = @fopen($this->logFile, 'a');
52-
if ($this->logFileMode > 0 && is_file($this->logFile) && (fileperms($this->logFile) & 0777) != $this->logFileMode) {
52+
if ($this->logFileMode > 0 && is_file($this->logFile) && (fileperms($this->logFile) & 0777) !== $this->logFileMode) {
5353
@chmod($this->logFile, $this->logFileMode);
5454
}
5555
if ($handle) {
@@ -86,7 +86,7 @@ public function getEntries(int $limit = 50, int $offset = 0): array {
8686
fseek($handle, $pos);
8787
$ch = fgetc($handle);
8888
if ($ch == "\n" || $pos == 0) {
89-
if ($line != '') {
89+
if ($line !== '') {
9090
// Add the first character if at the start of the file,
9191
// because it doesn't hit the else in the loop
9292
if ($pos == 0) {

lib/private/Security/CertificateManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function listCertificates(): array {
5050
return [];
5151
}
5252
while (false !== ($file = readdir($handle))) {
53-
if ($file != '.' && $file != '..') {
53+
if ($file !== '.' && $file !== '..') {
5454
try {
5555
$content = $this->view->file_get_contents($path . $file);
5656
if ($content !== false) {

0 commit comments

Comments
 (0)