Skip to content

Commit 5781c04

Browse files
committed
cs
1 parent 7d6d2b5 commit 5781c04

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Utils/FileSystem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class FileSystem
2323
* Creates a directory if it does not exist, including parent directories.
2424
* @throws Nette\IOException on error occurred
2525
*/
26-
public static function createDir(string $dir, int $mode = 0777): void
26+
public static function createDir(string $dir, int $mode = 0o777): void
2727
{
2828
if (!is_dir($dir) && !@mkdir($dir, $mode, recursive: true) && !is_dir($dir)) { // @ - dir may already exist
2929
throw new Nette\IOException(sprintf(
@@ -211,7 +211,7 @@ public static function readLines(string $file, bool $stripNewLines = true): \Gen
211211
* Writes the string to a file.
212212
* @throws Nette\IOException on error occurred
213213
*/
214-
public static function write(string $file, string $content, ?int $mode = 0666): void
214+
public static function write(string $file, string $content, ?int $mode = 0o666): void
215215
{
216216
static::createDir(dirname($file));
217217
if (@file_put_contents($file, $content) === false) { // @ is escalated to exception
@@ -238,7 +238,7 @@ public static function write(string $file, string $content, ?int $mode = 0666):
238238
* Recursively traverses and sets permissions on the entire contents of the directory as well.
239239
* @throws Nette\IOException on error occurred
240240
*/
241-
public static function makeWritable(string $path, int $dirMode = 0777, int $fileMode = 0666): void
241+
public static function makeWritable(string $path, int $dirMode = 0o777, int $fileMode = 0o666): void
242242
{
243243
if (is_file($path)) {
244244
if (!@chmod($path, $fileMode)) { // @ is escalated to exception

tests/Utils/FileSystem.makeWritable.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
1616
test('makeWritable', function () {
1717
FileSystem::createDir(getTempDir() . '/12/x');
1818
FileSystem::write(getTempDir() . '/12/x/file', 'Hello');
19-
chmod(getTempDir() . '/12/x/file', 0444);
20-
chmod(getTempDir() . '/12/x', 0555);
21-
chmod(getTempDir() . '/12', 0555);
19+
chmod(getTempDir() . '/12/x/file', 0o444);
20+
chmod(getTempDir() . '/12/x', 0o555);
21+
chmod(getTempDir() . '/12', 0o555);
2222

2323
FileSystem::makeWritable(getTempDir() . '/12');
2424

25-
Assert::same(0777, fileperms(getTempDir() . '/12') & 0777);
26-
Assert::same(0777, fileperms(getTempDir() . '/12/x') & 0777);
27-
Assert::same(0666, fileperms(getTempDir() . '/12/x/file') & 0777);
25+
Assert::same(0o777, fileperms(getTempDir() . '/12') & 0o777);
26+
Assert::same(0o777, fileperms(getTempDir() . '/12/x') & 0o777);
27+
Assert::same(0o666, fileperms(getTempDir() . '/12/x/file') & 0o777);
2828
});
2929
}
3030

0 commit comments

Comments
 (0)