Merge branch '5.1' into 5.x

This commit is contained in:
Alexander M. Turek 2020-11-07 14:01:53 +01:00
commit 5c5b8d61ee
2 changed files with 5 additions and 13 deletions

View File

@ -11,9 +11,10 @@
namespace Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper; namespace Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper;
use ProxyManager\Exception\ExceptionInterface;
use ProxyManager\Generator\ClassGenerator; use ProxyManager\Generator\ClassGenerator;
use ProxyManager\Generator\MethodGenerator;
use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy; use ProxyManager\GeneratorStrategy\BaseGeneratorStrategy;
use ProxyManager\Version;
use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
@ -83,7 +84,7 @@ EOF;
$code = $this->classGenerator->generate($this->generateProxyClass($definition)); $code = $this->classGenerator->generate($this->generateProxyClass($definition));
$code = preg_replace('/^(class [^ ]++ extends )([^\\\\])/', '$1\\\\$2', $code); $code = preg_replace('/^(class [^ ]++ extends )([^\\\\])/', '$1\\\\$2', $code);
if (version_compare(self::getProxyManagerVersion(), '2.2', '<')) { if (!method_exists(MethodGenerator::class, 'fromReflectionWithoutBodyAndDocBlock')) { // proxy-manager < 2.2
$code = preg_replace( $code = preg_replace(
'/((?:\$(?:this|initializer|instance)->)?(?:publicProperties|initializer|valueHolder))[0-9a-f]++/', '/((?:\$(?:this|initializer|instance)->)?(?:publicProperties|initializer|valueHolder))[0-9a-f]++/',
'${1}'.$this->getIdentifierSuffix($definition), '${1}'.$this->getIdentifierSuffix($definition),
@ -91,22 +92,13 @@ EOF;
); );
} }
if (version_compare(self::getProxyManagerVersion(), '2.5', '<')) { if (!is_subclass_of(ExceptionInterface::class, 'Throwable')) { // proxy-manager < 2.5
$code = preg_replace('/ \\\\Closure::bind\(function ((?:& )?\(\$instance(?:, \$value)?\))/', ' \Closure::bind(static function \1', $code); $code = preg_replace('/ \\\\Closure::bind\(function ((?:& )?\(\$instance(?:, \$value)?\))/', ' \Closure::bind(static function \1', $code);
} }
return $code; return $code;
} }
private static function getProxyManagerVersion(): string
{
if (!class_exists(Version::class)) {
return '0.0.1';
}
return \defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion();
}
/** /**
* Produces the proxy class name for the given definition. * Produces the proxy class name for the given definition.
*/ */

View File

@ -62,7 +62,7 @@ class DoctrineIntegrationTest extends TestCase
->select('m.available_at') ->select('m.available_at')
->from('messenger_messages', 'm') ->from('messenger_messages', 'm')
->where('m.body = :body') ->where('m.body = :body')
->setParameter(':body', '{"message": "Hi i am delayed"}') ->setParameter('body', '{"message": "Hi i am delayed"}')
->execute(); ->execute();
$available_at = new \DateTime($stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchOne() : $stmt->fetchColumn()); $available_at = new \DateTime($stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchOne() : $stmt->fetchColumn());