summaryrefslogtreecommitdiffstats
path: root/app/classes/PlanetError.php
diff options
context:
space:
mode:
authorrdalverny <rdalverny@gmail.com>2022-01-22 19:53:01 +0100
committerrdalverny <rdalverny@gmail.com>2022-01-22 19:53:01 +0100
commit5a0c2d333ff41ec4da6a4d58bc1553beeee1affa (patch)
treea6f2f62d76535a2e47085173c560be77b0214e15 /app/classes/PlanetError.php
parentc27c9d1d359828a071159995689c9c3b28d99891 (diff)
downloadplanet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.gz
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.bz2
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.tar.xz
planet-5a0c2d333ff41ec4da6a4d58bc1553beeee1affa.zip
More type hints
Diffstat (limited to 'app/classes/PlanetError.php')
-rw-r--r--app/classes/PlanetError.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/app/classes/PlanetError.php b/app/classes/PlanetError.php
index e47ab1d..a7d2a63 100644
--- a/app/classes/PlanetError.php
+++ b/app/classes/PlanetError.php
@@ -2,30 +2,26 @@
class PlanetError
{
- public $level;
+ public int $level;
+
+ /** @var array<int, string> */
public $levels = array(
1 => 'notice',
2 => 'warning',
3 => 'error',
);
- public $message;
+ public string $message;
/**
* PlanetError constructor.
- * @param $level
- * @param $message
*/
- public function __construct($level, $message)
+ public function __construct(int $level, string $message)
{
$this->level = (int) $level;
$this->message = $message;
}
- /**
- * @param string $format
- * @return string
- */
- public function toString($format = '%1$s: %2$s')
+ public function toString(string $format = '%1$s: %2$s') : string
{
return sprintf($format, $this->levels[$this->level], $this->message);
}