From f091958e8bee76d03ff35a325da08bfba183c9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6rner?= Date: Thu, 9 Nov 2023 10:22:14 +0100 Subject: [PATCH] deprecate twig filters and tests --- src/Twig/ArrayExtension.php | 2 +- src/Twig/DateExtension.php | 2 +- src/Twig/DcaExtension.php | 2 +- src/Twig/DownloadExtension.php | 10 +++++----- src/Twig/FileExtension.php | 8 ++++---- src/Twig/ImageExtension.php | 12 ++++++------ src/Twig/StringExtension.php | 4 ++-- src/Twig/TestExtension.php | 24 ++++++++++++------------ 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Twig/ArrayExtension.php b/src/Twig/ArrayExtension.php index cd440921..46c1900c 100644 --- a/src/Twig/ArrayExtension.php +++ b/src/Twig/ArrayExtension.php @@ -26,7 +26,7 @@ class ArrayExtension extends AbstractExtension implements ContainerAwareInterfac public function getFilters() { return [ - new TwigFilter('deserialize', [$this, 'deserialize']), + new TwigFilter('deserialize', [$this, 'deserialize'], ['deprecated' => true]), ]; } diff --git a/src/Twig/DateExtension.php b/src/Twig/DateExtension.php index efde0ce7..9384d0d7 100644 --- a/src/Twig/DateExtension.php +++ b/src/Twig/DateExtension.php @@ -23,7 +23,7 @@ class DateExtension extends AbstractExtension public function getFilters() { return [ - new TwigFilter('localized_date', [$this, 'getLocalizedDate']), + new TwigFilter('localized_date', [$this, 'getLocalizedDate'], ['deprecated' => true]), ]; } diff --git a/src/Twig/DcaExtension.php b/src/Twig/DcaExtension.php index 7085c8af..a2945e21 100644 --- a/src/Twig/DcaExtension.php +++ b/src/Twig/DcaExtension.php @@ -20,7 +20,7 @@ class DcaExtension extends AbstractExtension implements ContainerAwareInterface public function getFilters() { return [ - new TwigFilter('fieldLabel', [$this, 'fieldLabel']), + new TwigFilter('fieldLabel', [$this, 'fieldLabel'], ['deprecated' => true]), ]; } diff --git a/src/Twig/DownloadExtension.php b/src/Twig/DownloadExtension.php index aa630f1c..b6087b69 100644 --- a/src/Twig/DownloadExtension.php +++ b/src/Twig/DownloadExtension.php @@ -55,11 +55,11 @@ public function __construct(RequestStack $requestStack, Utils $utils, \Twig\Envi public function getFilters() { return [ - new TwigFilter('download', [$this, 'getDownload']), - new TwigFilter('download_link', [$this, 'getDownloadLink']), - new TwigFilter('download_path', [$this, 'getDownloadPath']), - new TwigFilter('download_data', [$this, 'getDownloadData']), - new TwigFilter('download_title', [$this, 'getDownloadTitle']), + new TwigFilter('download', [$this, 'getDownload', ['deprecated' => true]]), + new TwigFilter('download_link', [$this, 'getDownloadLink'], ['deprecated' => true]), + new TwigFilter('download_path', [$this, 'getDownloadPath'], ['deprecated' => true]), + new TwigFilter('download_data', [$this, 'getDownloadData'], ['deprecated' => true]), + new TwigFilter('download_title', [$this, 'getDownloadTitle'], ['deprecated' => true]), ]; } diff --git a/src/Twig/FileExtension.php b/src/Twig/FileExtension.php index 5e005ff1..1f50eed0 100644 --- a/src/Twig/FileExtension.php +++ b/src/Twig/FileExtension.php @@ -62,10 +62,10 @@ class FileExtension extends AbstractExtension implements ContainerAwareInterface public function getFilters() { return [ - new TwigFilter('file_data', [$this, 'getFileData']), - new TwigFilter('file_path', [$this, 'getFilePath']), - new TwigFilter('file_content', [$this, 'getFileContent']), - new TwigFilter('bin2uuid', [$this, 'convertBinaryToUuid']), + new TwigFilter('file_data', [$this, 'getFileData'], ['deprecated' => true]), + new TwigFilter('file_path', [$this, 'getFilePath'], ['deprecated' => true]), + new TwigFilter('file_content', [$this, 'getFileContent'], ['deprecated' => true]), + new TwigFilter('bin2uuid', [$this, 'convertBinaryToUuid'], ['deprecated' => true]), ]; } diff --git a/src/Twig/ImageExtension.php b/src/Twig/ImageExtension.php index c35c546a..72a782a7 100644 --- a/src/Twig/ImageExtension.php +++ b/src/Twig/ImageExtension.php @@ -30,12 +30,12 @@ class ImageExtension extends AbstractExtension implements ContainerAwareInterfac public function getFilters() { return [ - new TwigFilter('image', [$this, 'getImage']), - new TwigFilter('image_caption', [$this, 'getImageCaption']), - new TwigFilter('image_width', [$this, 'getImageWidth']), - new TwigFilter('image_data', [$this, 'getImageData']), - new TwigFilter('image_gallery', [$this, 'getImageGallery']), - new TwigFilter('image_size', [$this, 'getImageSize']), + new TwigFilter('image', [$this, 'getImage'], ['deprecated' => true]), + new TwigFilter('image_caption', [$this, 'getImageCaption'], ['deprecated' => true]), + new TwigFilter('image_width', [$this, 'getImageWidth'], ['deprecated' => true]), + new TwigFilter('image_data', [$this, 'getImageData'], ['deprecated' => true]), + new TwigFilter('image_gallery', [$this, 'getImageGallery'], ['deprecated' => true]), + new TwigFilter('image_size', [$this, 'getImageSize'], ['deprecated' => true]), ]; } diff --git a/src/Twig/StringExtension.php b/src/Twig/StringExtension.php index 45e25887..a5972e5b 100644 --- a/src/Twig/StringExtension.php +++ b/src/Twig/StringExtension.php @@ -39,9 +39,9 @@ public function __construct(AnonymizerUtil $anonymizerUtil, ContaoFrameworkInter public function getFilters() { return [ - new TwigFilter('autolink', [$this, 'autolink']), + new TwigFilter('autolink', [$this, 'autolink'], ['deprecated' => true]), new TwigFilter('anonymize_email', [$this, 'anonymizeEmail']), - new TwigFilter('replace_inserttag', [$this, 'replaceInsertTag']), + new TwigFilter('replace_inserttag', [$this, 'replaceInsertTag'], ['deprecated' => true]), ]; } diff --git a/src/Twig/TestExtension.php b/src/Twig/TestExtension.php index 96565810..4dfee46b 100644 --- a/src/Twig/TestExtension.php +++ b/src/Twig/TestExtension.php @@ -24,18 +24,18 @@ class TestExtension extends AbstractExtension implements ContainerAwareInterface public function getTests() { return [ - new TwigTest('numeric', [$this, 'isNumeric']), - new TwigTest('float', [$this, 'isFloat']), - new TwigTest('string', [$this, 'isString']), - new TwigTest('object', [$this, 'isObject']), - new TwigTest('array', [$this, 'isArray']), - new TwigTest('bool', [$this, 'isBool']), - new TwigTest('int', [$this, 'isInt']), - new TwigTest('uuid', [$this, 'isUuid']), - new TwigTest('binaryUuid', [$this, 'isBinaryUuid']), - new TwigTest('stringUuid', [$this, 'isStringUuid']), - new TwigTest('url', [$this, 'isUrl']), - new TwigTest('email', [$this, 'isEmail']), + new TwigTest('numeric', [$this, 'isNumeric'], ['deprecated' => true]), + new TwigTest('float', [$this, 'isFloat'], ['deprecated' => true]), + new TwigTest('string', [$this, 'isString'], ['deprecated' => true]), + new TwigTest('object', [$this, 'isObject'], ['deprecated' => true]), + new TwigTest('array', [$this, 'isArray'], ['deprecated' => true]), + new TwigTest('bool', [$this, 'isBool'], ['deprecated' => true]), + new TwigTest('int', [$this, 'isInt'], ['deprecated' => true]), + new TwigTest('uuid', [$this, 'isUuid'], ['deprecated' => true]), + new TwigTest('binaryUuid', [$this, 'isBinaryUuid'], ['deprecated' => true]), + new TwigTest('stringUuid', [$this, 'isStringUuid'], ['deprecated' => true]), + new TwigTest('url', [$this, 'isUrl'], ['deprecated' => true]), + new TwigTest('email', [$this, 'isEmail'], ['deprecated' => true]), ]; }