Skip to content

Commit 9666876

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Tweaking class not found autowiring error [TwigBridge] Add missing dev requirement for workflow fixed symfony#25440 empty lines don't count for indent detection
2 parents f07430f + fad5e5f commit 9666876

File tree

8 files changed

+34
-15
lines changed

8 files changed

+34
-15
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ class WorkflowExtensionTest extends TestCase
2525

2626
protected function setUp()
2727
{
28-
if (!class_exists(Workflow::class)) {
29-
$this->markTestSkipped('The Workflow component is needed to run tests for this extension.');
30-
}
31-
3228
$places = array('ordered', 'waiting_for_payment', 'processed');
3329
$transitions = array(
3430
new Transition('t1', 'ordered', 'waiting_for_payment'),

src/Symfony/Bridge/Twig/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"twig/twig": "^1.35|^2.4.4"
2121
},
2222
"require-dev": {
23-
"fig/link-util": "^1.0",
2423
"symfony/asset": "~2.8|~3.0|~4.0",
2524
"symfony/dependency-injection": "~2.8|~3.0|~4.0",
2625
"symfony/finder": "~2.8|~3.0|~4.0",
@@ -38,7 +37,8 @@
3837
"symfony/console": "~3.4|~4.0",
3938
"symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0",
4039
"symfony/expression-language": "~2.8|~3.0|~4.0",
41-
"symfony/web-link": "~3.3|~4.0"
40+
"symfony/web-link": "~3.3|~4.0",
41+
"symfony/workflow": "~3.3|~4.0"
4242
},
4343
"conflict": {
4444
"symfony/form": "<3.4",

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\Config\Resource\ClassExistenceResource;
1415
use Symfony\Component\DependencyInjection\Config\AutowireServiceResource;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Definition;
@@ -442,7 +443,17 @@ private function createAutowiredDefinition($type)
442443
private function createTypeNotFoundMessage(TypedReference $reference, $label)
443444
{
444445
if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) {
445-
$message = sprintf('has type "%s" but this class cannot be loaded.', $type);
446+
// either $type does not exist or a parent class does not exist
447+
try {
448+
$resource = new ClassExistenceResource($type, false);
449+
// isFresh() will explode ONLY if a parent class/trait does not exist
450+
$resource->isFresh(0);
451+
$parentMsg = false;
452+
} catch (\ReflectionException $e) {
453+
$parentMsg = $e->getMessage();
454+
}
455+
456+
$message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found');
446457
} else {
447458
$message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists';
448459
$message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $this->createTypeAlternatives($reference));

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public function testDontTriggerAutowiring()
372372

373373
/**
374374
* @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
375-
* @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class cannot be loaded.
375+
* @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.
376376
*/
377377
public function testClassNotFoundThrowsException()
378378
{
@@ -389,7 +389,7 @@ public function testClassNotFoundThrowsException()
389389

390390
/**
391391
* @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
392-
* @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class cannot be loaded.
392+
* @expectedExceptionMessage Cannot autowire service "a": argument "$r" of method "Symfony\Component\DependencyInjection\Tests\Compiler\BadParentTypeHintedArgument::__construct()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\OptionalServiceClass" but this class is missing a parent class (Class Symfony\Bug\NotExistClass not found).
393393
*/
394394
public function testParentClassNotFoundThrowsException()
395395
{
@@ -789,7 +789,7 @@ public function testNotWireableCalls($method, $expectedMsg)
789789
public function provideNotWireableCalls()
790790
{
791791
return array(
792-
array('setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class cannot be loaded.'),
792+
array('setNotAutowireable', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireable()" has type "Symfony\Component\DependencyInjection\Tests\Compiler\NotARealClass" but this class was not found.'),
793793
array('setDifferentNamespace', 'Cannot autowire service "foo": argument "$n" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setDifferentNamespace()" references class "stdClass" but no such service exists. It cannot be auto-registered because it is from a different root namespace.'),
794794
array(null, 'Invalid service "foo": method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setProtectedMethod()" must be public.'),
795795
);

src/Symfony/Component/DependencyInjection/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them"
3333
},
3434
"conflict": {
35-
"symfony/config": "<3.3.1",
35+
"symfony/config": "<3.3.7",
3636
"symfony/finder": "<3.3",
3737
"symfony/proxy-manager-bridge": "<3.4",
3838
"symfony/yaml": "<3.4"

src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function execute()
7373
$func = 'ldap_search';
7474
break;
7575
default:
76-
throw new LdapException(sprintf('Could not search in scope %s', $this->options['scopen']));
76+
throw new LdapException(sprintf('Could not search in scope "%s"', $this->options['scope']));
7777
}
7878

7979
$this->search = @$func(

src/Symfony/Component/Yaml/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
577577
do {
578578
$EOF = false;
579579

580-
// comment-like lines do not influence the indentation depth
581-
if ($this->isCurrentLineComment()) {
580+
// empty and comment-like lines do not influence the indentation depth
581+
if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
582582
$EOF = !$this->moveToNextLine();
583583

584584
if (!$EOF) {
@@ -605,7 +605,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
605605
$data = array();
606606
if ($this->getCurrentLineIndentation() >= $newIndent) {
607607
$data[] = substr($this->currentLine, $newIndent);
608-
} elseif ($this->isCurrentLineComment()) {
608+
} elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
609609
$data[] = $this->currentLine;
610610
} else {
611611
$this->moveToPreviousLine();

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,18 @@ public function indentedMappingData()
21502150
);
21512151
$tests['mapping in sequence starting on a new line'] = array($yaml, $expected);
21522152

2153+
$yaml = <<<YAML
2154+
foo:
2155+
2156+
bar: baz
2157+
YAML;
2158+
$expected = array(
2159+
'foo' => array(
2160+
'bar' => 'baz',
2161+
),
2162+
);
2163+
$tests['blank line at the beginning of an indented mapping value'] = array($yaml, $expected);
2164+
21532165
return $tests;
21542166
}
21552167
}

0 commit comments

Comments
 (0)