Make PHP 8 green on Travis
This commit is contained in:
parent
896b69c907
commit
571d46cf01
@ -32,8 +32,6 @@ matrix:
|
|||||||
- php: nightly
|
- php: nightly
|
||||||
services: [memcached]
|
services: [memcached]
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
|
||||||
- php: nightly
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
@ -264,6 +262,7 @@ install:
|
|||||||
# Set composer's platform to php 7.4 if we're on php 8.
|
# Set composer's platform to php 7.4 if we're on php 8.
|
||||||
if [[ $PHP = nightly ]]; then
|
if [[ $PHP = nightly ]]; then
|
||||||
composer config platform.php 7.4.99
|
composer config platform.php 7.4.99
|
||||||
|
export SYMFONY_DEPRECATIONS_HELPER=weak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- |
|
- |
|
||||||
|
@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
|
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
|
||||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic;
|
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic;
|
||||||
|
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\MultipleArgumentsOptionalScalarNotReallyOptional;
|
||||||
use Symfony\Component\DependencyInjection\TypedReference;
|
use Symfony\Component\DependencyInjection\TypedReference;
|
||||||
|
|
||||||
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
|
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
|
||||||
@ -473,6 +474,9 @@ class AutowirePassTest extends TestCase
|
|||||||
(new AutowirePass())->process($container);
|
(new AutowirePass())->process($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @requires PHP < 8
|
||||||
|
*/
|
||||||
public function testOptionalScalarNotReallyOptionalUsesDefaultValue()
|
public function testOptionalScalarNotReallyOptionalUsesDefaultValue()
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\includes;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\Tests\Compiler\A;
|
||||||
|
use Symfony\Component\DependencyInjection\Tests\Compiler\Lille;
|
||||||
|
|
||||||
|
class MultipleArgumentsOptionalScalarNotReallyOptional
|
||||||
|
{
|
||||||
|
public function __construct(A $a, $foo = 'default_val', Lille $lille)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -184,12 +184,6 @@ class MultipleArgumentsOptionalScalarLast
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class MultipleArgumentsOptionalScalarNotReallyOptional
|
|
||||||
{
|
|
||||||
public function __construct(A $a, $foo = 'default_val', Lille $lille)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Classes used for testing createResourceForClass
|
* Classes used for testing createResourceForClass
|
||||||
|
@ -216,10 +216,10 @@ class ArgumentResolverTest extends TestCase
|
|||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$request->attributes->set('foo', 'foo');
|
$request->attributes->set('foo', 'foo');
|
||||||
$request->attributes->set('bar', new \stdClass());
|
$request->attributes->set('bar', new \stdClass());
|
||||||
$request->attributes->set('mandatory', 'mandatory');
|
$request->attributes->set('last', 'last');
|
||||||
$controller = [new NullableController(), 'action'];
|
$controller = [new NullableController(), 'action'];
|
||||||
|
|
||||||
$this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], self::$resolver->getArguments($request, $controller));
|
$this->assertEquals(['foo', new \stdClass(), 'value', 'last'], self::$resolver->getArguments($request, $controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,10 +228,10 @@ class ArgumentResolverTest extends TestCase
|
|||||||
public function testGetNullableArgumentsWithDefaults()
|
public function testGetNullableArgumentsWithDefaults()
|
||||||
{
|
{
|
||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$request->attributes->set('mandatory', 'mandatory');
|
$request->attributes->set('last', 'last');
|
||||||
$controller = [new NullableController(), 'action'];
|
$controller = [new NullableController(), 'action'];
|
||||||
|
|
||||||
$this->assertEquals([null, null, 'value', 'mandatory'], self::$resolver->getArguments($request, $controller));
|
$this->assertEquals([null, null, 'value', 'last'], self::$resolver->getArguments($request, $controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSessionArguments()
|
public function testGetSessionArguments()
|
||||||
|
@ -15,7 +15,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
|
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
|
||||||
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController;
|
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\LegacyNullableController;
|
||||||
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController;
|
use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController;
|
||||||
|
|
||||||
class ControllerResolverTest extends TestCase
|
class ControllerResolverTest extends TestCase
|
||||||
@ -243,6 +243,7 @@ class ControllerResolverTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP 7.1
|
* @requires PHP 7.1
|
||||||
|
* @requires PHP < 8
|
||||||
* @group legacy
|
* @group legacy
|
||||||
*/
|
*/
|
||||||
public function testGetNullableArguments()
|
public function testGetNullableArguments()
|
||||||
@ -253,12 +254,13 @@ class ControllerResolverTest extends TestCase
|
|||||||
$request->attributes->set('foo', 'foo');
|
$request->attributes->set('foo', 'foo');
|
||||||
$request->attributes->set('bar', new \stdClass());
|
$request->attributes->set('bar', new \stdClass());
|
||||||
$request->attributes->set('mandatory', 'mandatory');
|
$request->attributes->set('mandatory', 'mandatory');
|
||||||
$controller = [new NullableController(), 'action'];
|
$controller = [new LegacyNullableController(), 'action'];
|
||||||
$this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], $resolver->getArguments($request, $controller));
|
$this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], $resolver->getArguments($request, $controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP 7.1
|
* @requires PHP 7.1
|
||||||
|
* @requires PHP < 8
|
||||||
* @group legacy
|
* @group legacy
|
||||||
*/
|
*/
|
||||||
public function testGetNullableArgumentsWithDefaults()
|
public function testGetNullableArgumentsWithDefaults()
|
||||||
@ -267,7 +269,7 @@ class ControllerResolverTest extends TestCase
|
|||||||
|
|
||||||
$request = Request::create('/');
|
$request = Request::create('/');
|
||||||
$request->attributes->set('mandatory', 'mandatory');
|
$request->attributes->set('mandatory', 'mandatory');
|
||||||
$controller = [new NullableController(), 'action'];
|
$controller = [new LegacyNullableController(), 'action'];
|
||||||
$this->assertEquals([null, null, 'value', 'mandatory'], $resolver->getArguments($request, $controller));
|
$this->assertEquals([null, null, 'value', 'mandatory'], $resolver->getArguments($request, $controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class ArgumentMetadataFactoryTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new ArgumentMetadata('foo', 'array', false, true, null, true),
|
new ArgumentMetadata('foo', 'array', false, true, null, true),
|
||||||
new ArgumentMetadata('bar', null, false, false, null),
|
new ArgumentMetadata('bar', null, false, true, null, true),
|
||||||
], $arguments);
|
], $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class ArgumentMetadataFactoryTest extends TestCase
|
|||||||
new ArgumentMetadata('foo', 'string', false, false, null, true),
|
new ArgumentMetadata('foo', 'string', false, false, null, true),
|
||||||
new ArgumentMetadata('bar', \stdClass::class, false, false, null, true),
|
new ArgumentMetadata('bar', \stdClass::class, false, false, null, true),
|
||||||
new ArgumentMetadata('baz', 'string', false, true, 'value', true),
|
new ArgumentMetadata('baz', 'string', false, true, 'value', true),
|
||||||
new ArgumentMetadata('mandatory', null, false, false, null, true),
|
new ArgumentMetadata('last', 'string', false, true, '', false),
|
||||||
], $arguments);
|
], $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ class ArgumentMetadataFactoryTest extends TestCase
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function signature5(array $foo = null, $bar)
|
private function signature5(array $foo = null, $bar = null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller;
|
||||||
|
|
||||||
|
class LegacyNullableController
|
||||||
|
{
|
||||||
|
public function action(?string $foo, ?\stdClass $bar, ?string $baz = 'value', $mandatory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller;
|
|||||||
|
|
||||||
class NullableController
|
class NullableController
|
||||||
{
|
{
|
||||||
public function action(?string $foo, ?\stdClass $bar, ?string $baz = 'value', $mandatory)
|
public function action(?string $foo, ?\stdClass $bar, ?string $baz = 'value', string $last = '')
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ class UnixPipes extends AbstractPipes
|
|||||||
$read[$type = array_search($pipe, $this->pipes, true)] = '';
|
$read[$type = array_search($pipe, $this->pipes, true)] = '';
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$data = fread($pipe, self::CHUNK_SIZE);
|
$data = @fread($pipe, self::CHUNK_SIZE);
|
||||||
$read[$type] .= $data;
|
$read[$type] .= $data;
|
||||||
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
|
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
|
||||||
|
|
||||||
|
@ -987,16 +987,23 @@ class ProcessTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testWrongSignal($signal)
|
public function testWrongSignal($signal)
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\Process\Exception\RuntimeException');
|
|
||||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\PHP_VERSION_ID < 80000 || \is_int($signal)) {
|
||||||
|
$this->expectException(RuntimeException::class);
|
||||||
|
} else {
|
||||||
|
$this->expectException('TypeError');
|
||||||
|
}
|
||||||
|
|
||||||
$process = $this->getProcessForCode('sleep(38);');
|
$process = $this->getProcessForCode('sleep(38);');
|
||||||
$process->start();
|
$process->start();
|
||||||
try {
|
try {
|
||||||
$process->signal($signal);
|
$process->signal($signal);
|
||||||
$this->fail('A RuntimeException must have been thrown');
|
$this->fail('A RuntimeException must have been thrown');
|
||||||
|
} catch (\TypeError $e) {
|
||||||
|
$process->stop(0);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
$process->stop(0);
|
$process->stop(0);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
|
|||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
protected function getAttributes($object, $format = null, array $context)
|
protected function getAttributes($object, $format, array $context)
|
||||||
{
|
{
|
||||||
$class = \get_class($object);
|
$class = \get_class($object);
|
||||||
$key = $class.'-'.$context['cache_key'];
|
$key = $class.'-'.$context['cache_key'];
|
||||||
|
@ -728,7 +728,7 @@ class GetConstructorArgsWithDefaultValueDummy
|
|||||||
protected $foo;
|
protected $foo;
|
||||||
protected $bar;
|
protected $bar;
|
||||||
|
|
||||||
public function __construct($foo = [], $bar)
|
public function __construct($foo = [], $bar = null)
|
||||||
{
|
{
|
||||||
$this->foo = $foo;
|
$this->foo = $foo;
|
||||||
$this->bar = $bar;
|
$this->bar = $bar;
|
||||||
|
@ -925,7 +925,7 @@ class ObjectConstructorArgsWithDefaultValueDummy
|
|||||||
protected $foo;
|
protected $foo;
|
||||||
protected $bar;
|
protected $bar;
|
||||||
|
|
||||||
public function __construct($foo = [], $bar)
|
public function __construct($foo = [], $bar = null)
|
||||||
{
|
{
|
||||||
$this->foo = $foo;
|
$this->foo = $foo;
|
||||||
$this->bar = $bar;
|
$this->bar = $bar;
|
||||||
@ -1075,7 +1075,7 @@ class DummyWithConstructorObjectAndDefaultValue
|
|||||||
private $foo;
|
private $foo;
|
||||||
private $inner;
|
private $inner;
|
||||||
|
|
||||||
public function __construct($foo = 'a', ObjectInner $inner)
|
public function __construct($foo = 'a', ObjectInner $inner = null)
|
||||||
{
|
{
|
||||||
$this->foo = $foo;
|
$this->foo = $foo;
|
||||||
$this->inner = $inner;
|
$this->inner = $inner;
|
||||||
|
Reference in New Issue
Block a user