N°5122 - Minor libs update according to new PHP min version

This commit is contained in:
Molkobain
2022-08-23 11:26:47 +02:00
parent 7b60c9c71a
commit bbb5b86864
15 changed files with 182 additions and 240 deletions

View File

@@ -9,6 +9,9 @@ on:
env:
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1
permissions:
contents: read
jobs:
tests:
name: "PHP ${{ matrix.php-version }}"

View File

@@ -6,6 +6,9 @@ on:
branches:
- '3.x'
permissions:
contents: read
jobs:
build:
name: "Build"

View File

@@ -1,3 +1,9 @@
# 3.4.2 (2022-08-12)
* Allow inherited magic method to still run with calling class
* Fix CallExpression::reflectCallable() throwing TypeError
* Fix typo in naming (currency_code)
# 3.4.1 (2022-05-17)
* Fix optimizing non-public named closures

View File

@@ -38,11 +38,11 @@ use Twig\TokenParser\TokenParserInterface;
*/
class Environment
{
public const VERSION = '3.4.1';
public const VERSION_ID = 30401;
public const VERSION = '3.4.2';
public const VERSION_ID = 30402;
public const MAJOR_VERSION = 3;
public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 1;
public const RELEASE_VERSION = 2;
public const EXTRA_VERSION = '';
private $charset;

View File

@@ -290,7 +290,12 @@ abstract class CallExpression extends AbstractExpression
}
$checkVisibility = $callable instanceof \Closure;
$r = new \ReflectionFunction(\Closure::fromCallable($callable));
try {
$closure = \Closure::fromCallable($callable);
} catch (\TypeError $e) {
throw new \LogicException(sprintf('Callback for %s "%s" is not callable in the current scope.', $this->getAttribute('type'), $this->getAttribute('name')), 0, $e);
}
$r = new \ReflectionFunction($closure);
if (false !== strpos($r->name, '{closure}')) {
return $this->reflector = [$r, $callable, 'Closure'];
@@ -300,8 +305,7 @@ abstract class CallExpression extends AbstractExpression
$callable = [$object, $r->name];
$callableName = (\function_exists('get_debug_type') ? get_debug_type($object) : \get_class($object)).'::'.$r->name;
} elseif ($class = $r->getClosureScopeClass()) {
$callable = [$class, $r->name];
$callableName = $class.'::'.$r->name;
$callableName = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name;
} else {
$callable = $callableName = $r->name;
}