8000 Cleanup after bump to Symfony v4.4 · symfony/symfony@e9a9557 · GitHub
[go: up one dir, main page]

Skip to content

Commit e9a9557

Browse files
Cleanup after bump to Symfony v4.4
1 parent 3d10a6c commit e9a9557

File tree

4 files changed

+5
-30
lines changed

4 files changed

+5
-30
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ vendor/
22
composer.lock
33
phpunit.xml
44
.php_cs.cache
5+
.phpunit.result.cache

Factory/HttpFoundationFactory.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,10 @@ private function createUploadedFile(UploadedFileInterface $psrUploadedFile)
112112
$clientFileName = $psrUploadedFile->getClientFilename();
113113
}
114114

115-
if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) {
116-
// Symfony 4.1+
117-
return new UploadedFile(
118-
$temporaryPath,
119-
null === $clientFileName ? '' : $clientFileName,
120-
$psrUploadedFile->getClientMediaType(),
121-
$psrUploadedFile->getError(),
122-
true
123-
);
124-
}
125-
126115
return new UploadedFile(
127116
$temporaryPath,
128117
null === $clientFileName ? '' : $clientFileName,
129118
$psrUploadedFile->getClientMediaType(),
130-
$psrUploadedFile->getSize(),
131119
$psrUploadedFile->getError(),
132120
true
133121
);

Tests/Factory/AbstractHttpMessageFactoryTest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,7 @@ private function createUploadedFile($content, $originalName, $mimeType, $error)
132132
$path = tempnam($this->tmpDir, uniqid());
133133
file_put_contents($path, $content);
134134

135-
if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) {
136-
// Symfony 4.1+
137-
return new UploadedFile($path, $originalName, $mimeType, $error, true);
138-
}
139-
140-
return new UploadedFile($path, $originalName, $mimeType, filesize($path), $error, true);
135+
return new UploadedFile($path, $originalName, $mimeType, $error, true);
141136
}
142137

143138
public function testCreateResponse()
@@ -189,12 +184,8 @@ public function testCreateResponseFromBinaryFile()
189184

190185
public function testUploadErrNoFile()
191186
{
192-
if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) {
193-
// Symfony 4.1+
194-
$file = new UploadedFile('', '', null, UPLOAD_ERR_NO_FILE, true);
195-
} else {
196-
$file = new UploadedFile('', '', null, 0, UPLOAD_ERR_NO_FILE, true);
197-
}
187+
$file = new UploadedFile('', '', null, UPLOAD_ERR_NO_FILE, true);
188+
198189
$this->assertEquals(0, $file->getSize());
199190
$this->assertEquals(UPLOAD_ERR_NO_FILE, $file->getError());
200191
$this->assertFalse($file->getSize(), 'SplFile::getSize() returns false on error');

Tests/Functional/CovertTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ private function createUploadedFile($content, $originalName, $mimeType, $error)
229229
$path = tempnam($this->tmpDir, uniqid());
230230
file_put_contents($path, $content);
231231

232-
if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) {
233-
// Symfony 4.1+
234-
return new UploadedFile($path, $originalName, $mimeType, $error, true);
235-
}
236-
237-
return new UploadedFile($path, $originalName, $mimeType, filesize($path), $error, true);
232+
return new UploadedFile($path, $originalName, $mimeType, $error, true);
238233
}
239234
}

0 commit comments

Comments
 (0)
0