Skip to content

Commit b11f772

Browse files
committed
Rename Request::getPostAndFiles to Request::getFormData
1 parent b508f5c commit b11f772

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ public function getOptions() : array
654654
Method::POST,
655655
Method::PUT,
656656
], true)) {
657-
$options[\CURLOPT_POSTFIELDS] = $this->getPostAndFiles();
657+
$options[\CURLOPT_POSTFIELDS] = $this->getFormData();
658658
}
659659
$options[\CURLOPT_CUSTOMREQUEST] = $this->getMethod();
660660
$options[\CURLOPT_HEADER] = false;
@@ -683,7 +683,7 @@ public function getOption(int $option) : mixed
683683
*
684684
* @return array<string,mixed>|string
685685
*/
686-
public function getPostAndFiles() : array | string
686+
public function getFormData() : array | string
687687
{
688688
if (!$this->hasFiles()) {
689689
return $this->getBody();

tests/RequestTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,12 @@ public function testPostAndFiles() : void
377377
self::assertTrue($request->hasFiles());
378378
}
379379

380-
public function testGetPostAndFiles() : void
380+
public function testGetFormData() : void
381381
{
382382
$request = new Request('http://foo.com');
383-
self::assertSame('', $request->getPostAndFiles());
383+
self::assertSame('', $request->getFormData());
384384
$request->setBody(['foo' => 123]);
385-
self::assertSame('foo=123', $request->getPostAndFiles());
385+
self::assertSame('foo=123', $request->getFormData());
386386
$request->setFiles([
387387
'one' => __FILE__,
388388
'two' => [
@@ -395,7 +395,7 @@ public function testGetPostAndFiles() : void
395395
],
396396
],
397397
]);
398-
$postAndFiles = $request->getPostAndFiles();
398+
$postAndFiles = $request->getFormData();
399399
self::assertSame('123', $postAndFiles['foo']); // @phpstan-ignore-line
400400
self::assertInstanceOf(\CURLFile::class, $postAndFiles['one']); // @phpstan-ignore-line
401401
self::assertInstanceOf(\CURLFile::class, $postAndFiles['two[three]']); // @phpstan-ignore-line
@@ -408,7 +408,7 @@ public function testGetPostAndFiles() : void
408408
$this->expectExceptionMessage(
409409
"Field 'foo' does not match a file: bar.war"
410410
);
411-
$request->getPostAndFiles();
411+
$request->getFormData();
412412
}
413413

414414
public function testSetAndGetOptions() : void

0 commit comments

Comments
 (0)