Skip to content

Commit

Permalink
Type interface for adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinArtus committed Apr 21, 2023
1 parent 20b0b04 commit ab3604b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/Gaufrette/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function read(string $key): string|bool;
*
* @return int|bool The number of bytes that were written into the file
*/
public function write(string $key, string $content): int|bool;
public function write(string $key, mixed $content): int|bool;

/**
* Indicates whether the file exists.
Expand All @@ -46,7 +46,7 @@ public function mtime(string $key): int|bool;
/**
* Deletes the file.
*/
public function delete(string$key): bool;
public function delete(string $key): bool;

/**
* Renames a file.
Expand Down
6 changes: 1 addition & 5 deletions src/Gaufrette/Adapter/ListKeysAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ interface ListKeysAware
/**
* Lists keys beginning with pattern given
* (no wildcard / regex matching).
*
* @param string $prefix
*
* @return array
*/
public function listKeys($prefix = '');
public function listKeys(string $prefix = ''): array;
}
13 changes: 2 additions & 11 deletions src/Gaufrette/Adapter/MetadataSupporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
*/
interface MetadataSupporter
{
/**
* @param string $key
* @param array $content
*/
public function setMetadata($key, $content);
public function setMetadata(string $key, array $content);

/**
* @param string $key
*
* @return array
*/
public function getMetadata($key);
public function getMetadata(string $key): array;
}
6 changes: 1 addition & 5 deletions src/Gaufrette/Adapter/MimeTypeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ interface MimeTypeProvider
{
/**
* Returns the mime type of the specified key.
*
* @param string $key
*
* @return string
*/
public function mimeType($key);
public function mimeType(string $key): string;
}
6 changes: 1 addition & 5 deletions src/Gaufrette/Adapter/SizeCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ interface SizeCalculator
{
/**
* Returns the size of the specified key.
*
* @param string $key
*
* @return int
*/
public function size($key);
public function size(string $key): int;
}

0 comments on commit ab3604b

Please sign in to comment.