Merge branch '4.3' into 4.4

* 4.3:
  [ProxyManager] fix generating proxies for root-namespaced classes
  [DI] skip looking for config class when the extension class is anonymous
  Fix typo
  [Dotenv] FIX missing getenv
  [HttpClient][Psr18Client] Remove Psr18ExceptionTrait
This commit is contained in:
Nicolas Grekas 2019-12-19 16:57:49 +01:00
commit c4ec3c24f2
7 changed files with 33 additions and 15 deletions

View File

@ -85,6 +85,7 @@ EOF;
public function getProxyCode(Definition $definition): string
{
$code = $this->classGenerator->generate($this->generateProxyClass($definition));
$code = preg_replace('/^(class [^ ]++ extends )([^\\\\])/', '$1\\\\$2', $code);
if (version_compare(self::getProxyManagerVersion(), '2.2', '<')) {
$code = preg_replace(

View File

@ -21,5 +21,5 @@ class LazyServiceProjectServiceContainer extends Container
}
}
class stdClass_%s extends %SstdClass implements \ProxyManager\%s
class stdClass_%s extends \stdClass implements \ProxyManager\%s
{%a}%A

View File

@ -80,6 +80,11 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
public function getConfiguration(array $config, ContainerBuilder $container)
{
$class = \get_class($this);
if (false !== strpos($class, "\0")) {
return null; // ignore anonymous classes
}
$class = substr_replace($class, '\Configuration', strrpos($class, '\\'));
$class = $container->getReflectionClass($class);

View File

@ -463,7 +463,7 @@ final class Dotenv
} elseif (isset($this->values[$name])) {
$value = $this->values[$name];
} else {
$value = '';
$value = (string) getenv($name);
}
if ('' === $value && isset($matches['default_value']) && '' !== $matches['default_value']) {

View File

@ -443,6 +443,17 @@ class DotenvTest extends TestCase
}
}
public function testGetVariablesValueFromGetenv()
{
putenv('Foo=Bar');
$dotenv = new Dotenv(true);
$values = $dotenv->parse('Foo=${Foo}');
$this->assertSame('Bar', $values['Foo']);
putenv('Foo');
}
/**
* @group legacy
* @expectedDeprecation The default value of "$usePutenv" argument of "%s" will be changed from "true" to "false" in Symfony 5.0. You should define its value explicitly.

View File

@ -190,7 +190,7 @@ final class Psr18Client implements ClientInterface, RequestFactoryInterface, Str
/**
* @internal
*/
trait Psr18ExceptionTrait
class Psr18NetworkException extends \RuntimeException implements NetworkExceptionInterface
{
private $request;
@ -206,18 +206,21 @@ trait Psr18ExceptionTrait
}
}
/**
* @internal
*/
class Psr18NetworkException extends \RuntimeException implements NetworkExceptionInterface
{
use Psr18ExceptionTrait;
}
/**
* @internal
*/
class Psr18RequestException extends \InvalidArgumentException implements RequestExceptionInterface
{
use Psr18ExceptionTrait;
private $request;
public function __construct(TransportExceptionInterface $e, RequestInterface $request)
{
parent::__construct($e->getMessage(), 0, $e);
$this->request = $request;
}
public function getRequest(): RequestInterface
{
return $this->request;
}
}

View File

@ -401,13 +401,11 @@ class NativeSessionStorage implements SessionStorageInterface
* ini_set('session.save_path', '/tmp');
*
* or pass in a \SessionHandler instance which configures session.save_handler in the
* constructor, for a template see NativeFileSessionHandler or use handlers in
* composer package drak/native-session
* constructor, for a template see NativeFileSessionHandler.
*
* @see https://php.net/session-set-save-handler
* @see https://php.net/sessionhandlerinterface
* @see https://php.net/sessionhandler
* @see https://github.com/zikula/NativeSession
*
* @param AbstractProxy|\SessionHandlerInterface|null $saveHandler
*