diff --git a/config/default/container/services.yml b/config/default/container/services.yml index 2d472002..b77a3845 100644 --- a/config/default/container/services.yml +++ b/config/default/container/services.yml @@ -34,6 +34,8 @@ imports: - { resource: parameters.yml } services: + _defaults: { public: true } + cache: class: phpbb\cache\service arguments: diff --git a/config/default/container/services_attachment.yml b/config/default/container/services_attachment.yml index c56ced21..d459927b 100644 --- a/config/default/container/services_attachment.yml +++ b/config/default/container/services_attachment.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + attachment.delete: class: phpbb\attachment\delete shared: false diff --git a/config/default/container/services_auth.yml b/config/default/container/services_auth.yml index 1540bea9..e0c4510e 100644 --- a/config/default/container/services_auth.yml +++ b/config/default/container/services_auth.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Auth management ----- auth: class: phpbb\auth\auth diff --git a/config/default/container/services_avatar.yml b/config/default/container/services_avatar.yml index d96aa623..d2f393fa 100644 --- a/config/default/container/services_avatar.yml +++ b/config/default/container/services_avatar.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + avatar.manager: class: phpbb\avatar\manager arguments: diff --git a/config/default/container/services_captcha.yml b/config/default/container/services_captcha.yml index e462c43b..23928c9c 100644 --- a/config/default/container/services_captcha.yml +++ b/config/default/container/services_captcha.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + captcha.factory: class: phpbb\captcha\factory arguments: diff --git a/config/default/container/services_console.yml b/config/default/container/services_console.yml index b662102b..99c2e7ce 100644 --- a/config/default/container/services_console.yml +++ b/config/default/container/services_console.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + console.exception_subscriber: class: phpbb\console\exception_subscriber arguments: @@ -113,6 +115,7 @@ services: parent: console.command.db.migrate tags: - { name: console.command } + public: true console.command.dev.migration_tips: class: phpbb\console\command\dev\migration_tips diff --git a/config/default/container/services_content.yml b/config/default/container/services_content.yml index 6717c203..a77d8731 100644 --- a/config/default/container/services_content.yml +++ b/config/default/container/services_content.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + content.visibility: class: phpbb\content_visibility arguments: diff --git a/config/default/container/services_cron.yml b/config/default/container/services_cron.yml index 70f70e35..346b7735 100644 --- a/config/default/container/services_cron.yml +++ b/config/default/container/services_cron.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + cron.manager: class: phpbb\cron\manager arguments: diff --git a/config/default/container/services_db.yml b/config/default/container/services_db.yml index d5381776..208e4feb 100644 --- a/config/default/container/services_db.yml +++ b/config/default/container/services_db.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + dbal.conn: class: phpbb\db\driver\factory arguments: diff --git a/config/default/container/services_event.yml b/config/default/container/services_event.yml index 5696275e..ef648219 100644 --- a/config/default/container/services_event.yml +++ b/config/default/container/services_event.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + dispatcher: class: phpbb\event\dispatcher arguments: diff --git a/config/default/container/services_feed.yml b/config/default/container/services_feed.yml index 0995516f..79efefa3 100644 --- a/config/default/container/services_feed.yml +++ b/config/default/container/services_feed.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.feed.controller: class: phpbb\feed\controller\feed arguments: @@ -83,6 +85,7 @@ services: feed.quote_helper: class: phpbb\feed\quote_helper parent: text_formatter.s9e.quote_helper + public: true feed.topic: class: phpbb\feed\topic diff --git a/config/default/container/services_files.yml b/config/default/container/services_files.yml index ba1fdb4c..1675885c 100644 --- a/config/default/container/services_files.yml +++ b/config/default/container/services_files.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + files.factory: class: phpbb\files\factory arguments: diff --git a/config/default/container/services_filesystem.yml b/config/default/container/services_filesystem.yml index 828f9076..d877dcae 100644 --- a/config/default/container/services_filesystem.yml +++ b/config/default/container/services_filesystem.yml @@ -1,3 +1,5 @@ services: + _defaults: { public: true } + filesystem: class: phpbb\filesystem\filesystem diff --git a/config/default/container/services_help.yml b/config/default/container/services_help.yml index 1bff0015..05747200 100644 --- a/config/default/container/services_help.yml +++ b/config/default/container/services_help.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.help.manager: class: phpbb\help\manager arguments: diff --git a/config/default/container/services_hook.yml b/config/default/container/services_hook.yml index 10a84184..6375ae5b 100644 --- a/config/default/container/services_hook.yml +++ b/config/default/container/services_hook.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + hook_finder: class: phpbb\hook\finder arguments: diff --git a/config/default/container/services_http.yml b/config/default/container/services_http.yml index 49cfbf5b..792fbe51 100644 --- a/config/default/container/services_http.yml +++ b/config/default/container/services_http.yml @@ -1,10 +1,13 @@ services: + _defaults: { public: true } + http_kernel: class: Symfony\Component\HttpKernel\HttpKernel arguments: - '@dispatcher' - '@controller.resolver' - '@request_stack' + - '@controller.resolver' # WARNING: The Symfony request does not escape the input and should be used very carefully # prefer the phpbb request (service @request) as possible diff --git a/config/default/container/services_language.yml b/config/default/container/services_language.yml index 8201fbf9..50ea6038 100644 --- a/config/default/container/services_language.yml +++ b/config/default/container/services_language.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + language.helper.language_file: class: phpbb\language\language_file_helper arguments: @@ -20,3 +22,4 @@ services: parent: language.loader_abstract calls: - [set_extension_manager, ['@ext.manager']] + public: true diff --git a/config/default/container/services_migrator.yml b/config/default/container/services_migrator.yml index c63b087a..b26d06c6 100644 --- a/config/default/container/services_migrator.yml +++ b/config/default/container/services_migrator.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Migrator ----- migrator: class: phpbb\db\migrator diff --git a/config/default/container/services_mimetype_guesser.yml b/config/default/container/services_mimetype_guesser.yml index 432470d4..cc335b09 100644 --- a/config/default/container/services_mimetype_guesser.yml +++ b/config/default/container/services_mimetype_guesser.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + mimetype.guesser_collection: class: phpbb\di\service_collection arguments: diff --git a/config/default/container/services_module.yml b/config/default/container/services_module.yml index a057e552..67453083 100644 --- a/config/default/container/services_module.yml +++ b/config/default/container/services_module.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + module.manager: class: phpbb\module\module_manager arguments: diff --git a/config/default/container/services_notification.yml b/config/default/container/services_notification.yml index 6c3cea3d..6891a32a 100644 --- a/config/default/container/services_notification.yml +++ b/config/default/container/services_notification.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + notification_manager: class: phpbb\notification\manager arguments: @@ -43,6 +45,7 @@ services: - [set_config, ['@config']] tags: - { name: notification.type } + public: true notification.type.approve_post: class: phpbb\notification\type\approve_post @@ -50,6 +53,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.approve_topic: class: phpbb\notification\type\approve_topic @@ -57,6 +61,7 @@ services: parent: notification.type.topic tags: - { name: notification.type } + public: true notification.type.bookmark: class: phpbb\notification\type\bookmark @@ -64,6 +69,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.disapprove_post: class: phpbb\notification\type\disapprove_post @@ -71,6 +77,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.disapprove_topic: class: phpbb\notification\type\disapprove_topic @@ -78,6 +85,7 @@ services: parent: notification.type.topic tags: - { name: notification.type } + public: true notification.type.group_request: class: phpbb\notification\type\group_request @@ -87,6 +95,7 @@ services: - [set_user_loader, ['@user_loader']] tags: - { name: notification.type } + public: true notification.type.group_request_approved: class: phpbb\notification\type\group_request_approved @@ -94,6 +103,7 @@ services: parent: notification.type.base tags: - { name: notification.type } + public: true notification.type.pm: class: phpbb\notification\type\pm @@ -104,6 +114,7 @@ services: - [set_config, ['@config']] tags: - { name: notification.type } + public: true notification.type.post: class: phpbb\notification\type\post @@ -114,6 +125,7 @@ services: - [set_config, ['@config']] tags: - { name: notification.type } + public: true notification.type.post_in_queue: class: phpbb\notification\type\post_in_queue @@ -121,6 +133,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.quote: class: phpbb\notification\type\quote @@ -130,6 +143,7 @@ services: - [set_utils, ['@text_formatter.utils']] tags: - { name: notification.type } + public: true notification.type.report_pm: class: phpbb\notification\type\report_pm @@ -137,6 +151,7 @@ services: parent: notification.type.pm tags: - { name: notification.type } + public: true notification.type.report_pm_closed: class: phpbb\notification\type\report_pm_closed @@ -144,6 +159,7 @@ services: parent: notification.type.pm tags: - { name: notification.type } + public: true notification.type.report_post: class: phpbb\notification\type\report_post @@ -151,6 +167,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.report_post_closed: class: phpbb\notification\type\report_post_closed @@ -158,6 +175,7 @@ services: parent: notification.type.post tags: - { name: notification.type } + public: true notification.type.topic: class: phpbb\notification\type\topic @@ -168,6 +186,7 @@ services: - [set_config, ['@config']] tags: - { name: notification.type } + public: true notification.type.topic_in_queue: class: phpbb\notification\type\topic_in_queue @@ -175,6 +194,7 @@ services: parent: notification.type.topic tags: - { name: notification.type } + public: true # ----- Notification's methods ----- # Service MUST NOT be shared for all the plugins to work. diff --git a/config/default/container/services_password.yml b/config/default/container/services_password.yml index a9adbebf..2f9414f0 100644 --- a/config/default/container/services_password.yml +++ b/config/default/container/services_password.yml @@ -5,6 +5,8 @@ parameters: passwords.driver.bcrypt_cost: 10 services: + _defaults: { public: true } + # ----- Password management ----- passwords.manager: class: phpbb\passwords\manager @@ -46,6 +48,7 @@ services: parent: passwords.driver.argon2i tags: - { name: passwords.driver } + public: true passwords.driver.bcrypt: class: phpbb\passwords\driver\bcrypt diff --git a/config/default/container/services_php.yml b/config/default/container/services_php.yml index 29349960..bf699215 100644 --- a/config/default/container/services_php.yml +++ b/config/default/container/services_php.yml @@ -1,3 +1,5 @@ services: + _defaults: { public: true } + php_ini: class: bantu\IniGetWrapper\IniGetWrapper diff --git a/config/default/container/services_profilefield.yml b/config/default/container/services_profilefield.yml index 90b22836..d0118ca9 100644 --- a/config/default/container/services_profilefield.yml +++ b/config/default/container/services_profilefield.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + profilefields.manager: class: phpbb\profilefields\manager arguments: diff --git a/config/default/container/services_report.yml b/config/default/container/services_report.yml index 2c5b3bf3..07685867 100644 --- a/config/default/container/services_report.yml +++ b/config/default/container/services_report.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Report controller ----- phpbb.report.controller: class: phpbb\report\controller\report diff --git a/config/default/container/services_routing.yml b/config/default/container/services_routing.yml index 0bf0a33a..a877d645 100644 --- a/config/default/container/services_routing.yml +++ b/config/default/container/services_routing.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + router: class: phpbb\routing\router arguments: diff --git a/config/default/container/services_text_formatter.yml b/config/default/container/services_text_formatter.yml index 4e4abf65..276c48a5 100644 --- a/config/default/container/services_text_formatter.yml +++ b/config/default/container/services_text_formatter.yml @@ -4,6 +4,8 @@ parameters: text_formatter.cache.renderer.key: _text_formatter_renderer services: + _defaults: { public: true } + text_formatter.acp_utils: class: phpbb\textformatter\s9e\acp_utils arguments: diff --git a/config/default/container/services_text_reparser.yml b/config/default/container/services_text_reparser.yml index 4bc49f57..aa81f60d 100644 --- a/config/default/container/services_text_reparser.yml +++ b/config/default/container/services_text_reparser.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + text_reparser.manager: class: phpbb\textreparser\manager arguments: diff --git a/config/default/container/services_twig.yml b/config/default/container/services_twig.yml index 6f701552..82fdfe3d 100644 --- a/config/default/container/services_twig.yml +++ b/config/default/container/services_twig.yml @@ -2,6 +2,8 @@ parameters: core.template.cache_path: '%core.cache_dir%twig/' services: + _defaults: { public: true } + template.twig.environment: class: phpbb\template\twig\environment arguments: @@ -68,7 +70,7 @@ services: - { name: twig.extension } template.twig.extensions.debug: - class: Twig_Extension_Debug + class: Twig\Extension\DebugExtension template: class: phpbb\template\twig\twig diff --git a/config/default/container/services_ucp.yml b/config/default/container/services_ucp.yml index 861fa4ac..570f1a1d 100644 --- a/config/default/container/services_ucp.yml +++ b/config/default/container/services_ucp.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.ucp.controller.reset_password: class: phpbb\ucp\controller\reset_password arguments: diff --git a/config/default/container/services_user.yml b/config/default/container/services_user.yml index 7e634c60..b3663a8f 100644 --- a/config/default/container/services_user.yml +++ b/config/default/container/services_user.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + acl.permissions: class: phpbb\permissions arguments: diff --git a/phpbb/console/exception_subscriber.php b/phpbb/console/exception_subscriber.php index b2409932..5717b297 100644 --- a/phpbb/console/exception_subscriber.php +++ b/phpbb/console/exception_subscriber.php @@ -15,7 +15,7 @@ namespace phpbb\console; use phpbb\exception\exception_interface; use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\Console\Event\ConsoleExceptionEvent; +use Symfony\Component\Console\Event\ConsoleErrorEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class exception_subscriber implements EventSubscriberInterface @@ -36,14 +36,14 @@ class exception_subscriber implements EventSubscriberInterface } /** - * This listener is run when the ConsoleEvents::EXCEPTION event is triggered. + * This listener is run when the ConsoleEvents::ERROR event is triggered. * It translate the exception message. If din debug mode the original exception is embedded. * - * @param ConsoleExceptionEvent $event + * @param ConsoleErrorEvent $event */ - public function on_exception(ConsoleExceptionEvent $event) + public function on_exception(ConsoleErrorEvent $event) { - $original_exception = $event->getException(); + $original_exception = $event->getError(); if ($original_exception instanceof exception_interface) { @@ -52,14 +52,14 @@ class exception_subscriber implements EventSubscriberInterface $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception); - $event->setException($exception); + $event->setError($exception); } } static public function getSubscribedEvents() { return array( - ConsoleEvents::EXCEPTION => 'on_exception', + ConsoleEvents::ERROR => 'on_exception', ); } } diff --git a/phpbb/controller/resolver.php b/phpbb/controller/resolver.php index f8dffc12..bf10cff1 100644 --- a/phpbb/controller/resolver.php +++ b/phpbb/controller/resolver.php @@ -13,6 +13,7 @@ namespace phpbb\controller; +use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -20,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request; /** * Controller manager class */ -class resolver implements ControllerResolverInterface +class resolver implements ControllerResolverInterface, ArgumentResolverInterface { /** * ContainerInterface object diff --git a/phpbb/event/dispatcher.php b/phpbb/event/dispatcher.php index 1ba2ab89..32d1ad23 100644 --- a/phpbb/event/dispatcher.php +++ b/phpbb/event/dispatcher.php @@ -13,7 +13,7 @@ namespace phpbb\event; -use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\Event; /** @@ -30,7 +30,7 @@ use Symfony\Component\EventDispatcher\Event; * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); * */ -class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface +class dispatcher extends EventDispatcher implements dispatcher_interface { /** * @var bool diff --git a/phpbb/exception/exception_interface.php b/phpbb/exception/exception_interface.php index e8526a35..a7593138 100644 --- a/phpbb/exception/exception_interface.php +++ b/phpbb/exception/exception_interface.php @@ -18,7 +18,7 @@ namespace phpbb\exception; * * Define an exception which support a language var as message. */ -interface exception_interface +interface exception_interface extends \Throwable { /** * Return the arguments associated with the message if it's a language var. diff --git a/phpbb/feed/controller/feed.php b/phpbb/feed/controller/feed.php index 3f43282e..e5e22d14 100644 --- a/phpbb/feed/controller/feed.php +++ b/phpbb/feed/controller/feed.php @@ -32,7 +32,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class feed { /** - * @var \Twig_Environment + * @var \Twig\Environment */ protected $template; @@ -89,7 +89,7 @@ class feed /** * Constructor * - * @param \Twig_Environment $twig + * @param \Twig\Environment $twig * @param symfony_request $request * @param controller_helper $controller_helper * @param config $config @@ -101,7 +101,7 @@ class feed * @param dispatcher_interface $phpbb_dispatcher * @param string $php_ext */ - public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) + public function __construct(\Twig\Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) { $this->request = $request; $this->controller_helper = $controller_helper; diff --git a/phpbb/template/twig/environment.php b/phpbb/template/twig/environment.php index ac4b16e4..27426606 100644 --- a/phpbb/template/twig/environment.php +++ b/phpbb/template/twig/environment.php @@ -15,7 +15,7 @@ namespace phpbb\template\twig; use phpbb\template\assets_bag; -class environment extends \Twig_Environment +class environment extends \Twig\Environment { /** @var \phpbb\config\config */ protected $phpbb_config; @@ -55,11 +55,11 @@ class environment extends \Twig_Environment * @param \phpbb\path_helper $path_helper phpBB path helper * @param string $cache_path The path to the cache directory * @param \phpbb\extension\manager $extension_manager phpBB extension manager - * @param \Twig_LoaderInterface $loader Twig loader interface + * @param \Twig\Loader\LoaderInterface $loader Twig loader interface * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object * @param array $options Array of options to pass to Twig */ - public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, \phpbb\event\dispatcher_interface $phpbb_dispatcher = null, $options = array()) + public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig\Loader\LoaderInterface $loader = null, \phpbb\event\dispatcher_interface $phpbb_dispatcher = null, $options = array()) { $this->phpbb_config = $phpbb_config; @@ -169,7 +169,7 @@ class environment extends \Twig_Environment * Set the namespace look up order to load templates from * * @param array $namespace - * @return \Twig_Environment + * @return \Twig\Environment */ public function setNamespaceLookUpOrder($namespace) { @@ -261,8 +261,8 @@ class environment extends \Twig_Environment * * @param string $name The template name * @param integer $index The index if it is an embedded template - * @return \Twig_TemplateInterface A template instance representing the given template name - * @throws \Twig_Error_Loader + * @return \Twig\Template A template instance representing the given template name + * @throws \Twig\Error\LoaderError */ public function loadTemplate($name, $index = null) { @@ -279,7 +279,7 @@ class environment extends \Twig_Environment return parent::loadTemplate('@' . $namespace . '/' . $name, $index); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { } } @@ -298,7 +298,7 @@ class environment extends \Twig_Environment * * @param string $name The template name * @return string - * @throws \Twig_Error_Loader + * @throws \Twig\Error\LoaderError */ public function findTemplate($name) { @@ -315,7 +315,7 @@ class environment extends \Twig_Environment return parent::getLoader()->getCacheKey('@' . $namespace . '/' . $name); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { } } diff --git a/phpbb/template/twig/extension.php b/phpbb/template/twig/extension.php index 1131a7f3..8d566eab 100644 --- a/phpbb/template/twig/extension.php +++ b/phpbb/template/twig/extension.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig; -class extension extends \Twig_Extension +class extension extends \Twig\Extension\AbstractExtension { /** @var \phpbb\template\context */ protected $context; @@ -51,7 +51,7 @@ class extension extends \Twig_Extension /** * Returns the token parser instance to add to the existing list. * - * @return array An array of Twig_TokenParser instances + * @return array An array of \Twig\TokenParser instances */ public function getTokenParsers() { @@ -74,9 +74,9 @@ class extension extends \Twig_Extension public function getFilters() { return array( - new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + new \Twig\TwigFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes - new \Twig_SimpleFilter('addslashes', 'addslashes'), + new \Twig\TwigFilter('addslashes', 'addslashes'), ); } @@ -88,9 +88,9 @@ class extension extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('lang', array($this, 'lang')), - new \Twig_SimpleFunction('lang_defined', array($this, 'lang_defined')), - new \Twig_SimpleFunction('get_class', 'get_class'), + new \Twig\TwigFunction('lang', array($this, 'lang')), + new \Twig\TwigFunction('lang_defined', array($this, 'lang_defined')), + new \Twig\TwigFunction('get_class', 'get_class'), ); } @@ -103,30 +103,30 @@ class extension extends \Twig_Extension { return array( array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + '!' => array('precedence' => 50, 'class' => '\Twig\Node\Expression\Unary\Not'), ), array( // precedence settings are copied from similar operators in Twig core extension - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '||' => array('precedence' => 10, 'class' => '\Twig\Node\Expression\Binary\OrBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => '\Twig\Node\Expression\Binary\AndBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'eq' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\EqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'ne' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'neq' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '<>' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\NotEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'gt' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'gte' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'ge' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\GreaterEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'lt' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'lte' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), + 'le' => array('precedence' => 20, 'class' => '\Twig\Node\Expression\Binary\LessEqualBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), - 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'mod' => array('precedence' => 60, 'class' => '\Twig\Node\Expression\Binary\ModBinary', 'associativity' => \Twig\ExpressionParser::OPERATOR_LEFT), ), ); } @@ -134,7 +134,7 @@ class extension extends \Twig_Extension /** * Grabs a subset of a loop * - * @param \Twig_Environment $env A Twig_Environment instance + * @param \Twig\Environment $env A \Twig\Environment instance * @param mixed $item A variable * @param integer $start Start of the subset * @param integer $end End of the subset @@ -142,7 +142,7 @@ class extension extends \Twig_Extension * * @return mixed The sliced variable */ - public function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) + public function loop_subset(\Twig\Environment $env, $item, $start, $end = null, $preserveKeys = false) { // We do almost the same thing as Twig's slice (array_slice), except when $end is positive if ($end >= 1) diff --git a/phpbb/template/twig/extension/avatar.php b/phpbb/template/twig/extension/avatar.php index 7a17fd4b..6867944f 100644 --- a/phpbb/template/twig/extension/avatar.php +++ b/phpbb/template/twig/extension/avatar.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\extension; -class avatar extends \Twig_Extension +class avatar extends \Twig\Extension\AbstractExtension { /** * Get the name of this extension @@ -33,7 +33,7 @@ class avatar extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('avatar', array($this, 'get_avatar')), + new \Twig\TwigFunction('avatar', array($this, 'get_avatar')), ); } diff --git a/phpbb/template/twig/extension/config.php b/phpbb/template/twig/extension/config.php index cbf6e505..cf79aeea 100644 --- a/phpbb/template/twig/extension/config.php +++ b/phpbb/template/twig/extension/config.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\extension; -class config extends \Twig_Extension +class config extends \Twig\Extension\AbstractExtension { /** @var \phpbb\config\config */ protected $config; @@ -46,7 +46,7 @@ class config extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('config', array($this, 'get_config')), + new \Twig\TwigFunction('config', array($this, 'get_config')), ); } diff --git a/phpbb/template/twig/extension/username.php b/phpbb/template/twig/extension/username.php index ef149693..8be1734d 100644 --- a/phpbb/template/twig/extension/username.php +++ b/phpbb/template/twig/extension/username.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\extension; -class username extends \Twig_Extension +class username extends \Twig\Extension\AbstractExtension { /** * Get the name of this extension @@ -33,7 +33,7 @@ class username extends \Twig_Extension public function getFunctions() { return array( - new \Twig_SimpleFunction('username', array($this, 'get_username')), + new \Twig\TwigFunction('username', array($this, 'get_username')), ); } diff --git a/phpbb/template/twig/lexer.php b/phpbb/template/twig/lexer.php index 6615a460..43d188e3 100644 --- a/phpbb/template/twig/lexer.php +++ b/phpbb/template/twig/lexer.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig; -class lexer extends \Twig_Lexer +class lexer extends \Twig\Lexer { - public function tokenize(\Twig_Source $source) + public function tokenize(\Twig\Source $source) { $code = $source->getCode(); $filename = $source->getName(); @@ -123,8 +123,8 @@ class lexer extends \Twig_Lexer // Appends any filters $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code); - // Tokenize \Twig_Source instance - return parent::tokenize(new \Twig_Source($code, $filename)); + // Tokenize \Twig\Source instance + return parent::tokenize(new \Twig\Source($code, $filename)); } /** diff --git a/phpbb/template/twig/loader.php b/phpbb/template/twig/loader.php index 0f193dbe..464b3d2e 100644 --- a/phpbb/template/twig/loader.php +++ b/phpbb/template/twig/loader.php @@ -16,7 +16,7 @@ namespace phpbb\template\twig; /** * Twig Template loader */ -class loader extends \Twig_Loader_Filesystem +class loader extends \Twig\Loader\FilesystemLoader { protected $safe_directories = array(); @@ -42,7 +42,7 @@ class loader extends \Twig_Loader_Filesystem * Set safe directories * * @param array $directories Array of directories that are safe (empty to clear) - * @return \Twig_Loader_Filesystem + * @return \Twig\Loader\FilesystemLoader */ public function setSafeDirectories($directories = array()) { @@ -63,7 +63,7 @@ class loader extends \Twig_Loader_Filesystem * Add safe directory * * @param string $directory Directory that should be added - * @return \Twig_Loader_Filesystem + * @return \Twig\Loader\FilesystemLoader */ public function addSafeDirectory($directory) { @@ -113,7 +113,7 @@ class loader extends \Twig_Loader_Filesystem /** * Find the template * - * Override for Twig_Loader_Filesystem::findTemplate to add support + * Override for \Twig\Loader\FilesystemLoader::findTemplate to add support * for loading from safe directories. */ protected function findTemplate($name, $throw = true) @@ -139,7 +139,7 @@ class loader extends \Twig_Loader_Filesystem // Try validating the name (which may throw an exception) $this->validateName($name); } - catch (\Twig_Error_Loader $e) + catch (\Twig\Error\LoaderError $e) { if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0) { diff --git a/phpbb/template/twig/node/definenode.php b/phpbb/template/twig/node/definenode.php index 1c515969..cfe11f09 100644 --- a/phpbb/template/twig/node/definenode.php +++ b/phpbb/template/twig/node/definenode.php @@ -14,9 +14,9 @@ namespace phpbb\template\twig\node; -class definenode extends \Twig_Node +class definenode extends \Twig\Node\Node { - public function __construct($capture, \Twig_Node $name, \Twig_Node $value, $lineno, $tag = null) + public function __construct($capture, \Twig\Node\Node $name, \Twig\Node\Node $value, $lineno, $tag = null) { parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); } @@ -24,9 +24,9 @@ class definenode extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); @@ -37,7 +37,7 @@ class definenode extends \Twig_Node ->subcompile($this->getNode('value')) ; - $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n"); + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig\Markup(\$value, \$this->env->getCharset());\n"); } else { diff --git a/phpbb/template/twig/node/event.php b/phpbb/template/twig/node/event.php index 11fdb752..042b6289 100644 --- a/phpbb/template/twig/node/event.php +++ b/phpbb/template/twig/node/event.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\node; -class event extends \Twig_Node +class event extends \Twig\Node\Node { /** * The subdirectory in which all template listener files must be placed @@ -21,10 +21,10 @@ class event extends \Twig_Node */ protected $listener_directory = 'event/'; - /** @var \Twig_Environment */ + /** @var \phpbb\template\twig\environment */ protected $environment; - public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -34,9 +34,9 @@ class event extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpbb/template/twig/node/expression/binary/equalequal.php b/phpbb/template/twig/node/expression/binary/equalequal.php index 2cd15d59..cf11b287 100644 --- a/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpbb/template/twig/node/expression/binary/equalequal.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node\expression\binary; -class equalequal extends \Twig_Node_Expression_Binary +class equalequal extends \Twig\Node\Expression\Binary\AbstractBinary { - public function operator(\Twig_Compiler $compiler) + public function operator(\Twig\Compiler $compiler) { return $compiler->raw('==='); } diff --git a/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpbb/template/twig/node/expression/binary/notequalequal.php index 5f2908fb..c8b0ac98 100644 --- a/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node\expression\binary; -class notequalequal extends \Twig_Node_Expression_Binary +class notequalequal extends \Twig\Node\Expression\Binary\AbstractBinary { - public function operator(\Twig_Compiler $compiler) + public function operator(\Twig\Compiler $compiler) { return $compiler->raw('!=='); } diff --git a/phpbb/template/twig/node/includeasset.php b/phpbb/template/twig/node/includeasset.php index 69bfd588..21287b91 100644 --- a/phpbb/template/twig/node/includeasset.php +++ b/phpbb/template/twig/node/includeasset.php @@ -13,9 +13,9 @@ namespace phpbb\template\twig\node; -abstract class includeasset extends \Twig_Node +abstract class includeasset extends \Twig\Node\Node { - public function __construct(\Twig_Node_Expression $expr, $lineno, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, $lineno, $tag = null) { parent::__construct(array('expr' => $expr), array(), $lineno, $tag); } @@ -23,9 +23,9 @@ abstract class includeasset extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpbb/template/twig/node/includenode.php b/phpbb/template/twig/node/includenode.php index c36ac3c3..879a4279 100644 --- a/phpbb/template/twig/node/includenode.php +++ b/phpbb/template/twig/node/includenode.php @@ -13,14 +13,14 @@ namespace phpbb\template\twig\node; -class includenode extends \Twig_Node_Include +class includenode extends \Twig\Node\IncludeNode { /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpbb/template/twig/node/includephp.php b/phpbb/template/twig/node/includephp.php index 0cf95abe..d320f29f 100644 --- a/phpbb/template/twig/node/includephp.php +++ b/phpbb/template/twig/node/includephp.php @@ -14,12 +14,12 @@ namespace phpbb\template\twig\node; -class includephp extends \Twig_Node +class includephp extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \phpbb\template\twig\environment */ protected $environment; - public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) + public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) { $this->environment = $environment; @@ -29,9 +29,9 @@ class includephp extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); @@ -80,7 +80,7 @@ class includephp extends \Twig_Node { $compiler ->outdent() - ->write("} catch (\Twig_Error_Loader \$e) {\n") + ->write("} catch (\Twig\Error\LoaderError \$e) {\n") ->indent() ->write("// ignore missing template\n") ->outdent() diff --git a/phpbb/template/twig/node/php.php b/phpbb/template/twig/node/php.php index 4ee415e4..c6ce7476 100644 --- a/phpbb/template/twig/node/php.php +++ b/phpbb/template/twig/node/php.php @@ -13,12 +13,12 @@ namespace phpbb\template\twig\node; -class php extends \Twig_Node +class php extends \Twig\Node\Node { - /** @var \Twig_Environment */ + /** @var \phpbb\template\twig\environment */ protected $environment; - public function __construct(\Twig_Node_Text $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) + public function __construct(\Twig\Node\TextNode $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -28,9 +28,9 @@ class php extends \Twig_Node /** * Compiles the node to PHP. * - * @param \Twig_Compiler A Twig_Compiler instance + * @param \Twig\Compiler A \Twig\Compiler instance */ - public function compile(\Twig_Compiler $compiler) + public function compile(\Twig\Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpbb/template/twig/tokenparser/defineparser.php b/phpbb/template/twig/tokenparser/defineparser.php index 6285091e..b3d46d14 100644 --- a/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpbb/template/twig/tokenparser/defineparser.php @@ -14,52 +14,52 @@ namespace phpbb\template\twig\tokenparser; -class defineparser extends \Twig_TokenParser +class defineparser extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance - * @throws \Twig_Error_Syntax + * @return \Twig\Node\Node A \Twig\Node\Node instance + * @throws \Twig\Error\SyntaxError * @throws \phpbb\template\twig\node\definenode */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $capture = false; - if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + if ($stream->test(\Twig\Token::OPERATOR_TYPE, '=')) { $stream->next(); $value = $this->parser->getExpressionParser()->parseExpression(); - if ($value instanceof \Twig_Node_Expression_Name) + if ($value instanceof \Twig\Node\Expression\NameExpression) { // This would happen if someone improperly formed their DEFINE syntax // e.g. - throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getStream()->getSourceContext()->getPath()); + throw new \Twig\Error\SyntaxError('Invalid DEFINE', $token->getLine(), $this->parser->getStream()->getSourceContext()->getPath()); } - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); } else { $capture = true; - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); } return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag()); } - public function decideBlockEnd(\Twig_Token $token) + public function decideBlockEnd(\Twig\Token $token) { return $token->test('ENDDEFINE'); } diff --git a/phpbb/template/twig/tokenparser/event.php b/phpbb/template/twig/tokenparser/event.php index 92ecff4a..3f74bd16 100644 --- a/phpbb/template/twig/tokenparser/event.php +++ b/phpbb/template/twig/tokenparser/event.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class event extends \Twig_TokenParser +class event extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -31,16 +31,16 @@ class event extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\event($expr, $this->environment, $token->getLine(), $this->getTag()); } diff --git a/phpbb/template/twig/tokenparser/includecss.php b/phpbb/template/twig/tokenparser/includecss.php index f7e55a46..6923f7d8 100644 --- a/phpbb/template/twig/tokenparser/includecss.php +++ b/phpbb/template/twig/tokenparser/includecss.php @@ -13,21 +13,21 @@ namespace phpbb\template\twig\tokenparser; -class includecss extends \Twig_TokenParser +class includecss extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includecss($expr, $token->getLine(), $this->getTag()); } diff --git a/phpbb/template/twig/tokenparser/includejs.php b/phpbb/template/twig/tokenparser/includejs.php index 598ea0a7..c27c1682 100644 --- a/phpbb/template/twig/tokenparser/includejs.php +++ b/phpbb/template/twig/tokenparser/includejs.php @@ -13,21 +13,21 @@ namespace phpbb\template\twig\tokenparser; -class includejs extends \Twig_TokenParser +class includejs extends \Twig\TokenParser\AbstractTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includejs($expr, $token->getLine(), $this->getTag()); } diff --git a/phpbb/template/twig/tokenparser/includeparser.php b/phpbb/template/twig/tokenparser/includeparser.php index 2fba4ac4..bcad49c3 100644 --- a/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpbb/template/twig/tokenparser/includeparser.php @@ -14,16 +14,16 @@ namespace phpbb\template\twig\tokenparser; -class includeparser extends \Twig_TokenParser_Include +class includeparser extends \Twig\TokenParser\IncludeTokenParser { /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); diff --git a/phpbb/template/twig/tokenparser/includephp.php b/phpbb/template/twig/tokenparser/includephp.php index 2fdf3964..787ae7b4 100644 --- a/phpbb/template/twig/tokenparser/includephp.php +++ b/phpbb/template/twig/tokenparser/includephp.php @@ -14,7 +14,7 @@ namespace phpbb\template\twig\tokenparser; -class includephp extends \Twig_TokenParser +class includephp extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -32,26 +32,26 @@ class includephp extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); $ignoreMissing = false; - if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + if ($stream->test(\Twig\Token::NAME_TYPE, 'ignore')) { $stream->next(); - $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); + $stream->expect(\Twig\Token::NAME_TYPE, 'missing'); $ignoreMissing = true; } - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\includephp($expr, $this->environment, $token->getLine(), $ignoreMissing, $this->getTag()); } diff --git a/phpbb/template/twig/tokenparser/php.php b/phpbb/template/twig/tokenparser/php.php index 3007912b..e84f923e 100644 --- a/phpbb/template/twig/tokenparser/php.php +++ b/phpbb/template/twig/tokenparser/php.php @@ -13,7 +13,7 @@ namespace phpbb\template\twig\tokenparser; -class php extends \Twig_TokenParser +class php extends \Twig\TokenParser\AbstractTokenParser { /** @var \phpbb\template\twig\environment */ protected $environment; @@ -31,24 +31,24 @@ class php extends \Twig_TokenParser /** * Parses a token and returns a node. * - * @param \Twig_Token $token A Twig_Token instance + * @param \Twig\Token $token A \Twig\Token instance * - * @return \Twig_Node A Twig_Node instance + * @return \Twig\Node\Node A \Twig\Node\Node instance */ - public function parse(\Twig_Token $token) + public function parse(\Twig\Token $token) { $stream = $this->parser->getStream(); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideEnd'), true); - $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig\Token::BLOCK_END_TYPE); return new \phpbb\template\twig\node\php($body, $this->environment, $token->getLine(), $this->getTag()); } - public function decideEnd(\Twig_Token $token) + public function decideEnd(\Twig\Token $token) { return $token->test('ENDPHP'); } diff --git a/phpbb/template/twig/twig.php b/phpbb/template/twig/twig.php index f322778e..2b34bb40 100644 --- a/phpbb/template/twig/twig.php +++ b/phpbb/template/twig/twig.php @@ -69,7 +69,7 @@ class twig extends \phpbb\template\base /** * Twig Environment * - * @var \Twig_Environment + * @var \phpbb\template\twig\environment */ protected $twig;