Merge branch '5.0'

* 5.0:
  Fix failures on PHP 7.4
  Fix tests
  [Console] fix typos
  [Console] fix tests
This commit is contained in:
Nicolas Grekas 2019-12-01 11:51:31 +01:00
commit 861fb4b520
7 changed files with 16 additions and 13 deletions

View File

@ -72,7 +72,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
spl_autoload_register(__CLASS__.'::throwOnRequiredClass');
}
$autoloadedClass = self::$autoloadedClass;
self::$autoloadedClass = $this->resource;
self::$autoloadedClass = ltrim($this->resource, '\\');
try {
$exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
@ -153,7 +153,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
throw $e;
}
$trace = $e->getTrace();
$trace = debug_backtrace();
$autoloadFrame = [
'function' => 'spl_autoload_call',
'args' => [$class],

View File

@ -230,7 +230,7 @@ class QuestionHelper extends Helper
} elseif ("\177" === $c) { // Backspace Character
if (0 === $numMatches && 0 !== $i) {
--$i;
$fullChoice = self::substr($fullChoice, 0, -1);
$fullChoice = self::substr($fullChoice, 0, $i);
// Move cursor backwards
$output->write("\033[1D");
}
@ -286,6 +286,8 @@ class QuestionHelper extends Helper
$output->write($c);
break;
}
$numMatches = 0;
}
continue;

View File

@ -194,7 +194,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
// <DOWN ARROW><NEWLINE>
// S<BACKSPACE><BACKSPACE><DOWN ARROW><DOWN ARROW><NEWLINE>
// F00<BACKSPACE><BACKSPACE>oo<TAB><NEWLINE>
// F⭐<TAB><BACKSPACE><BACKSPACE>⭐<TAB><NEWLINE>
// F⭐<TAB><BACKSPACE><BACKSPACE>⭐<TAB><NEWLINE>
$inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\nF⭐\t\177\177\t\n");
$dialog = new QuestionHelper();
@ -774,7 +774,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
// F00<BACKSPACE><BACKSPACE>o<TAB>,A<DOWN ARROW>,<SPACE>SecurityBundle<NEWLINE>
// Acme<TAB>,<SPACE>As<TAB><29x BACKSPACE>S<TAB><NEWLINE>
// Ac<TAB>,As<TAB><3x BACKSPACE>d<TAB><NEWLINE>
$inputStream = $this->getInputStream("\nF\t\nA\033[A\033[A\033[A\t,F\t\nF00\177\177o\t,A\033[B\t, SecurityBundle\nSecurityBundle\nAcme\t, As\t\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177S\t\nAc\t,As\t\177\177\177d\t\n");
$inputStream = $this->getInputStream("\nF\t\nA\033[A\033[A\033[A\t,F\t\nF00\177\177o\t,A\033[B\t, SecurityBundle\nAcme\t, As\t\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177S\t\nAc\t,As\t\177\177\177d\t\n");
$dialog = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);

View File

@ -12,7 +12,7 @@ services:
bind:
Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface: '@Symfony\Component\DependencyInjection\Tests\Fixtures\Bar'
$foo: [ ~ ]
iterable $baz: !tagged_iterator bar
iterable $baz: !tagged_iterator { tag: bar }
Symfony\Component\DependencyInjection\Tests\Fixtures\Bar:
factory: [ ~, 'create' ]

View File

@ -113,7 +113,7 @@ EOF
public function testListMessages()
{
$sentToFailureStamp = new SentToFailureTransportStamp('async');
$redeliveryStamp = new RedeliveryStamp(0, 'failure_receiver', 'Things are bad!');
$redeliveryStamp = new RedeliveryStamp(0, 'Things are bad!');
$envelope = new Envelope(new \stdClass(), [
new TransportMessageIdStamp(15),
$sentToFailureStamp,
@ -158,7 +158,7 @@ EOF
$envelope = new Envelope(new \stdClass(), [
new TransportMessageIdStamp(15),
$sentToFailureStamp,
new RedeliveryStamp(0, 'failure_receiver', 'Things are bad!'),
new RedeliveryStamp(0, 'Things are bad!'),
]);
$receiver = $this->createMock(ListableReceiverInterface::class);
$receiver->expects($this->once())->method('all')->with()->willReturn([$envelope]);

View File

@ -188,13 +188,14 @@ class PropertyAccessor implements PropertyAccessorInterface
return;
}
if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file'] && \array_key_exists(0, $trace[$i]['args'])) {
if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file']) {
$pos = strpos($message, $delim = 'must be of the type ') ?: (strpos($message, $delim = 'must be an instance of ') ?: strpos($message, $delim = 'must implement interface '));
$pos += \strlen($delim);
$type = $trace[$i]['args'][0];
$type = \is_object($type) ? \get_class($type) : \gettype($type);
$j = strpos($message, ',', $pos);
$type = substr($message, 2 + $j, strpos($message, ' given', $j) - $j - 2);
$message = substr($message, $pos, $j - $pos);
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', substr($message, $pos, strpos($message, ',', $pos) - $pos), $type, $propertyPath));
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $message, 'NULL' === $type ? 'null' : $type, $propertyPath));
}
}

View File

@ -546,7 +546,7 @@ class PropertyAccessorTest extends TestCase
public function testThrowTypeErrorWithNullArgument()
{
$this->expectException('Symfony\Component\PropertyAccess\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Expected argument of type "DateTime", "NULL" given');
$this->expectExceptionMessage('Expected argument of type "DateTime", "null" given');
$object = new TypeHinted();
$this->propertyAccessor->setValue($object, 'date', null);