-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issues related to twig/twig 3.15 in tests
- Loading branch information
Showing
36 changed files
with
715 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/lib/MVC/Symfony/Templating/Twig/Extension/DeprecationOptionsTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace Ibexa\Core\MVC\Symfony\Templating\Twig\Extension; | ||
|
||
use Twig\DeprecatedCallableInfo; | ||
|
||
/** | ||
* This trait provides ability to deprecate twig functions, maintaining compatibility with twig/twig prior to 3.15. | ||
*/ | ||
trait DeprecationOptionsTrait | ||
{ | ||
/** | ||
* @phpstan-param non-empty-string $newFunction | ||
* | ||
* @phpstan-return array{ | ||
* deprecation_info: \Twig\DeprecatedCallableInfo, | ||
* }|array{ | ||
* deprecated: non-empty-string, | ||
* deprecating_package: non-empty-string, | ||
* alternative: non-empty-string, | ||
* } | ||
*/ | ||
private function getDeprecationOptions(string $newFunction): array | ||
{ | ||
if (class_exists(DeprecatedCallableInfo::class)) { | ||
return [ | ||
'deprecation_info' => new DeprecatedCallableInfo('ibexa/core', '4.0', $newFunction), | ||
]; | ||
} | ||
|
||
// Compatibility with twig/twig prior to 3.15 | ||
return [ | ||
'deprecated' => '4.0', | ||
'deprecating_package' => 'ibexa/core', | ||
'alternative' => $newFunction, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.