8000 [3.0] Removed some old hacks · symfony/symfony@7a8c1ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a8c1ab

Browse files
GrahamCampbellnicolas-grekas
authored andcommitted
[3.0] Removed some old hacks
1 parent 0323b13 commit 7a8c1ab

File tree

83 files changed

+131
-960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+131
-960
lines changed

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,13 @@ README
44
What is Symfony?
55
-----------------
66

7-
Symfony is a PHP 5.3 full-stack web framework. It is written with speed and
7+
Symfony is a PHP full-stack web framework. It is written with speed and
88
flexibility in mind. It allows developers to build better and easy to maintain
99
websites with PHP.
1010

1111
Symfony can be used to develop all kind of websites, from your personal blog
1212
to high traffic ones like Dailymotion or Yahoo! Answers.
1313

14-
Requirements
15-
------------
16-
17-
Symfony is only supported on PHP 5.3.3 and up.
18-
19-
Be warned that PHP versions before 5.3.8 are known to be buggy and might not
20-
work for you:
21-
22-
* before PHP 5.3.4, if you get "Notice: Trying to get property of
23-
non-object", you've hit a known PHP bug (see
24-
https://bugs.php.net/bug.php?id=52083 and
25-
https://bugs.php.net/bug.php?id=50027);
26-
27-
* before PHP 5.3.8, if you get an error involving annotations, you've hit a
28-
known PHP bug (see https://bugs.php.net/bug.php?id=55156).
29-
30-
* PHP 5.3.16 has a major bug in the Reflection subsystem and is not suitable to
31-
run Symfony (https://bugs.php.net/bug.php?id=62715)
32-
3314
Installation
3415
------------
3516

autoload.php.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
if (PHP_VERSION_ID >= 50400 && gc_enabled()) {
4-
// Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+
5-
// https://bugs.php.net/bug.php?id=53976
3+
// Disabling Zend Garbage Collection to prevent segfaults
4+
// https://bugs.php.net/bug.php?id=53976
5+
if (gc_enabled()) {
66
gc_disable();
77
}
88

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidatorLegacyApiTest.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bridge\Twig\Command;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\Console\Command\Command;
1915
use Symfony\Component\Console\Input\InputInterface;
2016
use Symfony\Component\Console\Input\InputOption;

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@ public function formatFile($file, $line, $text = null)
174174
$text = "$text at line $line";
175175

176176
if (false !== $link = $this->getFileLink($file, $line)) {
177-
if (PHP_VERSION_ID >= 50400) {
178-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
179-
} else {
180-
$flags = ENT_QUOTES;
181-
}
177+
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
182178

183179
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
184180
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testOneVar()
5656
}
5757

5858
EOTXT;
59-
$expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
59+
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
6060

6161
$this->assertSame($expected, $compiler->compile($node)->getSource());
6262
}
@@ -82,7 +82,7 @@ public function testMultiVars()
8282
}
8383

8484
EOTXT;
85-
$expected = preg_replace('/%(.*?)%/< 10000 /span>', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
85+
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
8686

8787
$this->assertSame($expected, $compiler->compile($node)->getSource());
8888
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ public function testCompile()
6666

6767
protected function getVariableGetter($name)
6868
{
69-
if (PHP_VERSION_ID >= 50400) {
70-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
71-
}
72-
73-
return sprintf('$this->getContext($context, "%s")', $name);
69+
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
7470
}
7571
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,6 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
263263

264264
protected function getVariableGetter($name)
265265
{
266-
if (PHP_VERSION_ID >= 50400) {
267-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
268-
}
269-
270-
return sprintf('$this->getContext($context, "%s")', $name);
266+
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
271267
}
272268
}

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,11 @@ public function testCompileStrict()
3838
}
3939
protected function getVariableGetterWithoutStrictCheck($name)
4040
{
41-
if (PHP_VERSION_ID >= 50400) {
42-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
43-
}
44-
45-
return sprintf('$this->getContext($context, "%s", true)', $name);
41+
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
4642
}
4743

4844
protected function getVariableGetterWithStrictCheck($name)
4945
{
50-
if (PHP_VERSION_ID >= 50400) {
51-
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
52-
}
53-
54-
return sprintf('$this->getContext($context, "%s")', $name);
46+
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
5547
}
5648
}

src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand
2323
*/
2424
public function isEnabled()
2525
{
26-
if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) {
26+
if (defined('HHVM_VERSION')) {
2727
return false;
2828
}
2929

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ServerRunCommand extends ContainerAwareCommand
3030
*/
3131
public function isEnabled()
3232
{
33-
if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
33+
if (defined('HHVM_VERSION')) {
3434
return false;
3535
}
3636

src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\Console\Command\Command;
1915
use Symfony\Component\Console\Input\InputInterface;
2016
use Symfony\Component\Console\Input\InputOption;

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\DependencyInjection\Alias;
1915
use Symfony\Component\DependencyInjection\ContainerBuilder;
2016
use Symfony\Component\DependencyInjection\Definition;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
498498
->validate()
499499
->ifTrue(function ($v) { return !isset($v['validation']['api']) || 'auto' === $v['validation']['api']; })
500500
->then(function ($v) {
501-
// This condition is duplicated in ValidatorBuilder. This
502-
// duplication is necessary in order to know the desired
503-
// API version already during container configuration
504-
// (to adjust service classes etc.)
505-
// See https://github.com/symfony/symfony/issues/11580
506-
$v['validation']['api'] = PHP_VERSION_ID < 50309
507-
? '2.4'
508-
: '2.5-bc';
501+
$v['validation']['api'] = '2.5-bc';
509502

510503
return $v;
511504
})

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ public function formatFile($file, $line, $text = null)
166166
}
167167

168168
if (false !== $link = $this->getFileLink($file, $line)) {
169-
if (PHP_VERSION_ID >= 50400) {
170-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
171-
} else {
172-
$flags = ENT_QUOTES;
173-
}
169+
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
174170

175171
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
176172
}

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515

1616
class JsonDescriptorTest extends AbstractDescriptorTest
1717
{
18-
protected function setUp()
19-
{
20-
if (PHP_VERSION_ID < 50400) {
21-
$this->markTestSkipped('Test skipped on PHP 5.3 as JSON_PRETTY_PRINT does not exist.');
22-
}
23-
}
24-
2518
protected function getDescriptor()
2619
{
2720
return new JsonDescriptor();

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected static function getBundleDefaultConfig()
131131
'static_method' => array('loadValidatorMetadata'),
132132
'translation_domain' => 'validators',
133133
'strict_email' => false,
134-
'api' => PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc',
134+
'api' => '2.5-bc',
135135
),
136136
'annotations' => array(
137137
'cache' => 'file',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,7 @@ public function testValidation()
295295
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
296296
$this->assertSame('setApiVersion', $calls[6][0]);
297297

298-
if (PHP_VERSION_ID < 50309) {
299-
$this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]);
300-
} else {
301-
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
302-
}
298+
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
303299
}
304300

305301
public function testFullyConfiguredValidationService()
@@ -448,11 +444,7 @@ public function testValidationImplicitApi()
448444
$this->assertSame('setApiVersion', $calls[5][0]);
449445
// no cache, no annotations
450446

451-
if (PHP_VERSION_ID < 50309) {
452-
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
453-
} else {
454-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
455-
}
447+
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
456448
}
457449

458450
/**
@@ -472,11 +464,7 @@ public function testValidationAutoApi()
472464
$this->assertSame('setApiVersion', $calls[5][0]);
473465
// no cache, no annotations
474466

475-
if (PHP_VERSION_ID < 50309) {
476-
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
477-
} else {
478-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
479-
}
467+
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
480468
}
481469

482470
public function testFormsCanBeEnabledWithoutCsrfProtection()

src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ public function testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous($c
3030
*/
3131
public function testRoutingErrorIsExposedWhenNotProtected($config)
3232
{
33-
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
34-
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
35-
}
36-
3733
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
3834
$client->insulate();
3935
$client->request('GET', '/unprotected_resource');
@@ -46,10 +42,6 @@ public function testRoutingErrorIsExposedWhenNotProtected($config)
4642
*/
4743
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
4844
{
49-
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
50-
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
51-
}
52-
5345
$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
5446
$client->insulate();
5547

src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
4343

4444
self::$loaded[$name] = true;
4545

46-
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
47-
if (function_exists('get_declared_traits')) {
48-
$declared = array_merge($declared, get_declared_traits());
49-
}
46+
$declared = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
5047

5148
if ($adaptive) {
5249
// don't include already declared classes

src/Symfony/Component/ClassLoader/ClassMapGenerator.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14-
if (!defined('SYMFONY_TRAIT')) {
15-
if (PHP_VERSION_ID >= 50400) {
16-
define('SYMFONY_TRAIT', T_TRAIT);
17-
} else {
18-
define('SYMFONY_TRAIT', 0);
19-
}
20-
}
21-
2214
/**
2315
* ClassMapGenerator.
2416
*
@@ -117,7 +109,7 @@ private static function findClasses($path)
117109
break;
118110
case T_CLASS:
119111
case T_INTERFACE:
120-
case SYMFONY_TRAIT:
112+
case T_TRAIT:
121113
// Find the classname
122114
FE95 while (($t = $tokens[++$i]) && is_array($t)) {
123115
if (T_STRING === $t[0]) {

src/Symfony/Component/ClassLoader/DebugClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function loadClass($class)
107107
if ($file = $this->classFinder->findFile($class)) {
108108
require $file;
109109

110-
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
110+
if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) {
111111
if (false !== strpos($class, '/')) {
112112
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
113113
}

src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function loadClass($class)
5555
if ($file = $this->findFile($class)) {
5656
require $file;
5757

58-
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
58+
if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) {
5959
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
6060
}
6161
}

0 commit comments

Comments
 (0)
0