Skip to content

Commit 30cbf52

Browse files
committed
php 8.2 does not support array const things
1 parent 25243ee commit 30cbf52

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

functions.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function _flash_string($type, $string)
183183
*/
184184
function language_selector()
185185
{
186-
$supported_languages = Languages::SUPPORTED_LANGUAGES;
186+
$supported_languages = Languages::$SUPPORTED_LANGUAGES;
187187

188188
$current_lang = Languages::check_language();
189189

model/Languages.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22

33
namespace model;
4+
45
use Config;
56

67
class Languages
78
{
89
// we sometimes mess with this in unit tests?
9-
public const array SUPPORTED_LANGUAGES = array(
10+
public static array $SUPPORTED_LANGUAGES = array(
1011
# Format:
1112
# 'code' => 'native language name - language name in english'
1213
'bg' => '&#1041;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; - Bulgarian',
@@ -54,7 +55,7 @@ class Languages
5455
*/
5556
public static function check_language(bool $use_post = true): string
5657
{
57-
$supported_languages = self::SUPPORTED_LANGUAGES;
58+
$supported_languages = self::$SUPPORTED_LANGUAGES;
5859

5960
// prefer a $_POST['lang'] if present
6061
if ($use_post && safepost('lang')) {

tests/CheckLanguageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class CheckLanguageTest extends \PHPUnit\Framework\TestCase
66
{
77
public function testBasic()
88
{
9-
$supported_languages = Languages::SUPPORTED_LANGUAGES;
9+
$supported_languages = Languages::$SUPPORTED_LANGUAGES;
1010

1111
$this->assertNotEmpty($supported_languages);
1212

@@ -27,7 +27,7 @@ public function testBasic()
2727

2828
public function testCookie()
2929
{
30-
$supported_languages = Languages::SUPPORTED_LANGUAGES;
30+
$supported_languages = Languages::$SUPPORTED_LANGUAGES;
3131

3232
$this->assertNotEmpty($supported_languages);
3333

@@ -46,7 +46,7 @@ public function testCookie()
4646

4747
public function testPost()
4848
{
49-
$supported_languages = Languages::SUPPORTED_LANGUAGES;
49+
$supported_languages = Languages::$SUPPORTED_LANGUAGES;
5050

5151
$this->assertNotEmpty($supported_languages);
5252

0 commit comments

Comments
 (0)