8000 CS fix · symfony/symfony@617c835 · GitHub
[go: up one dir, main page]

Skip to content

Commit 617c835

Browse files
CS fix
1 parent 9a04b00 commit 617c835

File tree

19 files changed

+29
-29
lines changed

19 files changed

+29
-29
lines changed

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (!file_exists(__DIR__.'/src')) {
77
return PhpCsFixer\Config::create()
88
->setRules([
99
'@PHP71Migration' => true,
10-
'@PHPUnit75Migration:risky' => true,
10+
'@PHPUnit75Migration:risky' => true,
1111
'@Symfony' => true,
1212
'@Symfony:risky' => true,
1313
'protected_to_private' => false,

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testCollectQueries($param, $types, $expected, $explainable, bool
8888

8989
$collectedParam = $collectedQueries['default'][0]['params'][0];
9090
if ($collectedParam instanceof Data) {
91-
$dumper = new CliDumper($out = fopen('php://memory', 'r+b'));
91+
$dumper = new CliDumper($out = fopen('php://memory', 'r+'));
9292
$dumper->setColors(false);
9393
$collectedParam->dump($dumper);
9494
$this->assertStringMatchesFormat($expected, print_r(stream_get_contents($out, -1, 0), true));
@@ -162,7 +162,7 @@ public function testSerialization($param, $types, $expected, $explainable, bool
162162

163163
$collectedParam = $collectedQueries['default'][0]['params'][0];
164164
if ($collectedParam instanceof Data) {
165-
$dumper = new CliDumper($out = fopen('php://memory', 'r+b'));
165+
$dumper = new CliDumper($out = fopen('php://memory', 'r+'));
166166
$dumper->setColors(false);
167167
$collectedParam->dump($dumper);
168168
$this->assertStringMatchesFormat($expected, print_r(stream_get_contents($out, -1, 0), true));

src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct(array $options = [])
7070
'*' => [$this, 'castObject'],
7171
]);
7272

73-
$this->outputBuffer = fopen('php://memory', 'r+b');
73+
$this->outputBuffer = fopen('php://memory', 'r+');
7474
if ($this->options['multiline']) {
7575
$output = $this->outputBuffer;
7676
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function dump(Environment $env, $context)
8181
unset($vars[0], $vars[1]);
8282
}
8383

84-
$dump = fopen('php://memory', 'r+b');
84+
$dump = fopen('php://memory', 'r+');
8585
$this->dumper = $this->dumper ?: new HtmlDumper();
8686
$this->dumper->setCharset($env->getCharset());
8787

src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class WebProfilerExtension extends ProfilerExtension
4545
public function __construct(HtmlDumper $dumper = null)
4646
{
4747
$this->dumper = $dumper ?: new HtmlDumper();
48-
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+b'));
48+
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
4949
}
5050

5151
/**
@@ -62,7 +62,7 @@ public function enter(Profile $profile)
6262
public function leave(Profile $profile)
6363
{
6464
if (0 === --$this->stackLevel) {
65-
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+b'));
65+
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
6666
}
6767
}
6868

src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function doDeleteYieldTags(array $ids): iterable
136136
{
137137
foreach ($ids as $id) {
138138
$file = $this->getFile($id);
139-
if (!file_exists($file) || !$h = @fopen($file, 'rb')) {
139+
if (!file_exists($file) || !$h = @fopen($file, 'r')) {
140140
continue;
141141
}
142142

src/Symfony/Component/Cache/Traits/FilesystemTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function prune()
3434
$pruned = true;
3535

3636
foreach ($this->scanHashDir($this->directory) as $file) {
37-
if (!$h = @fopen($file, 'rb')) {
37+
if (!$h = @fopen($file, 'r')) {
3838
continue;
3939
}
4040

@@ -59,7 +59,7 @@ protected function doFetch(array $ids)
5959

6060
foreach ($ids as $id) {
6161
$file = $this->getFile($id);
62-
if (!file_exists($file) || !$h = @fopen($file, 'rb')) {
62+
if (!file_exists($file) || !$h = @fopen($file, 'r')) {
6363
continue;
6464
}
6565
if (($expiresAt = (int) fgets($h)) && $now >= $expiresAt) {
@@ -111,7 +111,7 @@ protected function doSave(array $values, int $lifetime)
111111

112112
private function getFileKey(string $file): string
113113
{
114-
if (!$h = @fopen($file, 'rb')) {
114+
if (!$h = @fopen($file, 'r')) {
115115
return '';
116116
}
117117

src/Symfony/Component/Cache/Traits/PhpFilesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected function doUnlink($file)
288288

289289
private function getFileKey(string $file): string
290290
{
291-
if (!$h = @fopen($file, 'rb')) {
291+
if (!$h = @fopen($file, 'r')) {
292292
return '';
293293
}
294294

src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ConsoleSectionOutputTest extends TestCase
2626

2727
protected function setUp(): void
2828
{
29-
$this->stream = fopen('php://memory', 'r+b', false);
29+
$this->stream = fopen('php://memory', 'r+', false);
3030
}
3131

3232
protected function tearDown(): void
@@ -143,7 +143,7 @@ public function testMultipleSectionsOutput()
143143

144144
public function testClearSectionContainingQuestion()
145145
{
146-
$inputStream = fopen('php://memory', 'r+b', false);
146+
$inputStream = fopen('php://memory', 'r+', false);
147147
fwrite($inputStream, "Batman & Robin\n");
148148
rewind($inputStream);
149149

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ public function sendContent()
300300
return $this;
301301
}
302302

303-
$out = fopen('php://output', 'wb');
304-
$file = fopen($this->file->getPathname(), 'rb');
303+
$out = fopen('php://output', 'w');
304+
$file = fopen($this->file->getPathname(), 'r');
305305

306306
stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);
307307

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ public function getContent($asResource = false)
15401540

15411541
$this->content = false;
15421542

1543-
return fopen('php://input', 'rb');
1543+
return fopen('php://input', 'r');
15441544
}
15451545

15461546
if ($currentContentIsResource) {

src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getDumpsCount()
194194

195195
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1)
196196
{
197-
$data = fopen('php://memory', 'r+b');
197+
$data = fopen('php://memory', 'r+');
198198

199199
if ('html' === $format) {
200200
$dumper = new HtmlDumper($data, $this->charset);

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function lock(Request $request)
6969
if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
7070
return $path;
7171
}
72-
$h = fopen($path, 'cb');
72+
$h = fopen($path, 'c');
7373
if (!flock($h, \LOCK_EX | \LOCK_NB)) {
7474
fclose($h);
7575

@@ -114,7 +114,7 @@ public function isLocked(Request $request)
114114
return false;
115115
}
116116

117-
$h = fopen($path, 'rb');
117+
$h = fopen($path, 'r');
118118
flock($h, \LOCK_EX | \LOCK_NB, $wouldBlock);
119119
flock($h, \LOCK_UN); // release the lock we just acquired
120120
fclose($h);
@@ -379,7 +379,7 @@ private function save(string $key, string $data, bool $overwrite = true): bool
379379
}
380380

381381
$tmpFile = tempnam(\dirname($path), basename($path));
382-
if (false === $fp = @fopen($tmpFile, 'wb')) {
382+
if (false === $fp = @fopen($tmpFile, 'w')) {
383383
@unlink($tmpFile);
384384

385385
return false;

src/Symfony/Component/Process/Process.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,8 @@ private function resetProcessData()
14971497
$this->exitcode = null;
14981498
$this->fallbackStatus = [];
14991499
$this->processInformation = null;
1500-
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
1501-
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
1500+
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
1501+
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
15021502
$this->process = null;
15031503
$this->latestSignal = null;
15041504
$this->status = self::STATUS_READY;

src/Symfony/Component/Security/Core/Tests/Authorization/TraceableAccessDecisionManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function provideObjectsAndLogs(): \Generator
127127
yield [
128128
[[
129129
'attributes' => [new \stdClass()],
130-
'object' => $x = fopen(__FILE__, 'rb'),
130+
'object' => $x = fopen(__FILE__, 'r'),
131131
'result' => true,
132132
'voterDetails' => [],
133133
]],

src/Symfony/Component/Translation/Dumper/CsvFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CsvFileDumper extends FileDumper
2828
*/
2929
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
3030
{
31-
$handle = fopen('php://memory', 'r+b');
31+
$handle = fopen('php://memory', 'r+');
3232

3333
foreach ($messages->all($domain) as $source => $target) {
3434
fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure);

src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function setOutput($output)
7070
$this->lineDumper = $output;
7171
} else {
7272
if (\is_string($output)) {
73-
$output = fopen($output, 'wb');
73+
$output = fopen($output, 'w');
7474
}
7575
$this->outputStream = $output;
7676
$this->lineDumper = [$this, 'echoLine'];
@@ -130,7 +130,7 @@ public function dump(Data $data, $output = null)
130130
}
131131

132132
if ($returnDump = true === $output) {
133-
$output = fopen('php://memory', 'r+b');
133+
$output = fopen('php://memory', 'r+');
134134
}
135135
if ($output) {
136136
$prevOutput = $this->setOutput($output);

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ protected function supportsColors()
540540
}
541541

542542
$h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null];
543-
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
543+
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'w') : $this->outputStream;
544544

545545
return static::$defaultColors = $this->hasColorSupport($h);
546546
}

src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testCharset()
141141

142142
public function testAppend()
143143
{
144-
$out = fopen('php://memory', 'r+b');
144+
$out = fopen('php://memory', 'r+');
145145

146146
$dumper = new HtmlDumper();
147147
$dumper->setDumpHeader('<foo></foo>');

0 commit comments

Comments
 (0)
0