Skip to content

Commit

Permalink
feat: add typehint on adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinArtus committed Apr 21, 2023
1 parent e148bea commit 20b0b04
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions src/Gaufrette/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,48 @@ interface Adapter
/**
* Reads the content of the file.
*
* @param string $key
*
* @return string|bool if cannot read content
*/
public function read($key);
public function read(string $key): string|bool;

/**
* Writes the given content into the file.
*
* @param string $key
* @param string $content
*
* @return int|bool The number of bytes that were written into the file
*/
public function write($key, $content);
public function write(string $key, string $content): int|bool;

/**
* Indicates whether the file exists.
*
* @param string $key
*
* @return bool
*/
public function exists($key);
public function exists(string $key): bool;

/**
* Returns an array of all keys (files and directories).
*
* @return array
* @return array<int, string>
*/
public function keys();
public function keys(): array;

/**
* Returns the last modified time.
*
* @param string $key
*
* @return int|bool An UNIX like timestamp or false
*/
public function mtime($key);
public function mtime(string $key): int|bool;

/**
* Deletes the file.
*
* @param string $key
*
* @return bool
*/
public function delete($key);
public function delete(string$key): bool;

/**
* Renames a file.
*
* @param string $sourceKey
* @param string $targetKey
*
* @return bool
*/
public function rename($sourceKey, $targetKey);
public function rename(string $sourceKey, string $targetKey): bool;

/**
* Check if key is directory.
*
* @param string $key
*
* @return bool
*/
public function isDirectory($key);
public function isDirectory(string $key): bool;
}

0 comments on commit 20b0b04

Please sign in to comment.