Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix deprecations on 4.3 #33000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix deprecation on 4.3
  • Loading branch information
jderusse committed Aug 7, 2019
commit 8fd16a6beef97910b6e2bf0d10547b31a314adc2
3 changes: 3 additions & 0 deletions 3 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ matrix:
env: deps=high
- php: 7.3
env: deps=low
- php: 7.4snapshot
allow_failures:
- php: 7.4snapshot
fast_finish: true

cache:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

class SunnyInterface_1eff735 implements \ProxyManager\Proxy\VirtualProxyInterface, \Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\DummyInterface, \Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\SunnyInterface
class SunnyInterface_%s implements \ProxyManager\Proxy\VirtualProxyInterface, \Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\DummyInterface, \Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\SunnyInterface
{

private $valueHolder1eff735 = null;
private $valueHolder%s = null;

private $initializer1eff735 = null;
private $initializer%s = null;

private static $publicProperties1eff735 = [
private static $publicProperties%s = [
%S
];

public function dummy()
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, 'dummy', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'dummy', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

if ($this->valueHolder1eff735 === $returnValue = $this->valueHolder1eff735->dummy()) {
if ($this->valueHolder%s === $returnValue = $this->valueHolder%s->dummy()) {
$returnValue = $this;
}

Expand All @@ -24,9 +24,9 @@ public function dummy()

public function & dummyRef()
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, 'dummyRef', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'dummyRef', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

if ($this->valueHolder1eff735 === $returnValue = &$this->valueHolder1eff735->dummyRef()) {
if ($this->valueHolder%s === $returnValue = &$this->valueHolder%s->dummyRef()) {
$returnValue = $this;
}

Expand All @@ -35,9 +35,9 @@ public function & dummyRef()

public function sunny()
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, 'sunny', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'sunny', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

if ($this->valueHolder1eff735 === $returnValue = $this->valueHolder1eff735->sunny()) {
if ($this->valueHolder%s === $returnValue = $this->valueHolder%s->sunny()) {
$returnValue = $this;
}

Expand All @@ -49,9 +49,9 @@ public static function staticProxyConstructor($initializer)
static $reflection;

$reflection = $reflection ?? new \ReflectionClass(__CLASS__);
$instance = $reflection->newInstanceWithoutConstructor();
$instance%w= $reflection->newInstanceWithoutConstructor();

$instance->initializer1eff735 = $initializer;
$instance->initializer%s = $initializer;

return $instance;
}
Expand All @@ -60,21 +60,21 @@ public function __construct()
{
static $reflection;

if (! $this->valueHolder1eff735) {
if (! $this->valueHolder%s) {
$reflection = $reflection ?? new \ReflectionClass(__CLASS__);
$this->valueHolder1eff735 = $reflection->newInstanceWithoutConstructor();
$this->valueHolder%s = $reflection->newInstanceWithoutConstructor();
}
}

public function & __get($name)
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__get', ['name' => $name], $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__get', ['name' => $name], $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

if (isset(self::$publicProperties1eff735[$name])) {
return $this->valueHolder1eff735->$name;
if (isset(self::$publicProperties%s[$name])) {
return $this->valueHolder%s->$name;
}

$targetObject = $this->valueHolder1eff735;
$targetObject = $this->valueHolder%s;

$backtrace = debug_backtrace(false);
trigger_error(
Expand All @@ -92,73 +92,73 @@ public function & __get($name)

public function __set($name, $value)
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__set', array('name' => $name, 'value' => $value), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__set', array('name' => $name, 'value' => $value), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

$targetObject = $this->valueHolder1eff735;
$targetObject = $this->valueHolder%s;

return $targetObject->$name = $value;
}

public function __isset($name)
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__isset', array('name' => $name), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__isset', array('name' => $name), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

$targetObject = $this->valueHolder1eff735;
$targetObject = $this->valueHolder%s;

return isset($targetObject->$name);
}

public function __unset($name)
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__unset', array('name' => $name), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__unset', array('name' => $name), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

$targetObject = $this->valueHolder1eff735;
$targetObject = $this->valueHolder%s;

unset($targetObject->$name);
return;
}

public function __clone()
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__clone', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__clone', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

$this->valueHolder1eff735 = clone $this->valueHolder1eff735;
$this->valueHolder%s = clone $this->valueHolder%s;
}

public function __sleep()
{
$this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, '__sleep', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
$this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, '__sleep', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;

return array('valueHolder1eff735');
return array('valueHolder%s');
}

public function __wakeup()
{
}

public function setProxyInitializer(\Closure $initializer = null)
public function setProxyInitializer(\Closure $initializer = null)%S
{
$this->initializer1eff735 = $initializer;
$this->initializer%s = $initializer;
}

public function getProxyInitializer()
public function getProxyInitializer()%S
{
return $this->initializer1eff735;
return $this->initializer%s;
}

public function initializeProxy() : bool
{
return $this->initializer1eff735 && ($this->initializer1eff735->__invoke($valueHolder1eff735, $this, 'initializeProxy', array(), $this->initializer1eff735) || 1) && $this->valueHolder1eff735 = $valueHolder1eff735;
return $this->initializer%s && ($this->initializer%s->__invoke($valueHolder%s, $this, 'initializeProxy', array(), $this->initializer%s) || 1) && $this->valueHolder%s = $valueHolder%s;
}

public function isProxyInitialized() : bool
{
return null !== $this->valueHolder1eff735;
return null !== $this->valueHolder%s;
}

public function getWrappedValueHolderValue()
public function getWrappedValueHolderValue()%S
{
return $this->valueHolder1eff735;
return $this->valueHolder%s;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ protected function createProxy(\$class, \Closure \$factory)
EOPHP;

$implem = preg_replace('#\n /\*\*.*?\*/#s', '', $implem);
$implem = str_replace('getWrappedValueHolderValue() : ?object', 'getWrappedValueHolderValue()', $implem);
$implem = str_replace("array(\n \n );", "[\n \n ];", $implem);
$this->assertStringEqualsFile(__DIR__.'/Fixtures/proxy-implem.php', $implem);

$this->assertStringMatchesFormatFile(__DIR__.'/Fixtures/proxy-implem.php', $implem);
$this->assertStringEqualsFile(__DIR__.'/Fixtures/proxy-factory.php', $factory);

require_once __DIR__.'/Fixtures/proxy-implem.php';
eval(preg_replace('/^<\?php/', '', $implem));
Copy link
Member Author

@jderusse jderusse Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since ProxyManager 2.2 the suffix in properties is predictable, BUT it vary with version of dependencies installed. Which make a simple assertEquals unusable. Now, proxy-implem.php contains a pattern to match, and $implem contains the true code to evaluate.

$factory = require __DIR__.'/Fixtures/proxy-factory.php';

$foo = $factory->getFooService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function testPrivateAlias()

$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:container', '--show-hidden' => true]);
$this->assertNotContains('public', $tester->getDisplay());
$this->assertNotContains('private_alias', $tester->getDisplay());
$this->assertStringNotContainsString('public', $tester->getDisplay());
$this->assertStringNotContainsString('private_alias', $tester->getDisplay());

$tester->run(['command' => 'debug:container']);
$this->assertStringContainsString('public', $tester->getDisplay());
Expand All @@ -77,7 +77,7 @@ public function testIgnoreBackslashWhenFindingService(string $validServiceId)

$tester = new ApplicationTester($application);
$tester->run(['command' => 'debug:container', 'name' => $validServiceId]);
$this->assertNotContains('No services found', $tester->getDisplay());
$this->assertStringNotContainsString('No services found', $tester->getDisplay());
}

public function testDescribeEnvVars()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function testEncodePasswordSodiumOutput()
'user-class' => 'Custom\Class\Sodium\User',
], ['interactive' => false]);

$this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
$this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay());
}

public function testEncodePasswordNoConfigForGivenUserClass()
Expand Down
12 changes: 11 additions & 1 deletion 12 src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Cache\IntegrationTests\CachePoolTest;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Warning;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem;
Expand Down Expand Up @@ -120,7 +121,7 @@ public function testGetMetadata()
CacheItem::METADATA_EXPIRY => 9.5 + time(),
CacheItem::METADATA_CTIME => 1000,
];
$this->assertEquals($expected, $item->getMetadata(), 'Item metadata should embed expiry and ctime.', .6);
$this->assertEqualsWithDelta($expected, $item->getMetadata(), .6, 'Item metadata should embed expiry and ctime.');
}

public function testDefaultLifeTime()
Expand Down Expand Up @@ -252,6 +253,15 @@ public function testPrune()
$this->assertFalse($this->isPruned($cache, 'foo'));
$this->assertTrue($this->isPruned($cache, 'qux'));
}

public function testSavingObject()
{
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}

parent::testSavingObject();
}
}

class NotUnserializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;

class NodeDefinitionTest extends TestCase
{
public function testDefaultPathSeparatorIsDot()
{
$node = $this->getMockForAbstractClass(NodeDefinition::class, ['foo']);

$this->assertAttributeSame('.', 'pathSeparator', $node);
}

public function testSetPathSeparatorChangesChildren()
{
$node = new ArrayNodeDefinition('foo');
$scalar = new ScalarNodeDefinition('bar');
$node->append($scalar);

$node->setPathSeparator('/');

$this->assertAttributeSame('/', 'pathSeparator', $node);
$this->assertAttributeSame('/', 'pathSeparator', $scalar);
$parentNode = new ArrayNodeDefinition('name');
$childNode = $this->createMock(NodeDefinition::class);

$childNode
->expects($this->once())
->method('setPathSeparator')
->with('/');
$childNode
->expects($this->once())
->method('setParent')
->with($parentNode)
->willReturn($childNode);
$parentNode->append($childNode);

$parentNode->setPathSeparator('/');
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.