1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/16955] Clean up storage and template classes

PHPBB3-16955
This commit is contained in:
Marc Alexander
2022-12-26 14:55:23 +01:00
parent 077ceba2a9
commit 60c165c3d0
13 changed files with 20 additions and 43 deletions

View File

@@ -15,14 +15,6 @@ namespace phpbb\template;
interface template
{
/**
* Clear the cache
*
* @return \phpbb\template\template
*/
public function clear_cache();
/**
* Sets the template filenames for handles.
*

View File

@@ -53,7 +53,7 @@ class extension extends \Twig\Extension\AbstractExtension
/**
* Returns the token parser instance to add to the existing list.
*
* @return array An array of \Twig\TokenParser\AbstractTokenParser instances
* @return \Twig\TokenParser\TokenParserInterface[] An array of \Twig\TokenParser\AbstractTokenParser instances
*/
public function getTokenParsers()
{
@@ -69,7 +69,7 @@ class extension extends \Twig\Extension\AbstractExtension
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
* @return \Twig\TwigFilter[] An array of filters
*/
public function getFilters()
{
@@ -85,7 +85,7 @@ class extension extends \Twig\Extension\AbstractExtension
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
* @return \Twig\TwigFunction[] An array of global functions
*/
public function getFunctions()
{
@@ -100,7 +100,7 @@ class extension extends \Twig\Extension\AbstractExtension
/**
* Returns a list of operators to add to the existing list.
*
* @return array An array of operators
* @return array[] An array of operators
*/
public function getOperators()
{

View File

@@ -30,9 +30,9 @@ class avatar extends AbstractExtension
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
* @return \Twig\TwigFunction[] An array of global functions
*/
public function getFunctions()
public function getFunctions(): array
{
return array(
new \Twig\TwigFunction('avatar', array($this, 'get_avatar')),

View File

@@ -43,9 +43,9 @@ class config extends AbstractExtension
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
* @return \Twig\TwigFunction[] An array of global functions
*/
public function getFunctions()
public function getFunctions(): array
{
return array(
new \Twig\TwigFunction('config', array($this, 'get_config')),

View File

@@ -22,7 +22,7 @@ use Twig\TwigFunction;
class routing extends AbstractExtension
{
/** @var \phpbb\controller\helper */
/** @var \phpbb\routing\helper */
protected $helper;
/**

View File

@@ -28,14 +28,12 @@ class username extends AbstractExtension
}
/**
* Returns a list of global functions to add to the existing list.
*
* @return array An array of global functions
* {@inheritDoc}
*/
public function getFunctions()
{
return array(
new \Twig\TwigFunction('username', array($this, 'get_username')),
new \Twig\TwigFunction('username', [$this, 'get_username']),
);
}

View File

@@ -21,7 +21,7 @@ class event extends \Twig\Node\Node
*/
protected $listener_directory = 'event/';
/** @var \Twig\Environment */
/** @var \phpbb\template\twig\environment */
protected $environment;
public function __construct(\Twig\Node\Expression\AbstractExpression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)

View File

@@ -23,7 +23,7 @@ class defineparser extends \Twig\TokenParser\AbstractTokenParser
*
* @return \Twig\Node\Node A Twig\Node instance
* @throws \Twig\Error\SyntaxError
* @throws \phpbb\template\twig\node\definenode
* @returns \phpbb\template\twig\node\definenode
*/
public function parse(\Twig\Token $token)
{

View File

@@ -92,27 +92,14 @@ class twig extends \phpbb\template\base
}
// Add admin namespace
if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/'))
if ($this->path_helper->get_adm_relative_path() !== null
&& is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')
&& $this->loader instanceof \Twig\Loader\FilesystemLoader)
{
$this->loader->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin');
}
}
/**
* Clear the cache
*
* @return \phpbb\template\template
*/
public function clear_cache()
{
if (is_dir($this->cachepath))
{
$this->twig->clearCacheFiles();
}
return $this;
}
/**
* Get the style tree of the style preferred by the current user
*