Skip to content

Commit 0ecfb1e

Browse files
committed
refactor: using property promotion on ResponseTraitTest
1 parent 4ee48ac commit 0ecfb1e

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

tests/system/API/ResponseTraitTest.php

+4-22
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,10 @@ protected function makeController(string $routePath = '', array $userHeaders = [
116116
return new class ($this->request, $this->response, $this->formatter) {
117117
use ResponseTrait;
118118

119-
protected $request;
120-
protected $response;
121119
protected $formatter;
122120

123-
public function __construct($request, $response, $formatter)
121+
public function __construct(protected $request, protected $response, $formatter)
124122
{
125-
$this->request = $request;
126-
$this->response = $response;
127123
$this->formatter = $formatter;
128124
}
129125

@@ -177,15 +173,11 @@ public function testNoFormatterWithStringAsHtmlTrue(): void
177173
$controller = new class ($this->request, $this->response, $this->formatter) {
178174
use ResponseTrait;
179175

180-
protected $request;
181-
protected $response;
182176
protected $formatter;
183177
protected bool $stringAsHtml = true;
184178

185-
public function __construct($request, $response, $formatter)
179+
public function __construct(protected $request, protected $response, $formatter)
186180
{
187-
$this->request = $request;
188-
$this->response = $response;
189181
$this->formatter = $formatter;
190182
}
191183
};
@@ -299,15 +291,11 @@ public function testRespondSetsCorrectBodyAndStatusWithStringAsHtmlTrue(): void
299291
$controller = new class ($this->request, $this->response, $this->formatter) {
300292
use ResponseTrait;
301293

302-
protected $request;
303-
protected $response;
304294
protected $formatter;
305295
protected bool $stringAsHtml = true;
306296

307-
public function __construct($request, $response, $formatter)
297+
public function __construct(protected $request, protected $response, $formatter)
308298
{
309-
$this->request = $request;
310-
$this->response = $response;
311299
$this->formatter = $formatter;
312300
}
313301
};
@@ -639,14 +627,8 @@ public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML(): void
639627
$controller = new class ($request, $response) {
640628
use ResponseTrait;
641629

642-
protected $request;
643-
protected $response;
644-
645-
public function __construct($request, $response)
630+
public function __construct(protected $request, protected $response)
646631
{
647-
$this->request = $request;
648-
$this->response = $response;
649-
650632
$this->format = 'txt';
651633
}
652634
};

0 commit comments

Comments
 (0)