Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Dec 11, 2024
1 parent 0c394e0 commit 7979963
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __destruct()
*/
public function ensureDirectory(
string $directory,
int $mode = null,
?int $mode = null,
bool $recursivePermissions = true
): bool {
if (empty($mode)) {
Expand Down Expand Up @@ -97,7 +97,7 @@ public function read(string $filename): string
public function write(
string $filename,
string $data,
int $mode = null,
?int $mode = null,
bool $ensureDirectory = false,
bool $append = false
): bool {
Expand Down Expand Up @@ -133,7 +133,7 @@ public function write(
public function append(
string $filename,
string $data,
int $mode = null,
?int $mode = null,
bool $ensureDirectory = false
): bool {
return $this->write($filename, $data, $mode, $ensureDirectory, true);
Expand Down Expand Up @@ -202,7 +202,7 @@ public function copy(string $filename, string $destination): bool
return \copy($filename, $destination);
}

public function touch(string $filename, int $mode = null): bool
public function touch(string $filename, ?int $mode = null): bool
{
if (!\touch($filename)) {
return false;
Expand Down Expand Up @@ -277,7 +277,7 @@ public function setPermissions(string $filename, int $mode): bool
return $this->getPermissions($filename) === $mode || \chmod($filename, $mode);
}

public function getFiles(string $location, string $pattern = null): array
public function getFiles(string $location, ?string $pattern = null): array
{
$result = [];
foreach ($this->filesIterator($location, $pattern) as $filename) {
Expand All @@ -293,7 +293,7 @@ public function getFiles(string $location, string $pattern = null): array
return $result;
}

public function tempFilename(string $extension = '', string $location = null): string
public function tempFilename(string $extension = '', ?string $location = null): string
{
if (empty($location)) {
$location = \sys_get_temp_dir();
Expand Down Expand Up @@ -358,7 +358,7 @@ public function relativePath(string $path, string $from): string
return \implode('/', $relative);
}

private function filesIterator(string $location, string $pattern = null): \GlobIterator
private function filesIterator(string $location, ?string $pattern = null): \GlobIterator
{
$pattern ??= '*';
$regexp = \rtrim($location, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . \ltrim($pattern, DIRECTORY_SEPARATOR);
Expand Down
12 changes: 6 additions & 6 deletions src/FilesInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface FilesInterface
* @param int $mode When NULL class can pick default mode.
*
*/
public function ensureDirectory(string $directory, int $mode = null): bool;
public function ensureDirectory(string $directory, ?int $mode = null): bool;

/**
* Read file content into string.
Expand All @@ -57,7 +57,7 @@ public function read(string $filename): string;
public function write(
string $filename,
string $data,
int $mode = null,
?int $mode = null,
bool $ensureDirectory = false
): bool;

Expand All @@ -73,7 +73,7 @@ public function write(
public function append(
string $filename,
string $data,
int $mode = null,
?int $mode = null,
bool $ensureDirectory = false
): bool;

Expand Down Expand Up @@ -106,7 +106,7 @@ public function copy(string $filename, string $destination): bool;
*
* @param int $mode When NULL class can pick default mode.
*/
public function touch(string $filename, int $mode = null): bool;
public function touch(string $filename, ?int $mode = null): bool;

/**
* Check if file exists.
Expand Down Expand Up @@ -166,15 +166,15 @@ public function setPermissions(string $filename, int $mode): bool;
* @param string $location Location for search.
* @param string $pattern Extension pattern.
*/
public function getFiles(string $location, string $pattern = null): array;
public function getFiles(string $location, ?string $pattern = null): array;

/**
* Return unique name of temporary (should be removed when interface implementation destructed)
* file in desired location.
*
* @param string $extension Desired file extension.
*/
public function tempFilename(string $extension = '', string $location = null): string;
public function tempFilename(string $extension = '', ?string $location = null): string;

/*
* Move outside in a future versions.
Expand Down

0 comments on commit 7979963

Please sign in to comment.