Skip to content

Commit

Permalink
Upgrade to PHP 8.1 and FontAwesome 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Mar 28, 2022
1 parent 0fcd29f commit 02975ea
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 43 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: none
php-version: '8.0'
php-version: '8.1'
tools: composer
-
name: Composer
Expand All @@ -39,16 +39,13 @@ jobs:
fail-fast: false
matrix:
php-version:
- '7.2'
- '7.3'
- '8.0'
- '8.1'
dependencies:
- stable
include:
- php-version: '7.2.9'
- php-version: '8.1'
dependencies: low
- php-version: '7.4'
- php-version: '8.1'
dependencies: dev

steps:
Expand All @@ -62,9 +59,6 @@ jobs:
coverage: "none"
php-version: ${{ matrix.php-version }}
tools: composer
-
name: Remove CS Fixer
run: composer remove --dev --no-update friendsofphp/php-cs-fixer
-
name: Composer for dev dependencies
if: ${{ matrix.dependencies == 'dev' }}
Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,

'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['imports_order' => ['class', 'const', 'function']],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/derrabus/twig-awesome-bundle.svg?branch=master)](https://travis-ci.org/derrabus/twig-awesome-bundle)

This bundle integrates the icon font [Font Awesome 5](http://fontawesome.io/) into Twig. But instead of using CSS to
This bundle integrates the icon font [Font Awesome 6](http://fontawesome.io/) into Twig. But instead of using CSS to
render icons on the frontend, the icons are rendered as SVG images directly into the compiled Twig template.

## Example
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
}
],
"require": {
"php": ">= 7.2.9",
"fortawesome/font-awesome": "^5.15",
"symfony/dependency-injection": "^4.3 || ^5 || ^6",
"symfony/http-kernel": "^4.3 || ^5 || ^6",
"twig/twig": "^2.4.4 || ^3"
"php": ">= 8.1",
"fortawesome/font-awesome": "^6.1",
"symfony/dependency-injection": "^6",
"symfony/http-kernel": "^6",
"twig/twig": "^3.3.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpunit/phpunit": "^8.5 || ^9.5",
"symfony/filesystem": "^4.3 || ^5 || ^6",
"symfony/framework-bundle": "^4.3 || ^5 || ^6",
"symfony/phpunit-bridge": "^5.3",
"symfony/twig-bundle": "^4.3 || ^5 || ^6"
"friendsofphp/php-cs-fixer": "^3.8",
"phpunit/phpunit": "^9.5.19",
"symfony/filesystem": "^6",
"symfony/framework-bundle": "^6",
"symfony/phpunit-bridge": "^6",
"symfony/twig-bundle": "^6"
},
"config": {
"sort-packages": true
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
Expand Down
8 changes: 3 additions & 5 deletions src/IconLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

final class IconLocator
{
private $fontAwesomePath;

public function __construct(string $fontAwesomePath)
{
$this->fontAwesomePath = $fontAwesomePath;
public function __construct(
private readonly string $fontAwesomePath,
) {
}

public function getSvg(string $collection, string $id): string
Expand Down
8 changes: 3 additions & 5 deletions src/Twig/FaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

final class FaExtension extends AbstractExtension
{
private $tokenParser;

public function __construct(FaTokenParser $tokenParser)
{
$this->tokenParser = $tokenParser;
public function __construct(
private readonly FaTokenParser $tokenParser,
) {
}

public function getTokenParsers(): array
Expand Down
8 changes: 3 additions & 5 deletions src/Twig/FaTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

final class FaTokenParser extends AbstractTokenParser
{
private $iconLocator;

public function __construct(IconLocator $iconLocator)
{
$this->iconLocator = $iconLocator;
public function __construct(
private readonly IconLocator $iconLocator,
) {
}

public function parse(Token $token): Node
Expand Down
3 changes: 0 additions & 3 deletions tests/TwigAwesomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'default_path' => __DIR__.'/fixtures',
'strict_variables' => true,
];
if (Kernel::VERSION_ID < 50000) {
$twigConfig['exception_controller'] = null;
}

$container->loadFromExtension('twig', $twigConfig);

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/flag.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
</style>
</head>
<body>
<div class="icons"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">%A<path d="M336.174 80c-49.132 0-93.305-32-161.913-32-31.301 0-58.303 6.482-80.721 15.168a48.04 48.04 0 0 0 2.142-20.727C93.067 19.575 74.167 1.594 51.201.104 23.242-1.71 0 20.431 0 48c0 17.764 9.657 33.262 24 41.562V496c0 8.837 7.163 16 16 16h16c8.837 0 16-7.163 16-16v-83.443C109.869 395.28 143.259 384 199.826 384c49.132 0 93.305 32 161.913 32 58.479 0 101.972-22.617 128.548-39.981C503.846 367.161 512 352.051 512 335.855V95.937c0-34.459-35.264-57.768-66.904-44.117C409.193 67.309 371.641 80 336.174 80zM464 336c-21.783 15.412-60.824 32-102.261 32-59.945 0-102.002-32-161.913-32-43.361 0-96.379 9.403-127.826 24V128c21.784-15.412 60.824-32 102.261-32 59.945 0 102.002 32 161.913 32 43.271 0 96.32-17.366 127.826-32v240z"/></svg></div>
<div class="icons"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">%A<path d="M476.3 0c-6.365 0-13.01 1.35-19.34 4.233c-45.69 20.86-79.56 27.94-107.8 27.94c-59.96 0-94.81-31.86-163.9-31.87c-34.63 0-77.87 8.003-137.2 32.05V24C48 10.75 37.25 0 24 0S0 10.75 0 24v464C0 501.3 10.75 512 24 512s24-10.75 24-24v-104c53.59-23.86 96.02-31.81 132.8-31.81c73.63 0 124.9 31.78 198.6 31.78c31.91 0 68.02-5.971 111.1-23.09C504.1 355.9 512 344.4 512 332.1V30.73C512 11.1 495.3 0 476.3 0zM464 319.8c-30.31 10.82-58.08 16.1-84.6 16.1c-30.8 0-58.31-7-87.44-14.41c-32.01-8.141-68.29-17.37-111.1-17.37c-42.35 0-85.99 9.09-132.8 27.73V84.14l18.03-7.301c47.39-19.2 86.38-28.54 119.2-28.54c28.24 .0039 49.12 6.711 73.31 14.48c25.38 8.148 54.13 17.39 90.58 17.39c35.43 0 72.24-8.496 114.9-26.61V319.8z"/></svg></div>
</body>
</html>

0 comments on commit 02975ea

Please sign in to comment.