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

Commit ea12123

Browse filesBrowse files
committed
Merge branch '2.8' into 3.2
* 2.8: Revert "bug #21436 [DependencyInjection] check for circular refs caused by method calls (xabbuh)" Static code analysis with Php Inspections (EA Extended) [VarDumper] Added missing persistent stream cast
2 parents 1639edb + f53672f commit ea12123
Copy full SHA for ea12123

File tree

21 files changed

+39
-82
lines changed
Filter options

21 files changed

+39
-82
lines changed

‎src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ protected function getFragmentHandler($return)
6363

6464
$context->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/')));
6565

66-
$renderer = new FragmentHandler($context, array($strategy), false);
67-
68-
return $renderer;
66+
return new FragmentHandler($context, array($strategy), false);
6967
}
7068

7169
protected function renderTemplate(FragmentHandler $renderer, $template = '{{ render("foo") }}')

‎src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function fileExcerpt($file, $line)
133133
$code = @highlight_file($file, true);
134134
// remove main code/span tags
135135
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
136-
$content = preg_split('#<br />#', $code);
136+
$content = explode('<br />', $code);
137137

138138
$lines = array();
139139
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {

‎src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646

4747
<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
4848
<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
49-
<?php echo $view['translator']->transChoice('msg2', intval(4.5), [], 'not_messages'); ?>
49+
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,4 @@ protected function createListener($container, $id, $config, $userProvider)
7777

7878
return $listenerId;
7979
}
80-
81-
protected function createEntryPoint($container, $id, $config, $defaultEntryPoint)
82-
{
83-
$entryPointId = 'security.authentication.form_entry_point.'.$id;
84-
$container
85-
->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.form_entry_point'))
86-
->addArgument(new Reference('security.http_utils'))
87-
->addArgument($config['login_path'])
88-
->addArgument($config['use_forward'])
89-
;
90-
91-
return $entryPointId;
92-
}
9380
}

‎src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function __construct()
6565
new RemoveUnusedDefinitionsPass(),
6666
)),
6767
new CheckExceptionOnInvalidReferenceBehaviorPass(),
68-
new CheckCircularReferencesPass(),
6968
));
7069
}
7170

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
-26Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,4 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe
113113
$this->assertFalse($container->hasDefinition('b'));
114114
$this->assertFalse($container->hasDefinition('c'), 'Service C was not inlined.');
115115
}
116-
117-
/**
118-
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
119-
*/
120-
public function testCircularReferencesCausedByMethodCallsAreDetectedDuringCompilation()
121-
{
122-
$container = new ContainerBuilder();
123-
$container->setResourceTracking(false);
124-
125-
$container
126-
->register('foobar', '\stdClass')
127-
->addArgument(new Reference('foo'))
128-
;
129-
130-
$container
131-
->register('foo', '\stdClass')
132-
->addArgument(new Reference('bar'))
133-
;
134-
135-
$container
136-
->register('foo', '\stdClass')
137-
->addMethodCall('addFoobar', array(new Reference('foobar')))
138-
;
139-
140-
$container->compile();
141-
}
142116
}

‎src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testCrossCheck($fixture, $type)
3636

3737
$tmp = tempnam(sys_get_temp_dir(), 'sf');
3838

39-
file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture));
39+
copy(self::$fixturesPath.'/'.$type.'/'.$fixture, $tmp);
4040

4141
$container1 = new ContainerBuilder();
4242
$loader1 = new $loaderClass($container1, new FileLocator());

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
;
6464
$container
6565
->register('baz', 'Baz')
66+
->addMethodCall('setFoo', array(new Reference('foo_with_inline')))
6667
;
6768
$container
6869
->register('request', 'Request')

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ digraph sc {
4141
node_method_call1 -> node_foobaz [label="setBar()" style="dashed"];
4242
node_foo_with_inline -> node_inlined [label="setBar()" style="dashed"];
4343
node_inlined -> node_baz [label="setBaz()" style="dashed"];
44+
node_baz -> node_foo_with_inline [label="setFoo()" style="dashed"];
4445
node_configurator_service -> node_baz [label="setFoo()" style="dashed"];
4546
}

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ protected function getBarService()
9191
*/
9292
protected function getBazService()
9393
{
94-
return $this->services['baz'] = new \Baz();
94+
$this->services['baz'] = $instance = new \Baz();
95+
96+
$instance->setFoo($this->get('foo_with_inline'));
97+
98+
return $instance;
9599
}
96100

97101
/**

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ protected function getBarService()
9797
*/
9898
protected function getBazService()
9999
{
100-
return $this->services['baz'] = new \Baz();
100+
$this->services['baz'] = $instance = new \Baz();
101+
102+
$instance->setFoo($this->get('foo_with_inline'));
103+
104+
return $instance;
101105
}
102106

103107
/**
@@ -268,11 +272,12 @@ protected function getFooBarService()
268272
protected function getFooWithInlineService()
269273
{
270274
$a = new \Bar();
271-
$a->pub = 'pub';
272-
$a->setBaz($this->get('baz'));
273275

274276
$this->services['foo_with_inline'] = $instance = new \Foo();
275277

278+
$a->pub = 'pub';
279+
$a->setBaz($this->get('baz'));
280+
276281
$instance->setBar($a);
277282

278283
return $instance;

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@
7070
<argument type="service" id="baz"/>
7171
</call>
7272
</service>
73-
<service id="baz" class="Baz"/>
73+
<service id="baz" class="Baz">
74+
<call method="setFoo">
75+
<argument type="service" id="foo_with_inline"/>
76+
</call>
77+
</service>
7478
<service id="request" class="Request" synthetic="true"/>
7579
<service id="configurator_service" class="ConfClass" public="false">
7680
<call method="setFoo">

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ services:
5252

5353
baz:
5454
class: Baz
55+
calls:
56+
- [setFoo, ['@foo_with_inline']]
5557

5658
request:
5759
class: Request

‎src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function setContentDisposition($disposition, $filename = '', $filenameFal
164164
if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) {
165165
$encoding = mb_detect_encoding($filename, null, true);
166166

167-
for ($i = 0; $i < mb_strlen($filename, $encoding); ++$i) {
167+
for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) {
168168
$char = mb_substr($filename, $i, 1, $encoding);
169169

170170
if ('%' === $char || ord($char) < 32 || ord($char) > 126) {

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testRead()
106106

107107
if (phpversion('mongodb')) {
108108
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$gte']);
109-
$this->assertGreaterThanOrEqual(round(intval((string) $criteria[$this->options['expiry_field']]['$gte']) / 1000), $testTimeout);
109+
$this->assertGreaterThanOrEqual(round(((int) $criteria[$this->options['expiry_field']]['$gte']) / 1000), $testTimeout);
110110
} else {
111111
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']);
112112
$this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout);
@@ -164,7 +164,7 @@ public function testWrite()
164164
$this->assertEquals('bar', $data[$this->options['data_field']]->getData());
165165
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]);
166166
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]);
167-
$this->assertGreaterThanOrEqual($expectedExpiry, round(intval((string) $data[$this->options['expiry_field']]) / 1000));
167+
$this->assertGreaterThanOrEqual($expectedExpiry, round(((int) $data[$this->options['expiry_field']]) / 1000));
168168
} else {
169169
$this->assertEquals('bar', $data[$this->options['data_field']]->bin);
170170
$this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]);
@@ -287,7 +287,7 @@ public function testGc()
287287
->will($this->returnCallback(function ($criteria) {
288288
if (phpversion('mongodb')) {
289289
$this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']);
290-
$this->assertGreaterThanOrEqual(time() - 1, round(intval((string) $criteria[$this->options['expiry_field']]['$lt']) / 1000));
290+
$this->assertGreaterThanOrEqual(time() - 1, round(((int) $criteria[$this->options['expiry_field']]['$lt']) / 1000));
291291
} else {
292292
$this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']);
293293
$this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec);

‎src/Symfony/Component/HttpKernel/Client.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Client.php
+3-20Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
* Client simulates a browser and makes requests to a Kernel object.
2626
*
2727
* @author Fabien Potencier <fabien@symfony.com>
28+
*
29+
* @method Request|null getRequest() A Request instance
30+
* @method Response|null getResponse() A Response instance
2831
*/
2932
class Client extends BaseClient
3033
{
@@ -47,26 +50,6 @@ public function __construct(HttpKernelInterface $kernel, array $server = array()
4750
parent::__construct($server, $history, $cookieJar);
4851
}
4952

50-
/**
51-
* {@inheritdoc}
52-
*
53-
* @return Request|null A Request instance
54-
*/
55-
public function getRequest()
56-
{
57-
return parent::getRequest();
58-
}
59-
60-
/**
61-
* {@inheritdoc}
62-
*
63-
* @return Response|null A Response instance
64-
*/
65-
public function getResponse()
66-
{
67-
return parent::getResponse();
68-
}
69-
7053
/**
7154
* Makes a request.
7255
*

‎src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function exportValue($value, $depth = 1, $deep = false)
3737

3838
if (is_object($value)) {
3939
if ($value instanceof \DateTimeInterface) {
40-
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
40+
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM));
4141
}
4242

4343
return sprintf('Object(%s)', get_class($value));

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ protected function setUp()
3131
public function testDateTime()
3232
{
3333
$dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
34-
$this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
34+
$this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime));
3535
}
3636

3737
public function testDateTimeImmutable()
3838
{
3939
$dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
40-
$this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
40+
$this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime));
4141
}
4242

4343
public function testIncompleteClass()

‎src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ private function createCollector()
8686
$translator->addResource('array', array('bar' => 'bar (fr)'), 'fr');
8787
$translator->addResource('array', array('bar_ru' => 'bar (ru)'), 'ru');
8888

89-
$collector = new DataCollectorTranslator($translator);
90-
91-
return $collector;
89+
return new DataCollectorTranslator($translator);
9290
}
9391
}

‎src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ abstract class AbstractCloner implements ClonerInterface
118118
':pgsql result' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castResult',
119119
':process' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess',
120120
':stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
121+
':persistent stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
121122
':stream-context' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext',
122123
':xml' => 'Symfony\Component\VarDumper\Caster\XmlResourceCaster::castXml',
123124
);

‎src/Symfony/Component/Yaml/Parser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
684684
$previousLineIndented = false;
685685
$previousLineBlank = false;
686686

687-
for ($i = 0; $i < count($blockLines); ++$i) {
687+
for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) {
688688
if ('' === $blockLines[$i]) {
689689
$text .= "\n";
690690
$previousLineIndented = false;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.