diff options
| author | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:22:40 +1000 |
|---|---|---|
| committer | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:22:40 +1000 |
| commit | 92561d7f36508b7e0271926e417adf0e2e53916b (patch) | |
| tree | a8588b4f70af276c5acf58836e33b1f6ff5c61e8 /inc/lib/Twig/Error | |
| parent | 6f1083e4b51fc9c4c594f6c72cf3d84ef4d0298b (diff) | |
Initial attempt a switch to composer and PHP-8.1 compatibility
Diffstat (limited to 'inc/lib/Twig/Error')
| -rw-r--r-- | inc/lib/Twig/Error/Loader.php | 40 | ||||
| -rw-r--r-- | inc/lib/Twig/Error/Runtime.php | 22 | ||||
| -rw-r--r-- | inc/lib/Twig/Error/Syntax.php | 55 |
3 files changed, 0 insertions, 117 deletions
diff --git a/inc/lib/Twig/Error/Loader.php b/inc/lib/Twig/Error/Loader.php deleted file mode 100644 index df566dd7..00000000 --- a/inc/lib/Twig/Error/Loader.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Exception thrown when an error occurs during template loading. - * - * Automatic template information guessing is always turned off as - * if a template cannot be loaded, there is nothing to guess. - * However, when a template is loaded from another one, then, we need - * to find the current context and this is automatically done by - * Twig_Template::displayWithErrorHandling(). - * - * This strategy makes Twig_Environment::resolveTemplate() much faster. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Loader extends Twig_Error -{ - public function __construct($message, $lineno = -1, $source = null, Exception $previous = null) - { - if (PHP_VERSION_ID < 50300) { - $this->previous = $previous; - Exception::__construct(''); - } else { - Exception::__construct('', 0, $previous); - } - $this->appendMessage($message); - $this->setTemplateLine(false); - } -} - -class_alias('Twig_Error_Loader', 'Twig\Error\LoaderError', false); diff --git a/inc/lib/Twig/Error/Runtime.php b/inc/lib/Twig/Error/Runtime.php deleted file mode 100644 index 3b24ad3a..00000000 --- a/inc/lib/Twig/Error/Runtime.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Exception thrown when an error occurs at runtime. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Runtime extends Twig_Error -{ -} - -class_alias('Twig_Error_Runtime', 'Twig\Error\RuntimeError', false); diff --git a/inc/lib/Twig/Error/Syntax.php b/inc/lib/Twig/Error/Syntax.php deleted file mode 100644 index 9d09f217..00000000 --- a/inc/lib/Twig/Error/Syntax.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* - * This file is part of Twig. - * - * (c) Fabien Potencier - * (c) Armin Ronacher - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Exception thrown when a syntax error occurs during lexing or parsing of a template. - * - * @author Fabien Potencier <fabien@symfony.com> - */ -class Twig_Error_Syntax extends Twig_Error -{ - /** - * Tweaks the error message to include suggestions. - * - * @param string $name The original name of the item that does not exist - * @param array $items An array of possible items - */ - public function addSuggestions($name, array $items) - { - if (!$alternatives = self::computeAlternatives($name, $items)) { - return; - } - - $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives))); - } - - /** - * @internal - * - * To be merged with the addSuggestions() method in 2.0. - */ - public static function computeAlternatives($name, $items) - { - $alternatives = array(); - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - asort($alternatives); - - return array_keys($alternatives); - } -} - -class_alias('Twig_Error_Syntax', 'Twig\Error\SyntaxError', false); |
