Skip to content

Commit a1654ae

Browse files
committed
refactor: use strict operator
1 parent 37dbe13 commit a1654ae

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
@@ -117,8 +117,8 @@ public static function initPaths(): void {
117117
if (substr($scriptName, -1) == '/') {
118118
$scriptName .= 'index.php';
119119
//make sure suburi follows the same rules as scriptName
120-
if (substr(OC::$SUBURI, -9) != 'index.php') {
121-
if (substr(OC::$SUBURI, -1) != '/') {
120+
if (substr(OC::$SUBURI, -9) !== 'index.php') {
121+
if (substr(OC::$SUBURI, -1) !== '/') {
122122
OC::$SUBURI = OC::$SUBURI . '/';
123123
}
124124
OC::$SUBURI = OC::$SUBURI . 'index.php';
@@ -131,7 +131,7 @@ public static function initPaths(): void {
131131
if (substr($scriptName, 0 - strlen(OC::$SUBURI)) === OC::$SUBURI) {
132132
OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
133133

134-
if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
134+
if (OC::$WEBROOT !== '' && OC::$WEBROOT[0] !== '/') {
135135
OC::$WEBROOT = '/' . OC::$WEBROOT;
136136
}
137137
} else {
@@ -236,7 +236,7 @@ public static function checkInstalled(\OC\SystemConfig $systemConfig): void {
236236

237237
public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): void {
238238
// Allow ajax update script to execute without being stopped
239-
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') {
239+
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI !== '/core/ajax/update.php') {
240240
// send http status 503
241241
http_response_code(503);
242242
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
@@ -195,7 +195,7 @@ public function getAllAppsInAppsFolders(): array {
195195
if (is_resource($dh)) {
196196
while (($file = readdir($dh)) !== false) {
197197
if (
198-
$file[0] != '.'
198+
$file[0] !== '.'
199199
&& is_dir($apps_dir['path'] . '/' . $file)
200200
&& is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')
201201
) {
@@ -711,7 +711,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
711711
return __DIR__ . '/../../../core';
712712
}
713713

714-
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) != false) {
714+
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) !== false) {
715715
return $dir['path'] . '/' . $appId;
716716
}
717717
throw new AppPathNotFoundException('Could not find path for ' . $appId);
@@ -723,7 +723,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
723723
* @throws AppPathNotFoundException if app path can't be found
724724
*/
725725
public function getAppWebPath(string $appId): string {
726-
if (($dir = $this->findAppInDirectories($appId)) != false) {
726+
if (($dir = $this->findAppInDirectories($appId)) !== false) {
727727
return \OC::$WEBROOT . $dir['url'] . '/' . $appId;
728728
}
729729
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
@@ -183,7 +183,7 @@ private function filterContacts(
183183
$decodedExcludeGroups = json_decode($excludedGroups, true);
184184
$excludeGroupsList = $decodedExcludeGroups ?? [];
185185

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

lib/private/Files/Cache/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ private function getParentPath($path) {
533533
* @return bool
534534
*/
535535
public function inCache($file) {
536-
return $this->getId($file) != -1;
536+
return $this->getId($file) !== -1;
537537
}
538538

539539
/**

lib/private/Files/Cache/Updater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private function updateStorageMTimeOnly($internalPath) {
275275
private function correctParentStorageMtime($internalPath) {
276276
$parentId = $this->cache->getParentId($internalPath);
277277
$parent = dirname($internalPath);
278-
if ($parentId != -1) {
278+
if ($parentId !== -1) {
279279
$mtime = $this->storage->filemtime($parent);
280280
if ($mtime !== false) {
281281
try {

lib/private/Files/Mount/MountPoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private function formatPath($path) {
236236
public function wrapStorage($wrapper) {
237237
$storage = $this->getStorage();
238238
// storage can be null if it couldn't be initialized
239-
if ($storage != null) {
239+
if ($storage !== null) {
240240
$this->storage = $wrapper($this->mountPoint, $storage, $this);
241241
}
242242
}

lib/private/Files/ObjectStore/S3ObjectTrait.php

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

lib/private/Installer.php

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

lib/private/Log/File.php

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

lib/private/Security/CertificateManager.php

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

0 commit comments

Comments
 (0)