Skip to content

Commit 3da1c13

Browse files
committed
Optimize twig function usages
1 parent 17f8a43 commit 3da1c13

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

skeleton/notification/type/sample.php.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% set is_phpbb_pre_32 = skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.2", "<") %}
12
<?php
23
/**
34
*
@@ -157,7 +158,7 @@ class sample extends \phpbb\notification\type\base
157158
*
158159
* @param array $data The type specific data
159160
* @param array $pre_create_data Data from pre_create_insert_array()
160-
{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.2", "<") %}{# for phpBB 3.1.x only #}
161+
{% if is_phpbb_pre_32 %}{# for phpBB 3.1.x only #}
161162
*
162163
* @return array Array of data ready to be inserted into the database
163164
{% endif %}{# for phpBB >= 3.2.x #}
@@ -166,7 +167,7 @@ class sample extends \phpbb\notification\type\base
166167
{
167168
$this->set_data('{{ EXTENSION.extension_name|lower }}_sample_name', $data['{{ EXTENSION.extension_name|lower }}_sample_name']);
168169
169-
{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.2", "<") %}{# for phpBB 3.1.x only #}
170+
{% if is_phpbb_pre_32 %}{# for phpBB 3.1.x only #}
170171
return parent::create_insert_array($data, $pre_create_data);
171172
{% else %}{# for phpBB >= 3.2.x #}
172173
parent::create_insert_array($data, $pre_create_data);

skeleton/phpunit.xml.dist.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% set is_phpbb_pre_33 = skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %}
12
<?xml version="1.0" encoding="UTF-8"?>
23

34
<phpunit backupGlobals="true"
@@ -8,7 +9,7 @@
89
convertWarningsToExceptions="true"
910
processIsolation="false"
1011
stopOnFailure="false"
11-
{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %}
12+
{% if is_phpbb_pre_33 %}
1213
syntaxCheck="false"
1314
{% endif %}
1415
verbose="true"
@@ -20,12 +21,12 @@
2021
<exclude>./tests/functional</exclude>
2122
</testsuite>
2223
<testsuite name="Extension Functional Tests">
23-
<directory suffix="_test.php"{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %} phpVersion="5.3.19" phpVersionOperator=">="{% endif %}>./tests/functional/</directory>
24+
<directory suffix="_test.php"{% if is_phpbb_pre_33 %} phpVersion="5.3.19" phpVersionOperator=">="{% endif %}>./tests/functional/</directory>
2425
</testsuite>
2526
</testsuites>
2627

2728
<filter>
28-
{% if skeleton_version_compare(REQUIREMENTS.phpbb_version_max, "3.3", "<") %}
29+
{% if is_phpbb_pre_33 %}
2930
<blacklist>
3031
<directory>./tests/</directory>
3132
</blacklist>

0 commit comments

Comments
 (0)