8000 Removed deprecations in Console component · symfony/symfony@1a8f87d · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a8f87d

Browse files
committed
Removed deprecations in Console component
1 parent 5f42822 commit 1a8f87d

File tree

7 files changed

+2
-221
lines changed

7 files changed

+2
-221
lines changed

src/Symfony/Component/Console/Application.php

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

1212
namespace Symfony\Component\Console;
1313

14-
use Symfony\Component\Console\Descriptor\TextDescriptor;
15-
use Symfony\Component\Console\Descriptor\XmlDescriptor;
1614
use Symfony\Component\Console\Helper\DebugFormatterHelper;
1715
use Symfony\Component\Console\Helper\ProcessHelper;
1816
use Symfony\Component\Console\Helper\QuestionHelper;
@@ -23,7 +21,6 @@
2321
use Symfony\Component\Console\Input\InputOption;
2422
use Symfony\Component\Console\Input\InputArgument;
2523
use Symfony\Component\Console\Input\InputAwareInterface;
26-
use Symfony\Component\Console\Output\BufferedOutput;
2724
use Symfony\Component\Console\Output\OutputInterface;
2825
use Symfony\Component\Console\Output\ConsoleOutput;
2926
use Symfony\Component\Console\Output\ConsoleOutputInterface;
@@ -613,53 +610,6 @@ public static function getAbbreviations($names)
613610
return $abbrevs;
614611
}
615612

616-
/**
617-
* Returns a text representation of the Application.
618-
*
619-
* @param string $namespace An optional namespace name
620-
* @param bool $raw Whether to return raw command list
621-
*
622-
* @return string A string representing the Application
623-
*
624-
* @deprecated since version 2.3, to be removed in 3.0.
625-
*/
626-
public function asText($namespace = null, $raw = false)
627-
{
628-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
629-
630-
$descriptor = new TextDescriptor();
631-
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
632-
$descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
633-
634-
return $output->fetch();
635-
}
636-
637-
/**
638-
* Returns an XML representation of the Application.
639-
*
640-
* @param string $namespace An optional namespace name
641-
* @param bool $asDom Whether to return a DOM or an XML string
642-
*
643-
* @return string|\DOMDocument An XML string representing the Application
644-
*
645-
* @deprecated since version 2.3, to be removed in 3.0.
646-
*/
647-
public function asXml($namespace = null, $asDom = false)
648-
{
649-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
650-
651-
$descriptor = new XmlDescriptor();
652-
653-
if ($asDom) {
654-
return $descriptor->getApplicationDocument($this, $namespace);
655-
}
656-
657-
$output = new BufferedOutput();
658-
$descriptor->describe($output, $this, array('namespace' => $namespace));
659-
660-
return $output->fetch();
661-
}
662-
663613
/**
664614
* Renders a caught exception.
665615
*

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,6 @@ public function getMaxSteps()
168168
return $this->max;
169169
}
170170

171-
/**
172-
* Gets the progress bar step.
173-
*
174-
* @deprecated since version 2.6, to be removed in 3.0. Use {@link getProgress()} instead.
175-
*
176-
* @return int The progress bar step
177-
*/
178-
public function getStep()
179-
{
180-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
181-
182-
return $this->getProgress();
183-
}
184-
185171
/**
186172
* Gets the current step position.
187173
*
@@ -355,22 +341,6 @@ public function advance($step = 1)
355341
$this->setProgress($this->step + $step);
356342
}
357343

358-
/**
359-
* Sets the current progress.
360-
*
361-
* @deprecated since version 2.6, to be removed in 3.0. Use {@link setProgress()} instead.
362-
*
363-
* @param int $step The current progress
364-
*
365-
* @throws \LogicException
366-
*/
367-
public function setCurrent($step)
368-
{
369-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
370-
371-
$this->setProgress($step);
372-
}
373-
374344
/**
375345
* Sets whether to overwrite the progressbar, false for new line
376346
*

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

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

1212
namespace Symfony\Component\Console\Input;
1313

14-
use Symfony\Component\Console\Descriptor\TextDescriptor;
15-
use Symfony\Component\Console\Descriptor\XmlDescriptor;
16-
use Symfony\Component\Console\Output\BufferedOutput;
17-
1814
/**
1915
* A InputDefinition represents a set of valid command line arguments and options.
2016
*
@@ -411,47 +407,4 @@ public function getSynopsis()
411407

412408
return implode(' ', $elements);
413409
}
414-
415-
/**
416-
* Returns a textual representation of the InputDefinition.
417-
*
418-
* @return string A string representing the InputDefinition
419-
*
420-
* @deprecated since version 2.3, to be removed in 3.0.
421-
*/
422-
public function asText()
423-
{
424-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
425-
426-
$descriptor = new TextDescriptor();
427-
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
428-
$descriptor->describe($output, $this, array('raw_output' => true));
429-
430-
return $output->fetch();
431-
}
432-
433-
/**
434-
* Returns an XML representation of the InputDefinition.
435-
*
436-
* @param bool $asDom Whether to return a DOM or an XML string
437-
*
438-
* @return string|\DOMDocument An XML string representing the InputDefinition
439-
*
440-
* @deprecated since version 2.3, to be removed in 3.0.
441-
*/
442-
public function asXml($asDom = false)
443-
{
444-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
445-
446-
$descriptor = new XmlDescriptor();
447-
448-
if ($asDom) {
449-
return $descriptor->getInputDefinitionDocument($this);
450-
}
451-
452-
$output = new BufferedOutput();
453-
$descriptor->describe($output, $this);
454-
455-
return $output->fetch();
456-
}
457410
}

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,14 @@ class StringInput extends ArgvInput
3131
* Constructor.
3232
*
3333
* @param string $input An array of parameters from the CLI (in the argv format)
34-
* @param InputDefinition $definition A InputDefinition instance
35-
*
36-
* @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
3734
*
3835
* @api
3936
*/
40-
public function __construct($input, InputDefinition $definition = null)
37+
public function __construct($input)
4138
{
42-
if ($definition) {
43-
trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
44-
}
45-
46-
parent::__construct(array(), null);
39+
parent::__construct(array());
4740

4841
$this->setTokens($this->tokenize($input));
49-
50-
if (null !== $definition) {
51-
$this->bind($definition);
52-
}
5342
}
5443

5544
/**

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -490,34 +490,6 @@ public function testSetCatchExceptions()
490490
}
491491
}
492492

493-
/**
494-
* @group legacy
495-
*/
496-
public function testLegacyAsText()
497-
{
498-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
499-
500-
$application = new Application();
501-
$application->add(new \FooCommand());
502-
$this->ensureStaticCommandHelp($application);
503-
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
504-
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
505-
}
506-
507-
/**
508-
* @group legacy
509-
*/
510-
public function testLegacyAsXml()
511-
{
512-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
513-
514-
$application = new Application();
515-
$application->add(new \FooCommand());
516-
$this->ensureStaticCommandHelp($application);
517-
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
518-
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
519-
}
520-
521493
public function testRenderException()
522494
{
523495
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));

src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -373,44 +373,6 @@ public function testGetSynopsis()
373373
$this->assertEquals('foo1 ... [fooN]', $definition->getSynopsis(), '->getSynopsis() returns a synopsis of arguments and options');
374374
}
375375

376-
/**
377-
* @group legacy
378-
*/
379-
public function testLegacyAsText()
380-
{
381-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
382-
383-
$definition = new InputDefinition(array(
384-
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
385-
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
386-
new InputArgument('bar', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The bar argument', array('http://foo.com/')),
387-
new InputOption('foo', 'f', InputOption::VALUE_REQUIRED, 'The foo option'),
388-
new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false),
389-
new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'),
390-
new InputOption('qux', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux option', array('http://foo.com/', 'bar')),
391-
new InputOption('qux2', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The qux2 option', array('foo' => 'bar')),
392-
));
393-
$this->assertStringEqualsFile(self::$fixtures.'/definition_astext.txt', $definition->asText(), '->asText() returns a textual representation of the InputDefinition');
394-
}
395-
396-
/**
397-
* @group legacy
398-
*/
399-
public function testLegacyAsXml()
400-
{
401-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
402-
403-
$definition = new InputDefinition(array(
404-
new InputArgument('foo', InputArgument::OPTIONAL, 'The foo argument'),
405-
new InputArgument('baz', InputArgument::OPTIONAL, 'The baz argument', true),
406-
new InputArgument('bar', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The bar argument', array('bar')),
407-
new InputOption('foo', 'f', InputOption::VALUE_REQUIRED, 'The foo option'),
408-
new InputOption('baz', null, InputOption::VALUE_OPTIONAL, 'The baz option', false),
409-
new InputOption('bar', 'b', InputOption::VALUE_OPTIONAL, 'The bar option', 'bar'),
410-
));
411-
$this->assertXmlStringEqualsXmlFile(self::$fixtures.'/definition_asxml.txt', $definition->asXml(), '->asXml() returns an XML representation of the InputDefinition');
412-
}
413-
414376
protected function initializeArguments()
415377
{
416378
$this->foo = new InputArgument('foo');

src/Symfony/Component/Console/Tests/Input/StringInputTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@ public function testInputOptionWithGivenString()
4141
$this->assertEquals('bar', $input->getOption('foo'));
4242
}
4343

44-
/**
45-
* @group legacy
46-
*/
47-
public function testLegacyInputOptionDefinitionInConstructor()
48-
{
49-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
50-
51-
$definition = new InputDefinition(
52-
array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
53-
);
54-
55-
$input = new StringInput('--foo=bar', $definition);
56-
$this->assertEquals('bar', $input->getOption('foo'));
57-
}
58-
5944
public function getTokenizeData()
6045
{
6146
return array(

0 commit comments

Comments
 (0)
0