8000 minor #91 Fix CS (derrabus) · symfony/symfony@e62b239 · GitHub
[go: up one dir, main page]

Skip to content

Commit e62b239

Browse files
committed
minor #91 Fix CS (derrabus)
This PR was merged into the 2.0-dev branch. Discussion ---------- Fix CS This PR contains changes made by PHP CS Fixer 2.18. This should make fabbot happy. Commits ------- 2bead22 Fix CS
2 parents 488df9b + 2bead22 commit e62b239

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

Factory/PsrHttpFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function getFiles(array $uploadedFiles)
8989

9090
foreach ($uploadedFiles as $key => $value) {
9191
if (null === $value) {
92-
$files[$key] = $this->uploadedFileFactory->createUploadedFile($this->streamFactory->createStream(), 0, UPLOAD_ERR_NO_FILE);
92+
$files[$key] = $this->uploadedFileFactory->createUploadedFile($this->streamFactory->createStream(), 0, \UPLOAD_ERR_NO_FILE);
9393
continue;
9494
}
9595
if ($value instanceof UploadedFile) {

Factory/UploadedFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(UploadedFileInterface $psrUploadedFile, callable $ge
2929
$error = $psrUploadedFile->getError();
3030
$path = '';
3131

32-
if (UPLOAD_ERR_NO_FILE !== $error) {
32+
if (\UPLOAD_ERR_NO_FILE !== $error) {
3333
$path = $psrUploadedFile->getStream()->getMetadata('uri') ?? '';
3434

3535
if ($this->test = !\is_string($path) || !is_uploaded_file($path)) {

Tests/Factory/AbstractHttpMessageFactoryTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractHttpMessageFactoryTest extends TestCase
3131

3232
abstract protected function buildHttpMessageFactory(): HttpMessageFactoryInterface;
3333

34-
public function setUp(): void
34+
protected function setUp(): void
3535
{
3636
$this->factory = $this->buildHttpMessageFactory();
3737
$this->tmpDir = sys_get_temp_dir();
@@ -61,8 +61,8 @@ public function testCreateRequest()
6161
'c2' => ['c3' => 'bar'],
6262
],
6363
[
64-
'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', UPLOAD_ERR_OK),
65-
'foo' => ['f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', UPLOAD_ERR_OK)],
64+
'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', \UPLOAD_ERR_OK),
65+
'foo' => ['f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', \UPLOAD_ERR_OK)],
6666
],
6767
[
6868
'REQUEST_METHOD' => 'POST',
@@ -102,12 +102,12 @@ public function testCreateRequest()
102102
$this->assertEquals('F1', $uploadedFiles['f1']->getStream()->__toString());
103103
$this->assertEquals('f1.txt', $uploadedFiles['f1']->getClientFilename());
104104
$this->assertEquals('text/plain', $uploadedFiles['f1']->getClientMediaType());
105-
$this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['f1']->getError());
105+
$this->assertEquals(\UPLOAD_ERR_OK, $uploadedFiles['f1']->getError());
106106

107107
$this->assertEquals('F2', $uploadedFiles['foo']['f2']->getStream()->__toString());
108108
$this->assertEquals('f2.txt', $uploadedFiles['foo']['f2']->getClientFilename());
109109
$this->assertEquals('text/plain', $uploadedFiles['foo']['f2']->getClientMediaType());
110-
$this->assertEquals(UPLOAD_ERR_OK, $uploadedFiles['foo']['f2']->getError());
110+
$this->assertEquals(\UPLOAD_ERR_OK, $uploadedFiles['foo']['f2']->getError());
111111

112112
$serverParams = $psrRequest->getServerParams();
113113
$this->assertEquals('POST', $serverParams['REQUEST_METHOD']);
@@ -201,10 +201,10 @@ public function testCreateResponseFromBinaryFileWithRange()
201201

202202
public function testUploadErrNoFile()
203203
{
204-
$file = new UploadedFile('', '', null, UPLOAD_ERR_NO_FILE, true);
204+
$file = new UploadedFile('', '', null, \UPLOAD_ERR_NO_FILE, true);
205205

206206
$this->assertEquals(0, $file->getSize());
207-
$this->assertEquals(UPLOAD_ERR_NO_FILE, $file->getError());
207+
$this->assertEquals(\UPLOAD_ERR_NO_FILE, $file->getError());
208208
$this->assertFalse($file->getSize(), 'SplFile::getSize() returns false on error');
209209

210210
$request = new Request(
@@ -214,7 +214,7 @@ public function testUploadErrNoFile()
214214
[],
215215
[
216216
'f1' => $file,
217-
'f2' => ['name' => null, 'type' => null, 'tmp_name' => null, 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0],
217+
'f2' => ['name' => null, 'type' => null, 'tmp_name' => null, 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0],
218218
],
219219
[
220220
'REQUEST_METHOD' => 'POST',
@@ -228,7 +228,7 @@ public function testUploadErrNoFile()
228228

229229
$uploadedFiles = $psrRequest->getUploadedFiles();
230230

231-
$this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f1']->getError());
232-
$this->assertEquals(UPLOAD_ERR_NO_FILE, $uploadedFiles['f2']->getError());
231+
$this->assertEquals(\UPLOAD_ERR_NO_FILE, $uploadedFiles['f1']->getError());
232+
$this->assertEquals(\UPLOAD_ERR_NO_FILE, $uploadedFiles['f2']->getError());
233233
}
234234
}

Tests/Factory/HttpFoundationFactoryTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class HttpFoundationFactoryTest extends TestCase
3434
/** @var string */
3535
private $tmpDir;
3636

37-
public function setUp(): void
37+
protected function setUp(): void
3838
{
3939
$this->factory = new HttpFoundationFactory();
4040
$this->tmpDir = sys_get_temp_dir();
@@ -57,11 +57,11 @@ public function testCreateRequest()
5757
['city' => 'Lille'],
5858
['url' => 'http://les-tilleuls.coop'],
5959
[
60-
'doc1' => $this->createUploadedFile('Doc 1', UPLOAD_ERR_OK, 'doc1.txt', 'text/plain'),
60+
'doc1' => $this->createUploadedFile('Doc 1', \UPLOAD_ERR_OK, 'doc1.txt', 'text/plain'),
6161
'nested' => [
6262
'docs' => [
63-
$this->createUploadedFile('Doc 2', UPLOAD_ERR_OK, 'doc2.txt', 'text/plain'),
64-
$this->createUploadedFile('Doc 3', UPLOAD_ERR_OK, 'doc3.txt', 'text/plain'),
63+
$this->createUploadedFile('Doc 2', \UPLOAD_ERR_OK, 'doc2.txt', 'text/plain'),
64+
$this->createUploadedFile('Doc 3', \UPLOAD_ERR_OK, 'doc3.txt', 'text/plain'),
6565
],
6666
],
6767
],
@@ -168,15 +168,15 @@ public function testCreateRequestWithUri()
168168

169169
public function testCreateUploadedFile()
170170
{
171-
$uploadedFile = $this->createUploadedFile('An uploaded file.', UPLOAD_ERR_OK, 'myfile.txt', 'text/plain');
171+
$uploadedFile = $this->createUploadedFile('An uploaded file.', \UPLOAD_ERR_OK, 'myfile.txt', 'text/plain');
172172
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
173173
$size = $symfonyUploadedFile->getSize();
174174

175175
$uniqid = uniqid();
176176
$symfonyUploadedFile->move($this->tmpDir, $uniqid);
177177

178178
$this->assertEquals($uploadedFile->getSize(), $size);
179-
$this->assertEquals(UPLOAD_ERR_OK, $symfonyUploadedFile->getError());
179+
$this->assertEquals(\UPLOAD_ERR_OK, $symfonyUploadedFile->getError());
180180
$this->assertEquals('myfile.txt', $symfonyUploadedFile->getClientOriginalName());
181181
$this->assertEquals('txt', $symfonyUploadedFile->getClientOriginalExtension());
182182
$this->assertEquals('text/plain', $symfonyUploadedFile->getClientMimeType());
@@ -188,10 +188,10 @@ public function testCreateUploadedFileWithError()
188188
$this->expectException(FileException::class);
189189
$this->expectExceptionMessage('The file "e" could not be written on disk.');
190190

191-
$uploadedFile = $this->createUploadedFile('Error.', UPLOAD_ERR_CANT_WRITE, 'e', 'text/plain');
191+
$uploadedFile = $this->createUploadedFile('Error.', \UPLOAD_ERR_CANT_WRITE, 'e', 'text/plain');
192192
$symfonyUploadedFile = $this->callCreateUploadedFile($uploadedFile);
193193

194-
$this->assertEquals(UPLOAD_ERR_CANT_WRITE, $symfonyUploadedFile->getError());
194+
$this->assertEquals(\UPLOAD_ERR_CANT_WRITE, $symfonyUploadedFile->getError());
195195

196196
$symfonyUploadedFile->move($this->tmpDir, 'shouldFail.txt');
197197
}

Tests/Fixtures/Stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function isSeekable()
5959
return true;
6060
}
6161

62-
public function seek($offset, $whence = SEEK_SET)
62+
public function seek($offset, $whence = \SEEK_SET)
6363
{
6464
}
6565

Tests/Fixtures/UploadedFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UploadedFile implements UploadedFileInterface
2424
private $clientFileName;
2525
private $clientMediaType;
2626

27-
public function __construct($filePath, $size = null, $error = UPLOAD_ERR_OK, $clientFileName = null, $clientMediaType = null)
27+
public function __construct($filePath, $size = null, $error = \UPLOAD_ERR_OK, $clientFileName = null, $clientMediaType = null)
2828
{
2929
$this->filePath = $filePath;
3030
$this->size = $size;

Tests/Functional/CovertTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class CovertTest extends TestCase
3636
{
3737
private $tmpDir;
3838

39-
public function setUp(): void
39+
protected function setUp(): void
4040
{
41-
if (!class_exists('Nyholm\Psr7\ServerRequest')) {
41+
if (!class_exists(Psr7Request::class)) {
4242
$this->markTestSkipped('nyholm/psr7 is not installed.');
4343
}
4444

@@ -124,8 +124,8 @@ public function requestProvider()
124124
'c2' => ['c3' => 'bar'],
125125
],
126126
[
127-
'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', UPLOAD_ERR_OK),
128-
'foo' => ['f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', UPLOAD_ERR_OK)],
127+
'f1' => $this->createUploadedFile('F1', 'f1.txt', 'text/plain', \UPLOAD_ERR_OK),
128+
'foo' => ['f2' => $this->createUploadedFile('F2', 'f2.txt', 'text/plain', \UPLOAD_ERR_OK)],
129129
],
130130
[
131131
'REQUEST_METHOD' => 'POST',

0 commit comments

Comments
 (0)
0