Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f53672f

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: 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 e103e1d + 68d6415 commit f53672f

File tree

23 files changed

+41
-84
lines changed

23 files changed

+41
-84
lines changed

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function fileExcerpt($file, $line)
138138
$code = @highlight_file($file, true);
139139
// remove main code/span tags
140140
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
141-
$content = preg_split('#<br />#', $code);
141+
$content = explode('<br />', $code);
142142

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

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ protected function getFragmentHandler($return)
6262

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

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function fileExcerpt($file, $line)
132132
$code = @highlight_file($file, true);
133133
// remove main code/span tags
134134
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
135-
$content = preg_split('#<br />#', $code);
135+
$content = explode('<br />', $code);
136136

137137
$lines = array();
138138
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

Lines 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

Lines 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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public function __construct()
6464
new RemoveUnusedDefinitionsPass(),
6565
)),
6666
new CheckExceptionOnInvalidReferenceBehaviorPass(),
67-
new CheckCircularReferencesPass(),
6867
);
6968
}
7069

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

Lines 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

Lines 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

Lines 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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ digraph sc {
3737
node_method_call1 -> node_foobaz [label="setBar()" style="dashed"];
3838
node_foo_with_inline -> node_inlined [label="setBar()" style="dashed"];
3939
node_inlined -> node_baz [label="setBaz()" style="dashed"];
40+
node_baz -> node_foo_with_inline [label="setFoo()" style="dashed"];
4041
node_configurator_service -> node_baz [label="setFoo()" style="dashed"];
4142
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ protected function getBarService()
8181
*/
8282
protected function getBazService()
8383
{
84-
return $this->services['baz'] = new \Baz();
84+
$this->services['baz'] = $instance = new \Baz();
85+
86+
$instance->setFoo($this->get('foo_with_inline'));
87+
88+
return $instance;
8589
}
8690

8791
/**

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ protected function getBarService()
100100
*/
101101
protected function getBazService()
102102
{
103-
return $this->services['baz'] = new \Baz();
103+
$this->services['baz'] = $instance = new \Baz();
104+
105+
$instance->setFoo($this->get('foo_with_inline'));
106+
107+
return $instance;
104108
}
105109

106110
/**
@@ -241,11 +245,12 @@ protected function getFooBarService()
241245
protected function getFooWithInlineService()
242246
{
243247
$a = new \Bar();
244-
$a->pub = 'pub';
245-
$a->setBaz($this->get('baz'));
246248

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

251+
$a->pub = 'pub';
252+
$a->setBaz($this->get('baz'));
253+
249254
$instance->setBar($a);
250255

251256
return $instance;

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

Lines 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

Lines 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

Lines 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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function testRead()
108108

109109
if (phpversion('mongodb')) {
110110
$that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$gte']);
111-
$that->assertGreaterThanOrEqual(round(intval((string) $criteria[$that->options['expiry_field']]['$gte']) / 1000), $testTimeout);
111+
$that->assertGreaterThanOrEqual(round(((int) $criteria[$that->options['expiry_field']]['$gte']) / 1000), $testTimeout);
112112
} else {
113113
$that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$gte']);
114114
$that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec, $testTimeout);
@@ -167,7 +167,7 @@ public function testWrite()
167167
$that->assertEquals('bar', $data[$that->options['data_field']]->getData());
168168
$that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['time_field']]);
169169
$that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$that->options['expiry_field']]);
170-
$that->assertGreaterThanOrEqual($expectedExpiry, round(intval((string) $data[$that->options['expiry_field']]) / 1000));
170+
$that->assertGreaterThanOrEqual($expectedExpiry, round(((int) $data[$that->options['expiry_field']]) / 1000));
171171
} else {
172172
$that->assertEquals('bar', $data[$that->options['data_field']]->bin);
173173
$that->assertInstanceOf('MongoDate', $data[$that->options['time_field']]);
@@ -293,7 +293,7 @@ public function testGc()
293293
->will($this->returnCallback(function ($criteria) use ($that) {
294294
if (phpversion('mongodb')) {
295295
$that->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$that->options['expiry_field']]['$lt']);
296-
$that->assertGreaterThanOrEqual(time() - 1, round(intval((string) $criteria[$that->options['expiry_field']]['$lt']) / 1000));
296+
$that->assertGreaterThanOrEqual(time() - 1, round(((int) $criteria[$that->options['expiry_field']]['$lt']) / 1000));
297297
} else {
298298
$that->assertInstanceOf('MongoDate', $criteria[$that->options['expiry_field']]['$lt']);
299299
$that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec);

src/Symfony/Component/HttpKernel/Client.php

Lines 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 <[email protected]>
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function exportValue($value, $depth = 1, $deep = false)
3333

3434
if (is_object($value)) {
3535
if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) {
36-
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
36+
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM));
3737
}
3838

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

src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function getMemcache()
4646
$port = $matches[3];
4747

4848
$memcache = new \Memcache();
49-
$memcache->addserver($host, $port);
49+
$memcache->addServer($host, $port);
5050

5151
$this->memcache = $memcache;
5252
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function setUp()
2828
public function testDateTime()
2929
{
3030
$dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
31-
$this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
31+
$this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime));
3232
}
3333

3434
/**
@@ -37,7 +37,7 @@ public function testDateTime()
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

Lines 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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ abstract class AbstractCloner implements ClonerInterface
111111
':pgsql result' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castResult',
112112
':process' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess',
113113
':stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
114+
':persistent stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
114115
':stream-context' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext',
115116
':xml' => 'Symfony\Component\VarDumper\Caster\XmlResourceCaster::castXml',
116117
);

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
626626
$previousLineIndented = false;
627627
$previousLineBlank = false;
628628

629-
for ($i = 0; $i < count($blockLines); ++$i) {
629+
for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) {
630630
if ('' === $blockLines[$i]) {
631631
$text .= "\n";
632632
$previousLineIndented = false;

0 commit comments

Comments
 (0)