Skip to content

Commit c7e59b3

Browse files
Merge branch '3.3' into 3.4
* 3.3: Ensure DeprecationErrorHandler::collectDeprecations() is triggered [FrameworkBundle] Allow to disable assets via framework:assets xml configuration fixed $_ENV/$_SERVER precedence in test framework [HttpFoundation] Fix FileBag issue with associative arrays [DI] Throw when a service name or an alias contains dynamic values (prevent an infinite loop) fix the phpdoc that is not really inherited from response Minor docblock cleanup Remove redundant sprintf arguments.
2 parents 7f746bd + e7b555e commit c7e59b3

File tree

26 files changed

+129
-48
lines changed

26 files changed

+129
-48
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
*/
3838
class DoctrineTokenProvider implements TokenProviderInterface
3939
{
40-
/**
41-
* Doctrine DBAL database connection
42-
* F.ex. service id: doctrine.dbal.default_connection.
43-
*
44-
* @var Connection
45-
*/
4640
private $conn;
4741

4842
public function __construct(Connection $conn)

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public function endTest($test, $time)
262262
if ($this->runsInSeparateProcess) {
263263
$deprecations = file_get_contents($this->runsInSeparateProcess);
264264
unlink($this->runsInSeparateProcess);
265+
putenv('SYMFONY_DEPRECATIONS_SERIALIZE');
265266
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
266267
if ($deprecation[0]) {
267268
trigger_error(serialize(array('deprecation' => $deprecation[1], 'class' => $className, 'method' => $test->getName(false))), E_USER_DEPRECATED);

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
use Doctrine\Common\Annotations\AnnotationRegistry;
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

15+
// Detect if we need to serialize deprecations to a file.
16+
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
17+
DeprecationErrorHandler::collectDeprecations($file);
18+
19+
return;
20+
}
21+
1522
// Detect if we're loaded by an actual run of phpunit
1623
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
17-
if ($ser = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
18-
DeprecationErrorHandler::collectDeprecations($ser);
19-
}
20-
2124
return;
2225
}
2326

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public function abbrMethod($method)
7070
list($class, $method) = explode('::', $method, 2);
7171
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
7272
} elseif ('Closure' === $method) {
73-
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
73+
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
7474
} else {
75-
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
75+
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
7676
}
7777

7878
return $result;

src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ public function testCompile()
103103
protected function getVariableGetter($name)
104104
{
105105
if (\PHP_VERSION_ID >= 70000) {
106-
return sprintf('($context["%s"] ?? null)', $name, $name);
106+
return sprintf('($context["%s"] ?? null)', $name);
107107
}
108108

109-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
109+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
110110
}
111111
}

src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
272272
protected function getVariableGetter($name)
273273
{
274274
if (\PHP_VERSION_ID >= 70000) {
275-
return sprintf('($context["%s"] ?? null)', $name, $name);
275+
return sprintf('($context["%s"] ?? null)', $name);
276276
}
277277

278-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
278+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
279279
}
280280
}

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,22 @@ public function testCompileStrict()
4545
protected function getVariableGetterWithoutStrictCheck($name)
4646
{
4747
if (\PHP_VERSION_ID >= 70000) {
48-
return sprintf('($context["%s"] ?? null)', $name, $name);
48+
return sprintf('($context["%s"] ?? null)', $name);
4949
}
5050

51-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
51+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
5252
}
5353

5454
protected function getVariableGetterWithStrictCheck($name)
5555
{
5656
if (Environment::MAJOR_VERSION >= 2) {
57-
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
57+
return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->getSourceContext()); })())', $name);
5858
}
5959

6060
if (\PHP_VERSION_ID >= 70000) {
61-
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
61+
return sprintf('($context["%s"] ?? $this->getContext($context, "%1$s"))', $name);
6262
}
6363

64-
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
64+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name);
6565
}
6666
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<xsd:element name="package" type="package" minOccurs="0" maxOccurs="unbounded" />
140140
</xsd:sequence>
141141

142+
<xsd:attribute name="enabled" type="xsd:boolean" />
142143
<xsd:attribute name="base-path" type="xsd:string" />
143144
<xsd:attribute name="version-strategy" type="xsd:string" />
144145
<xsd:attribute name="version" type="xsd:string" />

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function abbrMethod($method)
6161
list($class, $method) = explode('::', $method, 2);
6262
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
6363
} elseif ('Closure' === $method) {
64-
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
64+
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
6565
} else {
66-
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
66+
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
6767
}
6868

6969
return $result;

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static function getPhpUnitCliConfigArgument()
115115
protected static function getKernelClass()
116116
{
117117
if (isset($_SERVER['KERNEL_CLASS']) || isset($_ENV['KERNEL_CLASS'])) {
118-
$class = isset($_SERVER['KERNEL_CLASS']) ? $_SERVER['KERNEL_CLASS'] : $_ENV['KERNEL_CLASS'];
118+
$class = isset($_ENV['KERNEL_CLASS']) ? $_ENV['KERNEL_CLASS'] : $_SERVER['KERNEL_CLASS'];
119119
if (!class_exists($class)) {
120120
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
121121
}
@@ -126,7 +126,7 @@ protected static function getKernelClass()
126126
}
127127

128128
if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) {
129-
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : $_ENV['KERNEL_DIR'];
129+
$dir = isset($_ENV['KERNEL_DIR']) ? $_ENV['KERNEL_DIR'] : $_SERVER['KERNEL_DIR'];
130130

131131
if (!is_dir($dir)) {
132132
$phpUnitDir = static::getPhpUnitXmlDir();
@@ -186,20 +186,20 @@ protected static function createKernel(array $options = array())
186186

187187
if (isset($options['environment'])) {
188188
$env = $options['environment'];
189-
} elseif (isset($_SERVER['APP_ENV'])) {
190-
$env = $_SERVER['APP_ENV'];
191189
} elseif (isset($_ENV['APP_ENV'])) {
192190
$env = $_ENV['APP_ENV'];
191+
} elseif (isset($_SERVER['APP_ENV'])) {
192+
$env = $_SERVER['APP_ENV'];
193193
} else {
194194
$env = 'test';
195195
}
196196

197197
if (isset($options['debug'])) {
198198
$debug = $options['debug'];
199-
} elseif (isset($_SERVER['APP_DEBUG'])) {
200-
$debug = $_SERVER['APP_DEBUG'];
201199
} elseif (isset($_ENV['APP_DEBUG'])) {
202200
$debug = $_ENV['APP_DEBUG'];
201+
} elseif (isset($_SERVER['APP_DEBUG'])) {
202+
$debug = $_SERVER['APP_DEBUG'];
203203
} else {
204204
$debug = true;
205205
}

0 commit comments

Comments
 (0)