Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ function createDefaultDriver(): FilesystemDriver
* Open a handle for the specified path.
*
* @throws FilesystemException
*
* @psalm-taint-sink file $path
*/
function openFile(string $path, string $mode): File
{
Expand Down Expand Up @@ -173,6 +175,9 @@ function getCreationTime(string $path): int

/**
* Create a symlink $link pointing to the file/directory located at $original.
*
* @psalm-taint-sink file $original
* @psalm-taint-sink file $link
*/
function createSymlink(string $original, string $link): void
{
Expand All @@ -181,6 +186,9 @@ function createSymlink(string $original, string $link): void

/**
* Create a hard link $link pointing to the file/directory located at $target.
*
* @psalm-taint-sink file $target
* @psalm-taint-sink file $link
*/
function createHardlink(string $target, string $link): void
{
Expand All @@ -197,6 +205,9 @@ function resolveSymlink(string $path): string

/**
* Move / rename a file or directory.
*
* @psalm-taint-sink file $from
* @psalm-taint-sink file $to
*/
function move(string $from, string $to): void
{
Expand All @@ -205,6 +216,8 @@ function move(string $from, string $to): void

/**
* Delete a file.
*
* @psalm-taint-sink file $path
*/
function deleteFile(string $path): void
{
Expand All @@ -213,6 +226,8 @@ function deleteFile(string $path): void

/**
* Create a directory.
*
* @psalm-taint-sink file $path
*/
function createDirectory(string $path, int $mode = 0777): void
{
Expand All @@ -221,6 +236,8 @@ function createDirectory(string $path, int $mode = 0777): void

/**
* Create a directory recursively.
*
* @psalm-taint-sink file $path
*/
function createDirectoryRecursively(string $path, int $mode = 0777): void
{
Expand All @@ -229,6 +246,8 @@ function createDirectoryRecursively(string $path, int $mode = 0777): void

/**
* Delete a directory.
*
* @psalm-taint-sink file $path
*/
function deleteDirectory(string $path): void
{
Expand All @@ -241,6 +260,8 @@ function deleteDirectory(string $path): void
* Dot entries are not included in the resulting array (i.e. "." and "..").
*
* @return list<string>
*
* @psalm-taint-sink file $path
*/
function listFiles(string $path): array
{
Expand All @@ -249,6 +270,8 @@ function listFiles(string $path): array

/**
* Change the permissions of a file or directory.
*
* @psalm-taint-sink file $path
*/
function changePermissions(string $path, int $mode): void
{
Expand All @@ -260,6 +283,8 @@ function changePermissions(string $path, int $mode): void
*
* @param int|null $uid null to ignore
* @param int|null $gid null to ignore
*
* @psalm-taint-sink file $path
*/
function changeOwner(string $path, ?int $uid, ?int $gid = null): void
{
Expand All @@ -273,6 +298,8 @@ function changeOwner(string $path, ?int $uid, ?int $gid = null): void
*
* @param int|null $modificationTime The touch time. If $time is not supplied, the current system time is used.
* @param int|null $accessTime The access time. If not supplied, the modification time is used.
*
* @psalm-taint-sink file $path
*/
function touch(string $path, ?int $modificationTime = null, ?int $accessTime = null): void
{
Expand All @@ -283,6 +310,8 @@ function touch(string $path, ?int $modificationTime = null, ?int $accessTime = n
* Read the specified file's contents.
*
* @param string $path The file path from which to buffer contents.
*
* @psalm-taint-sink file $path
*/
function read(string $path): string
{
Expand All @@ -294,6 +323,8 @@ function read(string $path): string
*
* @param string $path The file path to which to $contents should be written.
* @param string $contents The data to write to the specified $path.
*
* @psalm-taint-sink file $path
*/
function write(string $path, string $contents): void
{
Expand Down
Loading