Skip to content

Commit f4b249a

Browse files
committed
cs
1 parent 8938734 commit f4b249a

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
@@ -21,7 +21,7 @@ final class FileSystem
2121
* Creates a directory if it does not exist, including parent directories.
2222
* @throws Nette\IOException on error occurred
2323
*/
24-
public static function createDir(string $dir, int $mode = 0777): void
24+
public static function createDir(string $dir, int $mode = 0o777): void
2525
{
2626
if (!is_dir($dir) && !@mkdir($dir, $mode, recursive: true) && !is_dir($dir)) { // @ - dir may already exist
2727
throw new Nette\IOException(sprintf(
@@ -209,7 +209,7 @@ public static function readLines(string $file, bool $stripNewLines = true): \Gen
209209
* Writes the string to a file.
210210
* @throws Nette\IOException on error occurred
211211
*/
212-
public static function write(string $file, string $content, ?int $mode = 0666): void
212+
public static function write(string $file, string $content, ?int $mode = 0o666): void
213213
{
214214
static::createDir(dirname($file));
215215
if (@file_put_contents($file, $content) === false) { // @ is escalated to exception
@@ -236,7 +236,7 @@ public static function write(string $file, string $content, ?int $mode = 0666):
236236
* Recursively traverses and sets permissions on the entire contents of the directory as well.
237237
* @throws Nette\IOException on error occurred
238238
*/
239-
public static function makeWritable(string $path, int $dirMode = 0777, int $fileMode = 0666): void
239+
public static function makeWritable(string $path, int $dirMode = 0o777, int $fileMode = 0o666): void
240240
{
241241
if (is_file($path)) {
242242
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)