Skip to content

Commit

Permalink
Refacto/add type exceptions (#695)
Browse files Browse the repository at this point in the history
* Refacto: Type Exceptions class

* fix pedro review
  • Loading branch information
KevinArtus authored May 25, 2023
1 parent e148bea commit 24e4a79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/Gaufrette/Exception/FileAlreadyExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
*/
class FileAlreadyExists extends \RuntimeException implements Exception
{
private $key;
private string $key;

public function __construct($key, $code = 0, \Exception $previous = null)
public function __construct(string $key, int $code = 0, \Exception $previous = null)
{
$this->key = $key;

parent::__construct(
sprintf('The file %s already exists and can not be overwritten.', $key),
$code,
$previous
);

$this->key = $key;
}

public function getKey()
public function getKey(): string
{
return $this->key;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Gaufrette/Exception/FileNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
*/
class FileNotFound extends \RuntimeException implements Exception
{
private $key;
private string $key;

public function __construct($key, $code = 0, \Exception $previous = null)
public function __construct(string $key, int $code = 0, \Exception $previous = null)
{
$this->key = $key;

parent::__construct(
sprintf('The file "%s" was not found.', $key),
$code,
$previous
);

$this->key = $key;
}

public function getKey()
public function getKey(): string
{
return $this->key;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Gaufrette/Exception/UnexpectedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
*/
class UnexpectedFile extends \RuntimeException implements Exception
{
private $key;
private string $key;

public function __construct($key, $code = 0, \Exception $previous = null)
public function __construct(string $key, int $code = 0, \Exception $previous = null)
{
$this->key = $key;

parent::__construct(
sprintf('The file "%s" was not supposed to exist.', $key),
$code,
$previous
);

$this->key = $key;
}

public function getKey()
public function getKey(): string
{
return $this->key;
}
Expand Down

0 comments on commit 24e4a79

Please sign in to comment.