1616use phpbb \config \config ;
1717use phpbb \di \service_collection ;
1818use phpbb \filesystem \filesystem ;
19- use phpbb \path_helper ;
2019use phpbb \skeleton \ext ;
2120use phpbb \skeleton \template \twig \extension \skeleton_version_compare ;
2221use phpbb \template \context ;
@@ -75,9 +74,9 @@ public function get_composer_dialog_values()
7574 'extension_homepage ' => null ,
7675 ],
7776 'requirements ' => [
78- 'php_version ' => '>= ' . ext::DEFAULT_PHP ,
79- 'phpbb_version_min ' => '>= ' . ext::DEFAULT_PHPBB_MIN ,
80- '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 ,
8180 ],
8281 ];
8382 }
@@ -199,20 +198,35 @@ protected function get_template_engine()
199198 'assets_version ' => null ,
200199 ]);
201200
202- /** @var path_helper $path_helper */
203- $ path_helper = $ this ->phpbb_container ->get ('path_helper ' );
204- /** @var filesystem $filesystem */
205- $ filesystem = $ this ->phpbb_container ->get ('filesystem ' );
206- $ environment = new environment (
207- $ config ,
208- $ filesystem ,
209- $ path_helper ,
210- $ this ->phpbb_container ->getParameter ('core.cache_dir ' ),
211- $ this ->phpbb_container ->get ('ext.manager ' ),
212- new loader (
213- new filesystem ()
214- )
215- );
201+ $ container = $ this ->phpbb_container ;
202+ $ path_helper = $ container ->get ('path_helper ' );
203+ $ filesystem = $ container ->get ('filesystem ' );
204+ $ cache_dir = $ container ->getParameter ('core.cache_dir ' );
205+ $ ext_manager = $ container ->get ('ext.manager ' );
206+
207+ $ is_phpbb_4 = defined ('PHPBB_VERSION ' ) &&
208+ phpbb_version_compare (PHPBB_VERSION , '4.0.0-dev ' , '>= ' );
209+
210+ $ args = $ is_phpbb_4
211+ ? [
212+ $ container ->get ('assets.bag ' ),
213+ $ config ,
214+ $ filesystem ,
215+ $ path_helper ,
216+ $ cache_dir ,
217+ $ ext_manager ,
218+ new loader ()
219+ ]
220+ : [
221+ $ config ,
222+ $ filesystem ,
223+ $ path_helper ,
224+ $ cache_dir ,
225+ $ ext_manager ,
226+ new loader (new filesystem ())
227+ ];
228+
229+ $ environment = new environment (...$ args );
216230
217231 // Custom filter for use by packager to decode greater/less than symbols
218232 $ filter = new \Twig \TwigFilter ('skeleton_decode ' , function ($ string ) {
@@ -225,8 +239,8 @@ protected function get_template_engine()
225239 $ config ,
226240 new context (),
227241 $ environment ,
228- $ this -> phpbb_container -> getParameter ( ' core. cache_dir' ) ,
229- $ this -> phpbb_container ->get ('user ' ),
242+ $ cache_dir ,
243+ $ container ->get ('user ' ),
230244 [
231245 new skeleton_version_compare ()
232246 ]
0 commit comments