diff options
| author | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
|---|---|---|
| committer | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
| commit | 2c69095a1edf7474073451285238659d0f62ce3f (patch) | |
| tree | 5dee476605402c66dc2853d0836b29f6aedae62b /tools/inc/lib/jsgettext/PoeditString.php | |
| parent | e9a61e2fbbd930eaa80d6a5f33420cedc59d748c (diff) | |
PHP8.1 fixes from Rector
Diffstat (limited to 'tools/inc/lib/jsgettext/PoeditString.php')
| -rw-r--r-- | tools/inc/lib/jsgettext/PoeditString.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tools/inc/lib/jsgettext/PoeditString.php b/tools/inc/lib/jsgettext/PoeditString.php index 3d59d004..5bffeea0 100644 --- a/tools/inc/lib/jsgettext/PoeditString.php +++ b/tools/inc/lib/jsgettext/PoeditString.php @@ -1,26 +1,20 @@ <?php -class PoeditString { - public $key; - public $value; - public $fuzzy; +class PoeditString implements \Stringable { public $comments; - function __construct($key, $value = '', $fuzzy = false, $comments = array()) { - $this->key = $key; - $this->value = $value; - $this->fuzzy = $fuzzy; + function __construct(public $key, public $value = '', public $fuzzy = false, $comments = []) { $this->comments = (array)$comments; } - public function __toString() { + public function __toString(): string { $str =''; foreach ($this->comments as $c) { $str .= "#: $c\n"; } if ($this->fuzzy) $str .= "#, fuzzy\n"; - $str .= 'msgid "'.str_replace('"', '\\"', $this->key).'"' . "\n"; - $str .= 'msgstr "'.str_replace('"', '\\"', $this->value).'"' . "\n"; + $str .= 'msgid "'.str_replace('"', '\\"', (string) $this->key).'"' . "\n"; + $str .= 'msgstr "'.str_replace('"', '\\"', (string) $this->value).'"' . "\n"; $str .= "\n"; return $str; } |
