diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8bcf2cc..accc7d9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,21 +11,11 @@ jobs:
strategy:
fail-fast: true
matrix:
- php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
- laravel: ['6', '7', '8', '9' ]
+ php: [ '8.1', '8.2', '8.3']
+ laravel: [ '9', '10', '11' ]
exclude:
- - php: '7.2'
- laravel: '8'
- - php: '7.2'
- laravel: '9'
- - php: '7.3'
- laravel: '9'
- - php: '7.4'
- laravel: '9'
- - php: '8.1'
- laravel: '6'
- - php: '8.1'
- laravel: '7'
+ - laravel: 11
+ php: 8.1
name: PHP ${{ matrix.php }}; Laravel ${{ matrix.laravel }}
@@ -43,37 +33,29 @@ jobs:
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: Select Laravel 6
+ - name: Select Laravel 9
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
- command: composer require "laravel/framework:6.*" "phpunit/phpunit:^8.5.8|^9.3.7" --no-update --no-interaction
- if: "matrix.laravel == '6'"
+ command: composer require "laravel/framework:9.*" "phpunit/phpunit:^9.3.7" --no-update --no-interaction
+ if: "matrix.laravel == '9'"
- - name: Select Laravel 7
+ - name: Select Laravel 10
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
- command: composer require "laravel/framework:7.*" "phpunit/phpunit:^8.5.8|^9.3.7" --no-update --no-interaction
- if: "matrix.laravel == '7'"
+ command: composer require "laravel/framework:10.*" "phpunit/phpunit:^9.3.7" --no-update --no-interaction
+ if: "matrix.laravel == '10'"
- - name: Select Laravel 8
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: composer require "laravel/framework:8.*" "phpunit/phpunit:^9.3.7" --no-update --no-interaction
- if: "matrix.laravel == '8'"
-
- - name: Select Laravel 9
+ - name: Select Laravel 11
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
- command: composer require "laravel/framework:9.*" "phpunit/phpunit:^9.3.7" --no-update --no-interaction
- if: "matrix.laravel == '9'"
+ command: composer require "laravel/framework:11.*" "phpunit/phpunit:^9.3.7" --no-update --no-interaction
+ if: "matrix.laravel == '11'"
- name: Install PHP Dependencies
uses: nick-invision/retry@v1
@@ -86,7 +68,7 @@ jobs:
run: ./vendor/bin/phpunit --coverage-clover clover.xml
- name: Execute code style checks
- run: ./vendor/bin/phpcs --standard=PSR2 -p --ignore=./tests/storage/* --report=full --report-checkstyle=build/logs/checkstyle.xml src/ tests/
+ run: ./vendor/bin/phpcs --standard=PSR2 -p --ignore=./tests/storage/* src/ tests/
- name: Check code coverage
if: ${{ matrix.php == '8.1' }}
diff --git a/composer.json b/composer.json
index 300ea98..4219847 100644
--- a/composer.json
+++ b/composer.json
@@ -14,22 +14,18 @@
}
],
"require": {
- "php": "^7.4 || ^8.0",
- "twig/twig": "~3.0",
- "illuminate/support": "^6|^7|^8|^9",
- "illuminate/view": "^6|^7|^8|^9"
+ "php": "^8.1",
+ "twig/twig": "~3.9",
+ "illuminate/support": "^9|^10|^11",
+ "illuminate/view": "^9|^10|^11"
},
"require-dev": {
"ext-json": "*",
- "laravel/framework": "^6|^7|^8|^9",
+ "laravel/framework": "^9|^10|^11",
"mockery/mockery": "^1.3.1",
- "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.7",
+ "phpunit/phpunit": "^8.5.8 || ^9.3.7",
"squizlabs/php_codesniffer": "^3.6"
},
- "suggest": {
- "twig/extensions": "~1.0",
- "laravelcollective/html": "For bringing back html/form in Laravel 5.x"
- },
"autoload": {
"psr-4": {
"TwigBridge\\": "src",
@@ -38,7 +34,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "0.13-dev"
+ "dev-master": "0.14-dev"
},
"laravel": {
"providers": [
diff --git a/phpunit.xml b/phpunit.xml
index 0dc1b28..4e92ed0 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -14,30 +14,5 @@
./tests/
-
-
- ./src
-
- ./src/config
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Extension/Laravel/Dump.php b/src/Extension/Laravel/Dump.php
index 39904cd..7a253c5 100644
--- a/src/Extension/Laravel/Dump.php
+++ b/src/Extension/Laravel/Dump.php
@@ -28,7 +28,10 @@
*/
class Dump extends AbstractExtension
{
- private VarCloner $cloner;
+ /**
+ * @var \Symfony\Component\VarDumper\Cloner\VarCloner
+ */
+ protected $cloner;
public function __construct()
{
diff --git a/src/Extension/Loader/Loader.php b/src/Extension/Loader/Loader.php
index 97a60f4..3a4d4d7 100644
--- a/src/Extension/Loader/Loader.php
+++ b/src/Extension/Loader/Loader.php
@@ -25,6 +25,11 @@ abstract class Loader extends AbstractExtension
{
protected Config $config;
+ /**
+ * @var \Illuminate\Config\Repository
+ */
+ protected $config;
+
/**
* Create a new loader extension.
*
diff --git a/src/Node/EventNode.php b/src/Node/EventNode.php
index c09d9e1..286fa81 100644
--- a/src/Node/EventNode.php
+++ b/src/Node/EventNode.php
@@ -6,9 +6,11 @@
use Illuminate\Support\Str;
use Illuminate\View\View;
use Illuminate\View\ViewName;
+use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Node;
+#[YieldReady]
class EventNode extends Node
{
@@ -16,10 +18,7 @@ public function compile(Compiler $compiler): void
{
$compiler
->write(
- sprintf(
- '$context = ' .
- EventNode::class . '::triggerLaravelEvents($this->getTemplateName(), $context);'
- )
+ '$context = ' . EventNode::class . '::triggerLaravelEvents($this->getTemplateName(), $context);'
)
->raw("\n");
}
diff --git a/src/Node/GetAttrNode.php b/src/Node/GetAttrNode.php
index 463bc5a..af4990b 100644
--- a/src/Node/GetAttrNode.php
+++ b/src/Node/GetAttrNode.php
@@ -7,9 +7,11 @@
*/
namespace TwigBridge\Node;
+use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Environment;
use Twig\Error\RuntimeError;
+use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Node\Expression\GetAttrExpression;
use Twig\Node\Node;
@@ -23,6 +25,7 @@
* - https://github.com/rcrowe/TwigBridge/issues/362
* - https://github.com/rcrowe/TwigBridge/issues/265
*/
+#[YieldReady]
class GetAttrNode extends GetAttrExpression
{
/**
@@ -144,7 +147,7 @@ public static function attribute(
return $object->$item;
}
- return \twig_get_attribute(
+ return CoreExtension::getAttribute(
$env,
$source,
$object,
@@ -152,9 +155,7 @@ public static function attribute(
$arguments,
$type,
$isDefinedTest,
- $ignoreStrictCheck,
- $sandboxed,
- $lineno
+ $ignoreStrictCheck
);
}
}
diff --git a/tests/Node/GetAttrTest.php b/tests/Node/GetAttrTest.php
index 1312ee3..8deffb5 100644
--- a/tests/Node/GetAttrTest.php
+++ b/tests/Node/GetAttrTest.php
@@ -137,7 +137,7 @@ public function getTests()
$tests[] = [
$node,
sprintf(
- '%s%s, "bar", [0 => %s, 1 => "bar"], "method", false, false, false, 1)',
+ '%s%s, "bar", [%s, "bar"], "method", false, false, false, 1)',
$this->getAttributeGetter(),
$this->getVariableGetter('foo', 1),
$this->getVariableGetter('foo')