Skip to content

Commit 1a007ab

Browse files
committed
Rename constants
1 parent 379fb89 commit 1a007ab

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

ext.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,13 @@
1515

1616
class ext extends \phpbb\extension\base
1717
{
18-
/** @var string The default value for PHP to use in skeletons */
19-
const DEFAULT_PHP = '7.1.3';
20-
/** @var string The default value for minimum phpBB to use in skeletons */
21-
const DEFAULT_PHPBB_MIN = '3.3.0';
22-
/** @var string The default value for maximum phpBB to use in skeletons */
23-
const DEFAULT_PHPBB_MAX = '4.0.0@dev';
18+
public const DEFAULT_SKELETON_PHP = '7.1.3';
19+
public const DEFAULT_SKELETON_PHPBB_MIN = '3.3.0';
20+
public const DEFAULT_SKELETON_PHPBB_MAX = '4.0.0@dev';
2421

25-
/** @var string The minimum version of phpBB this skeleton extension supports */
26-
const REQUIRE_PHPBB_MIN = '3.3.0';
27-
/** @var string The maximum version of phpBB this skeleton extension supports */
28-
const REQUIRE_PHPBB_MAX = '4.0.0-dev';
29-
/** @var string The minimum version of PHP this skeleton extension supports */
30-
const REQUIRE_PHP = 70100;
22+
public const MIN_PHPBB_ALLOWED = '3.3.0';
23+
public const MAX_PHPBB_ALLOWED = '4.0.0-dev';
24+
public const MIN_PHP_ALLOWED = 70100;
3125

3226
/**
3327
* @var array An array of installation error messages
@@ -57,11 +51,11 @@ public function is_enableable()
5751
*/
5852
protected function phpbb_requirement($phpBB_version = PHPBB_VERSION)
5953
{
60-
if (phpbb_version_compare($phpBB_version, self::REQUIRE_PHPBB_MIN, '<'))
54+
if (phpbb_version_compare($phpBB_version, self::MIN_PHPBB_ALLOWED, '<'))
6155
{
6256
$this->errors[] = 'PHPBB_VERSION_MIN_ERROR';
6357
}
64-
else if (phpbb_version_compare($phpBB_version, self::REQUIRE_PHPBB_MAX, '>='))
58+
else if (phpbb_version_compare($phpBB_version, self::MAX_PHPBB_ALLOWED, '>='))
6559
{
6660
$this->errors[] = 'PHPBB_VERSION_MAX_ERROR';
6761
}
@@ -75,7 +69,7 @@ protected function phpbb_requirement($phpBB_version = PHPBB_VERSION)
7569
*/
7670
protected function php_requirement($php_version = PHP_VERSION_ID)
7771
{
78-
if ($php_version < self::REQUIRE_PHP)
72+
if ($php_version < self::MIN_PHP_ALLOWED)
7973
{
8074
$this->errors[] = 'PHP_VERSION_ERROR';
8175
}

helper/packager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public function get_composer_dialog_values()
7474
'extension_homepage' => null,
7575
],
7676
'requirements' => [
77-
'php_version' => '>=' . ext::DEFAULT_PHP,
78-
'phpbb_version_min' => '>=' . ext::DEFAULT_PHPBB_MIN,
79-
'phpbb_version_max' => '<' . ext::DEFAULT_PHPBB_MAX,
77+
'php_version' => '>=' . ext::DEFAULT_SKELETON_PHP,
78+
'phpbb_version_min' => '>=' . ext::DEFAULT_SKELETON_PHPBB_MIN,
79+
'phpbb_version_max' => '<' . ext::DEFAULT_SKELETON_PHPBB_MAX,
8080
],
8181
];
8282
}

language/en/common.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@
7070

7171
'SKELETON_QUESTION_PHP_VERSION' => 'Please enter the PHP requirement of the extension',
7272
'SKELETON_QUESTION_PHP_VERSION_UI' => 'PHP requirement of the extension',
73-
'SKELETON_QUESTION_PHP_VERSION_EXPLAIN' => 'default: &gt;=' . \phpbb\skeleton\ext::DEFAULT_PHP,
73+
'SKELETON_QUESTION_PHP_VERSION_EXPLAIN' => 'default: &gt;=' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHP,
7474
'SKELETON_QUESTION_PHPBB_VERSION_MIN' => 'Please enter the minimum phpBB requirement of the extension',
7575
'SKELETON_QUESTION_PHPBB_VERSION_MIN_UI' => 'Minimum phpBB requirement of the extension',
76-
'SKELETON_QUESTION_PHPBB_VERSION_MIN_EXPLAIN' => 'default: &gt;=' . \phpbb\skeleton\ext::DEFAULT_PHPBB_MIN,
76+
'SKELETON_QUESTION_PHPBB_VERSION_MIN_EXPLAIN' => 'default: &gt;=' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHPBB_MIN,
7777
'SKELETON_QUESTION_PHPBB_VERSION_MAX' => 'Please enter the maximum phpBB requirement of the extension',
7878
'SKELETON_QUESTION_PHPBB_VERSION_MAX_UI' => 'Maximum phpBB requirement of the extension',
79-
'SKELETON_QUESTION_PHPBB_VERSION_MAX_EXPLAIN' => 'default: &lt;' . \phpbb\skeleton\ext::DEFAULT_PHPBB_MAX,
79+
'SKELETON_QUESTION_PHPBB_VERSION_MAX_EXPLAIN' => 'default: &lt;' . \phpbb\skeleton\ext::DEFAULT_SKELETON_PHPBB_MAX,
8080

8181
'SKELETON_QUESTION_COMPONENT_PHPLISTENER' => 'Create sample PHP event listeners',
8282
'SKELETON_QUESTION_COMPONENT_PHPLISTENER_UI' => 'PHP event listeners',

tests/controller/main_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function test_handle($status_code, $page_content)
146146
['vendor_name', '', true, \phpbb\request\request_interface::REQUEST, 'foo'],
147147
['author_name', [''], true, \phpbb\request\request_interface::REQUEST, ['bar']],
148148
['extension_version', '1.0.0-dev', true, \phpbb\request\request_interface::REQUEST, '1.0.0-dev'],
149-
['php_version', '>=' . ext::DEFAULT_PHP, false, \phpbb\request\request_interface::REQUEST, '>=' . ext::DEFAULT_PHP],
149+
['php_version', '>=' . ext::DEFAULT_SKELETON_PHP, false, \phpbb\request\request_interface::REQUEST, '>=' . ext::DEFAULT_SKELETON_PHP],
150150
['component_phplistener', false, false, \phpbb\request\request_interface::REQUEST, true],
151151
]);
152152

@@ -229,7 +229,7 @@ public function test_handle($status_code, $page_content)
229229
'NAME' => 'php_version',
230230
'DESC' => 'SKELETON_QUESTION_PHP_VERSION_UI',
231231
'DESC_EXPLAIN' => 'SKELETON_QUESTION_PHP_VERSION_EXPLAIN',
232-
'VALUE' => '>=' . ext::DEFAULT_PHP,
232+
'VALUE' => '>=' . ext::DEFAULT_SKELETON_PHP,
233233
]],
234234
['requirement', [
235235
'NAME' => 'phpbb_version_min',

0 commit comments

Comments
 (0)