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

Skip to content

Commit 519bb44

Browse files
[3.0] Various deprecation removal
1 parent eca45b7 commit 519bb44

File tree

17 files changed

+11
-249
lines changed

17 files changed

+11
-249
lines changed

src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,6 @@ public function testCollectWhenAuthenticationTokenIsNull()
4040
$this->assertEmpty($collector->getUser());
4141
}
4242

43-
/**
44-
* @group legacy
45-
*/
46-
public function testLegacyCollectWhenAuthenticationTokenIsNull()
47-
{
48-
$tokenStorage = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface');
49-
$collector = new SecurityDataCollector($tokenStorage, $this->getRoleHierarchy());
50-
$collector->collect($this->getRequest(), $this->getResponse());
51-
52-
$this->assertTrue($collector->isEnabled());
53-
$this->assertFalse($collector->isAuthenticated());
54-
$this->assertNull($collector->getTokenClass());
55-
$this->assertTrue($collector->supportsRoleHierarchy());
56-
$this->assertCount(0, $collector->getRoles());
57-
$this->assertCount(0, $collector->getInheritedRoles());
58-
$this->assertEmpty($collector->getUser());
59-
}
60-
6143
/** @dataProvider provideRoles */
6244
public function testCollectAuthenticationTokenAndRoles(array $roles, array $normalizedRoles, array $inheritedRoles)
6345
{

src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,10 @@ public function getTestCreateMapTests()
110110
'Foo\\TFooBar' => __DIR__.'/Fixtures/php5.4/traits.php',
111111
'Foo\\CBar' => __DIR__.'/Fixtures/php5.4/traits.php',
112112
)),
113-
);
114-
115-
if (PHP_VERSION_ID >= 50500) {
116-
$data[] = array(__DIR__.'/Fixtures/php5.5', array(
113+
array(__DIR__.'/Fixtures/php5.5', array(
117114
'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
118-
));
119-
}
115+
)),
116+
);
120117

121118
return $data;
122119
}

src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ public function __construct($name, NodeParentInterface $parent = null)
3030
$this->nullEquivalent = true;
3131
}
3232

33-
/**
34-
* {@inheritdoc}
35-
*
36-
* @deprecated Deprecated since version 2.8, to be removed in 3.0.
37-
*/
38-
public function cannotBeEmpty()
39-
{
40-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
41-
42-
return parent::cannotBeEmpty();
43-
}
44-
4533
/**
4634
* Instantiate a Node.
4735
*

src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,4 @@ public function min($min)
5858

5959
return $this;
6060
}
61-
62-
/**
63-
* {@inheritdoc}
64-
*
65-
* @deprecated Deprecated since version 2.8, to be removed in 3.0.
66-
*/
67-
public function cannotBeEmpty()
68-
{
69-
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
70-
71-
return parent::cannotBeEmpty();
72-
}
7361
}

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function getProgress()
181181
/**
182182
* Gets the progress bar step width.
183183
*
184-
* @return int The progress bar step width
184+
* @return int The progress bar step width
185185
*/
186186
private function getStepWidth()
187187
{

src/Symfony/Component/Console/Input/StringInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class StringInput extends ArgvInput
3030
/**
3131
* Constructor.
3232
*
33-
* @param string $input An array of parameters from the CLI (in the argv format)
33+
* @param string $input An array of parameters from the CLI (in the argv format)
3434
*
3535
* @api
3636
*/

src/Symfony/Component/Console/Output/OutputInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,28 @@ public function setVerbosity($level);
7676
public function getVerbosity();
7777

7878
/**
79-
* Returns whether verbosity is quiet (-q)
79+
* Returns whether verbosity is quiet (-q).
8080
*
8181
* @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
8282
*/
8383
public function isQuiet();
8484

8585
/**
86-
* Returns whether verbosity is verbose (-v)
86+
* Returns whether verbosity is verbose (-v).
8787
*
8888
* @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
8989
*/
9090
public function isVerbose();
9191

9292
/**
93-
* Returns whether verbosity is very verbose (-vv)
93+
* Returns whether verbosity is very verbose (-vv).
9494
*
9595
* @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
9696
*/
9797
public function isVeryVerbose();
9898

9999
/**
100-
* Returns whether verbosity is debug (-vvv)
100+
* Returns whether verbosity is debug (-vvv).
101101
*
102102
* @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
103103
*/

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function handle(\Exception $exception)
122122

123123
$caughtLength = $this->caughtLength = 0;
124124

125-
ob_start(function($buffer) {
125+
ob_start(function ($buffer) {
126126
$this->caughtBuffer = $buffer;
127127

128128
return '';
@@ -133,7 +133,7 @@ public function handle(\Exception $exception)
133133
// Empty loop, everything is in the condition
134134
}
135135
if (isset($this->caughtBuffer[0])) {
136-
ob_start(function($buffer) {
136+
ob_start(function ($buffer) {
137137
if ($this->caughtLength) {
138138
// use substr_replace() instead of substr() for mbstring overloading resistance
139139
$cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);

src/Symfony/Component/EventDispatcher/Tests/EventTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\EventDispatcher\Tests;
1313

1414
use Symfony\Component\EventDispatcher\Event;
15-
use Symfony\Component\EventDispatcher\EventDispatcher;
1615

1716
/**
1817
* Test class for Event.

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
1515
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
16-
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
1716
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
1817
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
1918

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
1717
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
1818
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
19-
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
2019
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
2120

2221
/**

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public function testIsWrapper()
9191
*/
9292
public function testIsActive()
9393
{
94-
9594
$this->assertFalse($this->proxy->isActive());
9695
session_start();
9796
$this->assertTrue($this->proxy->isActive());

src/Symfony/Component/Routing/Annotation/Route.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,6 @@ public function getName()
8686

8787
public function setRequirements($requirements)
8888
{
89-
if (isset($requirements['_method'])) {
90-
if (0 === count($this->methods)) {
91-
$this->methods = explode('|', $requirements['_method']);
92-
}
93-
94-
@trigger_error('The "_method" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" option instead.', E_USER_DEPRECATED);
95-
}
96-
97-
if (isset($requirements['_scheme'])) {
98-
if (0 === count($this->schemes)) {
99-
$this->schemes = explode('|', $requirements['_scheme']);
100-
}
101-
102-
@trigger_error('The "_scheme" requirement is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" option instead.', E_USER_DEPRECATED);
103-
}
104-
10589
$this->requirements = $requirements;
10690
}
10791

src/Symfony/Component/Routing/Loader/XmlFileLoader.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,6 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
122122

123123
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path);
124124

125-
if (isset($requirements['_method'])) {
126-
if (0 === count($methods)) {
127-
$methods = explode('|', $requirements['_method']);
128-
}
129-
130-
unset($requirements['_method']);
131-
@trigger_error(sprintf('The "_method" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" attribute instead.', $id, $path), E_USER_DEPRECATED);
132-
}
133-
134-
if (isset($requirements['_scheme'])) {
135-
if (0 === count($schemes)) {
136-
$schemes = explode('|', $requirements['_scheme']);
137-
}
138-
139-
unset($requirements['_scheme']);
140-
@trigger_error(sprintf('The "_scheme" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" attribute instead.', $id, $path), E_USER_DEPRECATED);
141-
}
142-
143125
$route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
144126
$collection->add($id, $route);
145127
}

src/Symfony/Component/Routing/Loader/YamlFileLoader.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,6 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
116116
$methods = isset($config['methods']) ? $config['methods'] : array();
117117
$condition = isset($config['condition']) ? $config['condition'] : null;
118118

119-
if (isset($requirements['_method'])) {
120-
if (0 === count($methods)) {
121-
$methods = explode('|', $requirements['_method']);
122-
}
123-
124-
unset($requirements['_method']);
125-
@trigger_error(sprintf('The "_method" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" option instead.', $name, $path), E_USER_DEPRECATED);
126-
}
127-
128-
if (isset($requirements['_scheme'])) {
129-
if (0 === count($schemes)) {
130-
$schemes = explode('|', $requirements['_scheme']);
131-
}
132-
133-
unset($requirements['_scheme']);
134-
@trigger_error(sprintf('The "_scheme" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" option instead.', $name, $path), E_USER_DEPRECATED);
135-
}
136-
137119
$route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
138120

139121
$collection->add($name, $route);

src/Symfony/Component/Translation/Tests/TranslatorTest.php

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -495,121 +495,6 @@ public function testTransChoiceFallbackWithNoTranslation()
495495
// unchanged if it can't be found
496496
$this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
497497
}
498-
499-
/**
500-
* @group legacy
501-
* @dataProvider dataProviderGetMessages
502-
*/
503-
public function testLegacyGetMessages($resources, $locale, $expected)
504-
{
505-
$locales = array_keys($resources);
506-
$_locale = null !== $locale ? $locale : reset($locales);
507-
$locales = array_slice($locales, 0, array_search($_locale, $locales));
508-
509-
$translator = new Translator($_locale, new MessageSelector());
510-
$translator->setFallbackLocales(array_reverse($locales));
511-
$translator->addLoader('array', new ArrayLoader());
512-
foreach ($resources as $_locale => $domainMessages) {
513-
foreach ($domainMessages as $domain => $messages) {
514-
$translator->addResource('array', $messages, $_locale, $domain);
515-
}
516-
}
517-
$result = $translator->getMessages($locale);
518-
519-
$this->assertEquals($expected, $result);
520-
}
521-
522-
public function dataProviderGetMessages()
523-
{
524-
$resources = array(
525-
'en' => array(
526-
'jsmessages' => array(
527-
'foo' => 'foo (EN)',
528-
'bar' => 'bar (EN)',
529-
),
530-
'messages' => array(
531-
'foo' => 'foo messages (EN)',
532-
),
533-
'validators' => array(
534-
'int' => 'integer (EN)',
535-
),
536-
),
537-
'pt-PT' => array(
538-
'messages' => array(
539-
'foo' => 'foo messages (PT)',
540-
),
541-
'validators' => array(
542-
'str' => 'integer (PT)',
543-
),
544-
),
545-
'pt_BR' => array(
546-
'validators' => array(
547-
'int' => 'integer (BR)',
548-
),
549-
),
550-
);
551-
552-
return array(
553-
array($resources, null,
554-
array(
555-
'jsmessages' => array(
556-
'foo' => 'foo (EN)',
557-
'bar' => 'bar (EN)',
558-
),
559-
'messages' => array(
560-
'foo' => 'foo messages (EN)',
561-
),
562-
'validators' => array(
563-
'int' => 'integer (EN)',
564-
),
565-
),
566-
),
567-
array($resources, 'en',
568-
array(
569-
'jsmessages' => array(
570-
'foo' => 'foo (EN)',
571-
'bar' => 'bar (EN)',
572-
),
573-
'messages' => array(
574-
'foo' => 'foo messages (EN)',
575-
),
576-
'validators' => array(
577-
'int' => 'integer (EN)',
578-
),
579-
),
580-
),
581-
array($resources, 'pt-PT',
582-
array(
583-
'jsmessages' => array(
584-
'foo' => 'foo (EN)',
585-
'bar' => 'bar (EN)',
586-
),
587-
'messages' => array(
588-
'foo' => 'foo messages (PT)',
589-
),
590-
'validators' => array(
591-
'int' => 'integer (EN)',
592-
'str' => 'integer (PT)',
593-
),
594-
),
595-
),
596-
array($resources, 'pt_BR',
597-
array(
598-
'jsmessages' => array(
599-
'foo' => 'foo (EN)',
600-
'bar' => 'bar (EN)',
601-
),
602-
'messages' => array(
603-
'foo' => 'foo messages (PT)',
604-
),
605-
'validators' => array(
606-
'int' => 'integer (BR)',
607-
'str' => 'integer (PT)',
608-
),
609-
),
610-
),
611-
);
612-
}
613498
}
614499

615500
class StringClass

0 commit comments

Comments
 (0)