Skip to content

Commit 2a355c0

Browse files
committed
fix: improved linting result
1 parent b153b54 commit 2a355c0

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

phpmyfaq/src/phpMyFAQ/Attachment/File.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
class File extends AbstractAttachment implements AttachmentInterface
3333
{
3434
/**
35-
* Build a file path under which the attachment, file is accessible in filesystem
35+
* Build a file path under which the attachment file is accessible in filesystem
3636
*
3737
* @throws AttachmentException
3838
*/
@@ -62,7 +62,7 @@ public function createSubDirs(string $filepath): bool
6262
clearstatcache();
6363
$attDir = dirname($filepath);
6464

65-
return file_exists($attDir) && is_dir($attDir) || mkdir($attDir, 0777, true);
65+
return file_exists($attDir) && is_dir($attDir) || mkdir($attDir, 0o777, true);
6666
}
6767

6868
/**
@@ -85,7 +85,7 @@ public function isStorageOk(): bool
8585
}
8686

8787
/**
88-
* Save current attachment to the appropriate storage.
88+
* Save the current attachment to the appropriate storage.
8989
* The filepath given will be processed and moved to the appropriate location.
9090
*
9191
* @param string $filePath full path to the attachment file

phpmyfaq/src/phpMyFAQ/Category/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function upload(): bool
135135

136136
// Ensure destination directory exists
137137
if (!is_dir(self::UPLOAD_DIR)) {
138-
if (!@mkdir(self::UPLOAD_DIR, 0775, true) && !is_dir(self::UPLOAD_DIR)) {
138+
if (!@mkdir(self::UPLOAD_DIR, 0o775, true) && !is_dir(self::UPLOAD_DIR)) {
139139
throw new Exception('Upload directory does not exist and could not be created: '
140140
. self::UPLOAD_DIR);
141141
}

phpmyfaq/src/phpMyFAQ/Helper/StatisticsHelper.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ public function getFirstTrackingDate(int $firstDate): string
7575
$date = 0;
7676

7777
if (is_file(PMF_ROOT_DIR . '/content/core/data/tracking' . date(format: 'dmY', timestamp: $firstDate))) {
78-
$fp = @fopen(
79-
PMF_ROOT_DIR . '/content/core/data/tracking' . date(format: 'dmY', timestamp: $firstDate),
80-
'r',
81-
);
82-
while (($data = fgetcsv($fp, 1024, ';', '"', '\\')) !== false) {
78+
$fp = fopen(PMF_ROOT_DIR . '/content/core/data/tracking' . date(format: 'dmY', timestamp: $firstDate), 'r');
79+
while (($data = fgetcsv($fp, length: 1024, separator: ';', enclosure: '"', escape: '\\')) !== false) {
8380
$date = isset($data[7]) && 10 === strlen($data[7]) ? $data[7] : $requestTime;
8481
}
8582

@@ -98,7 +95,7 @@ public function getLastTrackingDate(int $lastDate): string
9895
if (is_file(PMF_ROOT_DIR . '/content/core/data/tracking' . date(format: 'dmY', timestamp: $lastDate))) {
9996
$fp = fopen(PMF_ROOT_DIR . '/content/core/data/tracking' . date(format: 'dmY', timestamp: $lastDate), 'r');
10097

101-
while (($data = fgetcsv($fp, 1024, ';', '"', '\\')) !== false) {
98+
while (($data = fgetcsv($fp, length: 1024, separator: ';', enclosure: '"', escape: '\\')) !== false) {
10299
$date = isset($data[7]) && 10 === strlen($data[7]) ? $data[7] : $requestTime;
103100
}
104101

@@ -186,7 +183,7 @@ public function clearAllVisits(): bool
186183

187184
public function renderMonthSelector(): string
188185
{
189-
$oldValue = mktime(0, 0, 0, 1, 1, 1970);
186+
$oldValue = mktime(hour: 0, minute: 0, second: 0, month: 1, day: 1, year: 1970);
190187
$renderedHtml = sprintf('<option value="" selected>%s</option>', Translation::get(key: 'ad_stat_choose'));
191188

192189
$trackingDates = $this->getAllTrackingDates();
@@ -213,8 +210,11 @@ public function renderDaySelector(): string
213210
$renderedHtml = '';
214211

215212
if ($trackingDates === []) {
216-
return $renderedHtml
217-
. sprintf('<option value="" selected>%s</option>', Translation::get(key: 'ad_stat_choose'));
213+
return sprintf(
214+
'%s<option value="" selected>%s</option>',
215+
$renderedHtml,
216+
Translation::get(key: 'ad_stat_choose'),
217+
);
218218
}
219219

220220
foreach ($trackingDates as $trackingDate) {

phpmyfaq/src/phpMyFAQ/Instance/Setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function checkDirs(array $dirs): array
8282
if (false === mkdir($this->rootDir . $dir)) {
8383
// If the folder creation fails
8484
$failedDirs[] = 'Folder [' . $dir . '] could not be created.';
85-
} elseif (false === chmod($this->rootDir . $dir, 0775)) {
85+
} elseif (false === chmod($this->rootDir . $dir, 0o775)) {
8686
$failedDirs[] = 'Folder [' . $dir . '] could not be given correct permissions (775).';
8787
}
8888
} elseif (false === is_writable($this->rootDir . $dir)) {

0 commit comments

Comments
 (0)