Skip to content

Commit

Permalink
Migrate usages of deprecated Twig class names
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored and SenseException committed Aug 15, 2023
1 parent c4d6ff8 commit 0154539
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions lib/Twig/MainExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use Doctrine\Website\Model\Project;
use Doctrine\Website\Model\ProjectVersion;
use Parsedown;
use Twig_Extension;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

use function assert;
use function file_get_contents;
Expand All @@ -23,7 +23,7 @@
use function strrpos;
use function substr;

class MainExtension extends Twig_Extension
class MainExtension extends AbstractExtension
{
/** @var Parsedown */
private $parsedown;
Expand Down Expand Up @@ -54,25 +54,25 @@ public function __construct(
$this->stripePublishableKey = $stripePublishableKey;
}

/** @return Twig_SimpleFunction[] */
/** {@inheritDoc} */
public function getFunctions(): array
{
return [
new Twig_SimpleFunction('get_search_box_placeholder', [$this, 'getSearchBoxPlaceholder']),
new Twig_SimpleFunction('get_asset_url', [$this, 'getAssetUrl']),
new Twig_SimpleFunction('get_webpack_asset_url', [$this, 'getWebpackAssetUrl']),
new Twig_SimpleFunction('get_asset_integrity', [$this->assetIntegrityGenerator, 'getAssetIntegrity']),
new Twig_SimpleFunction('get_webpack_asset_integrity', [$this->assetIntegrityGenerator, 'getWebpackAssetIntegrity']),
new Twig_SimpleFunction('get_stripe_publishable_key', [$this, 'getStripePublishableKey']),
new TwigFunction('get_search_box_placeholder', [$this, 'getSearchBoxPlaceholder']),
new TwigFunction('get_asset_url', [$this, 'getAssetUrl']),
new TwigFunction('get_webpack_asset_url', [$this, 'getWebpackAssetUrl']),
new TwigFunction('get_asset_integrity', [$this->assetIntegrityGenerator, 'getAssetIntegrity']),
new TwigFunction('get_webpack_asset_integrity', [$this->assetIntegrityGenerator, 'getWebpackAssetIntegrity']),
new TwigFunction('get_stripe_publishable_key', [$this, 'getStripePublishableKey']),
];
}

/** @return Twig_SimpleFilter[] */
/** {@inheritDoc} */
public function getFilters(): array
{
return [
new Twig_SimpleFilter('markdown', [$this->parsedown, 'text'], ['is_safe' => ['html']]),
new Twig_SimpleFilter('truncate', [$this, 'truncate']),
new TwigFilter('markdown', [$this->parsedown, 'text'], ['is_safe' => ['html']]),
new TwigFilter('truncate', [$this, 'truncate']),
];
}

Expand Down
12 changes: 6 additions & 6 deletions lib/Twig/ProjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

use Doctrine\Website\Model\ProjectVersion;
use Doctrine\Website\Repositories\ProjectRepository;
use Twig_Extension;
use Twig_SimpleFunction;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

use function file_exists;
use function str_replace;
use function strpos;

class ProjectExtension extends Twig_Extension
class ProjectExtension extends AbstractExtension
{
/** @var ProjectRepository */
private $projectRepository;
Expand All @@ -27,12 +27,12 @@ public function __construct(ProjectRepository $projectRepository, string $source
$this->sourceDir = $sourceDir;
}

/** @return Twig_SimpleFunction[] */
/** {@inheritDoc} */
public function getFunctions(): array
{
return [
new Twig_SimpleFunction('get_menu_projects', [$this->projectRepository, 'findPrimaryProjects']),
new Twig_SimpleFunction('get_url_version', [$this, 'getUrlVersion']),
new TwigFunction('get_menu_projects', [$this->projectRepository, 'findPrimaryProjects']),
new TwigFunction('get_url_version', [$this, 'getUrlVersion']),
];
}

Expand Down

0 comments on commit 0154539

Please sign in to comment.