mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 06:56:51 +00:00
added PHP 8.1 as experimental
This commit is contained in:
committed by
Fabien Potencier
parent
ad02eb9236
commit
bef89dcc1e
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
|
|
||||||
continue-on-error: true
|
continue-on-error: ${{ matrix.experimental }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -24,6 +24,10 @@ jobs:
|
|||||||
- '7.3'
|
- '7.3'
|
||||||
- '7.4'
|
- '7.4'
|
||||||
- '8.0'
|
- '8.0'
|
||||||
|
composer-options: ['']
|
||||||
|
experimental: [false]
|
||||||
|
include:
|
||||||
|
- { php-version: '8.1', experimental: true, composer-options: '--ignore-platform-req=php' }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
@@ -51,7 +55,7 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
|
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
|
||||||
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-
|
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-
|
||||||
|
|
||||||
- run: composer install
|
- run: composer install ${{ matrix.composer-options }}
|
||||||
|
|
||||||
- name: "Install PHPUnit"
|
- name: "Install PHPUnit"
|
||||||
run: vendor/bin/simple-phpunit install
|
run: vendor/bin/simple-phpunit install
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ class Environment
|
|||||||
], $options);
|
], $options);
|
||||||
|
|
||||||
$this->debug = (bool) $options['debug'];
|
$this->debug = (bool) $options['debug'];
|
||||||
$this->charset = strtoupper($options['charset']);
|
$this->charset = null === $options['charset'] ? null : strtoupper($options['charset']);
|
||||||
$this->baseTemplateClass = $options['base_template_class'];
|
$this->baseTemplateClass = $options['base_template_class'];
|
||||||
$this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
|
$this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
|
||||||
$this->strictVariables = (bool) $options['strict_variables'];
|
$this->strictVariables = (bool) $options['strict_variables'];
|
||||||
|
|||||||
+1
-1
@@ -268,7 +268,7 @@ class Error extends \Exception
|
|||||||
foreach ($backtrace as $trace) {
|
foreach ($backtrace as $trace) {
|
||||||
if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) {
|
if (isset($trace['object']) && $trace['object'] instanceof Template && 'Twig_Template' !== \get_class($trace['object'])) {
|
||||||
$currentClass = \get_class($trace['object']);
|
$currentClass = \get_class($trace['object']);
|
||||||
$isEmbedContainer = 0 === strpos($templateClass, $currentClass);
|
$isEmbedContainer = null === $templateClass ? false : 0 === strpos($templateClass, $currentClass);
|
||||||
if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
|
if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
|
||||||
$template = $trace['object'];
|
$template = $trace['object'];
|
||||||
$templateClass = \get_class($trace['object']);
|
$templateClass = \get_class($trace['object']);
|
||||||
|
|||||||
@@ -489,6 +489,9 @@ function twig_date_converter(Environment $env, $date = null, $timezone = null)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $date || 'now' === $date) {
|
if (null === $date || 'now' === $date) {
|
||||||
|
if ($date === null) {
|
||||||
|
$date = 'now';
|
||||||
|
}
|
||||||
return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone());
|
return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension('\Twig\Extension\CoreExtension')->getTimezone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, Source
|
|||||||
public function __construct($paths = [], $rootPath = null)
|
public function __construct($paths = [], $rootPath = null)
|
||||||
{
|
{
|
||||||
$this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
|
$this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
|
||||||
if (false !== $realPath = realpath($rootPath)) {
|
if ($rootPath !== null && false !== ($realPath = realpath($rootPath))) {
|
||||||
$this->rootPath = $realPath.\DIRECTORY_SEPARATOR;
|
$this->rootPath = $realPath.\DIRECTORY_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user