8000 [VarDumper][FrameworkBundle] Remove checking if OutputFormatterStyle … · symfony/symfony@ad7700c · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad7700c

Browse files
committed
[VarDumper][FrameworkBundle] Remove checking if OutputFormatterStyle setHref method exist
1 parent 9b2a4db commit ad7700c

File tree

2 files changed

+13
-34
lines changed

2 files changed

+13
-34
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Console\Attribute\AsCommand;
1616
use Symfony\Component\Console\Completion\CompletionInput;
1717
use Symfony\Component\Console\Completion\CompletionSuggestions;
18-
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1918
use Symfony\Component\Console\Input\InputArgument;
2019
use Symfony\Component\Console\Input\InputInterface;
2120
use Symfony\Component\Console\Input\InputOption;
@@ -34,12 +33,10 @@
3433
#[AsCommand(name: 'debug:autowiring', description: 'List classes/interfaces you can use for autowiring')]
3534
class DebugAutowiringCommand extends ContainerDebugCommand
3635
{
37-
private bool $supportsHref;
3836
private ?FileLinkFormatter $fileLinkFormatter;
3937

4038
public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
4139
{
42-
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
4340
$this->fileLinkFormatter = $fileLinkFormatter;
4441
parent::__construct($name);
4542
}
@@ -124,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
124121
}
125122

126123
$serviceLine = sprintf('<fg=yellow>%s</>', $serviceId);
127-
if ($this->supportsHref && '' !== $fileLink = $this->getFileLink($previousId)) {
124+
if ('' !== $fileLink = $this->getFileLink($previousId)) {
128125
$serviceLine = substr($serviceId, \strlen($previousId));
129126
$serviceLine = sprintf('<fg=yellow;href=%s>%s</>', $fileLink, $previousId).('' !== $serviceLine ? sprintf('<fg=yellow>%s</>', $serviceLine) : '');
130127
}

src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\VarDumper\Tests\Command\Descriptor;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1615
use Symfony\Component\Console\Output\BufferedOutput;
1716
use Symfony\Component\VarDumper\Cloner\Data;
1817
use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor;
@@ -84,20 +83,7 @@ public static function provideContext()
8483
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
8584
],
8685
],
87-
method_exists(OutputFormatterStyle::class, 'setHref') ?
88-
<<<TXT
89-
Received from client #1
90-
-----------------------
91-
92-
-------- --------------------------------------------------------------------------------
93-
date Fri, 14 Dec 2018 16:17:48 +0000
94-
source CliDescriptorTest.php on line 30
95-
file src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
96-
-------- --------------------------------------------------------------------------------
97-
98-
TXT
99-
:
100-
<<<TXT
86+
<<<TXT
10187
Received from client #1
10288
-----------------------
10389
@@ -107,29 +93,25 @@ public static function provideContext()
10793
file src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
10894
-------- --------------------------------------------------------------------------------
10995
110-
Open source in your IDE/browser:
111-
phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30
11296
TXT
11397
];
11498

115-
if (method_exists(OutputFormatterStyle::class, 'setHref')) {
116-
yield 'source with hyperlink' => [
117-
[
118-
'source' => [
119-
'name' => 'CliDescriptorTest.php',
120-
'line' => 30,
121-
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
122-
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
123-
],
99+
yield 'source with hyperlink' => [
100+
[
101+
'source' => [
102+
'name' => 'CliDescriptorTest.php',
103+
'line' => 30,
104+
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
105+
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
124106
],
125-
<<<TXT
107+
],
108+
<<<TXT
126109
%A
127110
source \033]8;;phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30\033\CliDescriptorTest.php on line 30\033]8;;\033%A
128111
%A
129112
TXT
130-
, true,
131-
];
132-
}
113+
, true,
114+
];
133115

134116
yield 'cli' => [
135117
[

0 commit comments

Comments
 (0)
0