Skip to content

Commit

Permalink
Require PHP 8.1 and Symfony 6
Browse files Browse the repository at this point in the history
  • Loading branch information
gubler committed Jan 8, 2024
1 parent a707754 commit 32f5e9d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Gubler\TwigExtensions Changelog

## v1.1.0

- Require PHP 8.1 or greater and Symfony 6.0 or greater

## v1.0.0

### Change
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"source": "https://github.com/gubler/twig-extensions"
},
"require": {
"php": "^8.0",
"php": "^8.1",
"twig/twig": "^3.0",
"symfony/http-foundation": "^5.4 || ^6.0"
"symfony/http-foundation": "^6.0 || ^7.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4 || ^6.0"
"symfony/phpunit-bridge": "^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
65 changes: 31 additions & 34 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
<env name="SYMFONY_PHPUNIT_VERSION" value="8.5"/>
</php>

<testsuites>
<testsuite name="Gubler Twig Extensions Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<groups>
<exclude>
<group>legacy</group>
</exclude>
</groups>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SYMFONY_PHPUNIT_VERSION" value="9.6"/>
</php>
<testsuites>
<testsuite name="Gubler Twig Extensions Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>legacy</group>
</exclude>
</groups>
</phpunit>
16 changes: 12 additions & 4 deletions src/TableSortIconExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

class TableSortIconExtension extends AbstractExtension
{
public const SORT_ICON_CLASSES_ASC = 'fas fa-chevron-circle-down';
public const SORT_ICON_CLASSES_DESC = 'fas fa-chevron-circle-up';

public function getFunctions(): array
{
return [
Expand All @@ -22,14 +25,19 @@ public function getFunctions(): array
];
}

public function renderTableSortIcon(string $column, string $sortedColumn, string $sortDirection): string
{
public function renderTableSortIcon(
string $column,
string $sortedColumn,
string $sortDirection,
string $sortIconClassesAsc = self::SORT_ICON_CLASSES_ASC,
string $sortIconClassesDesc = self::SORT_ICON_CLASSES_DESC,
): string {
if ($column === $sortedColumn && 'asc' === $sortDirection) {
return '<i class="fas fa-chevron-circle-down pull-right"></i>';
return '<i class="i' . $sortIconClassesAsc . ' pull-right"></i>';
}

if ($column === $sortedColumn && 'desc' === $sortDirection) {
return '<i class="fas fa-chevron-circle-up pull-right"></i>';
return '<i class="' . $sortIconClassesDesc . ' pull-right"></i>';
}

return '';
Expand Down

0 comments on commit 32f5e9d

Please sign in to comment.