Skip to content

Commit 8c4d4fc

Browse files
add typehint to every properties
1 parent f00cf6c commit 8c4d4fc

33 files changed

+75
-193
lines changed

src/bref/bref/Context.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,13 @@
1111
*/
1212
final class Context implements \JsonSerializable
1313
{
14-
/** @var string */
15-
private $awsRequestId;
16-
17-
/** @var int Holds the deadline Unix timestamp in millis */
18-
private $deadlineMs;
19-
20-
/** @var string */
21-
private $invokedFunctionArn;
22-
23-
/** @var string */
24-
private $traceId;
25-
26-
public function __construct(string $awsRequestId, int $deadlineMs, string $invokedFunctionArn, string $traceId)
27-
{
28-
$this->awsRequestId = $awsRequestId;
29-
$this->deadlineMs = $deadlineMs;
30-
$this->invokedFunctionArn = $invokedFunctionArn;
31-
$this->traceId = $traceId;
14+
public function __construct(
15+
private string $awsRequestId,
16+
/** @var int Holds the deadline Unix timestamp in millis */
17+
private int $deadlineMs,
18+
private string $invokedFunctionArn,
19+
private string $traceId
20+
) {
3221
}
3322

3423
/**

src/bref/src/BrefRunner.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@
1313
*/
1414
class BrefRunner implements RunnerInterface
1515
{
16-
private $handler;
17-
private $loopMax;
18-
19-
public function __construct(Handler $handler, int $loopMax)
16+
public function __construct(private Handler $handler, private int $loopMax)
2017
{
21-
$this->handler = $handler;
22-
$this->loopMax = $loopMax;
2318
}
2419

2520
public function run(): int

src/bref/src/ConsoleApplicationHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
class ConsoleApplicationHandler implements Handler
1717
{
18-
private $application;
18+
private Application $application;
1919

2020
public function __construct(Application $application)
2121
{

src/bref/src/ConsoleApplicationRunner.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
*/
1414
class ConsoleApplicationRunner implements RunnerInterface
1515
{
16-
private $handler;
17-
private $loopMax;
16+
private ConsoleApplicationHandler $handler;
1817

19-
public function __construct(Application $application, int $loopMax = 1)
18+
public function __construct(Application $application, private int $loopMax = 1)
2019
{
2120
$this->handler = new ConsoleApplicationHandler($application);
22-
$this->loopMax = $loopMax;
2321
}
2422

2523
public function run(): int

src/bref/src/Lambda/ContextBuilder.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@
99
*/
1010
final class ContextBuilder
1111
{
12-
/** @var string */
13-
private $awsRequestId;
12+
private string $awsRequestId;
1413

15-
/** @var int */
16-
private $deadlineMs;
14+
private int $deadlineMs;
1715

18-
/** @var string */
19-
private $invokedFunctionArn;
16+
private string $invokedFunctionArn;
2017

21-
/** @var string */
22-
private $traceId;
18+
private string $traceId;
2319

2420
public function __construct()
2521
{

src/bref/src/Lambda/LambdaClient.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,20 @@ final class LambdaClient
3737
/** @var resource|\CurlHandle|null */
3838
private $returnHandler;
3939

40-
/** @var string */
41-
private $apiUrl;
42-
43-
/** @var string */
44-
private $layer;
40+
private string $apiUrl;
4541

4642
public static function fromEnvironmentVariable(string $layer): self
4743
{
4844
return new self((string) getenv('AWS_LAMBDA_RUNTIME_API'), $layer);
4945
}
5046

51-
public function __construct(string $apiUrl, string $layer)
47+
public function __construct(string $apiUrl, private string $layer)
5248
{
5349
if ('' === $apiUrl) {
5450
exit('At the moment lambdas can only be executed in an Lambda environment');
5551
}
5652

5753
$this->apiUrl = $apiUrl;
58-
$this->layer = $layer;
5954
}
6055

6156
public function __destruct()

src/bref/src/LaravelHttpHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class LaravelHttpHandler extends HttpHandler
1818
{
19-
private $kernel;
19+
private Kernel $kernel;
2020

2121
public function __construct(Kernel $kernel)
2222
{

src/bref/src/LocalRunner.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@
1313
*/
1414
class LocalRunner implements RunnerInterface
1515
{
16-
private $handler;
17-
private $data;
18-
19-
public function __construct(Handler $handler, $data)
16+
public function __construct(private Handler $handler, private mixed $data)
2017
{
21-
$this->handler = $handler;
22-
$this->data = $data;
2318
}
2419

2520
public function run(): int

src/bref/src/SymfonyHttpHandler.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@
1717
*/
1818
class SymfonyHttpHandler extends HttpHandler
1919
{
20-
private $kernel;
21-
22-
public function __construct(HttpKernelInterface $kernel)
20+
public function __construct(private HttpKernelInterface $kernel)
2321
{
24-
$this->kernel = $kernel;
25-
2622
Request::setTrustedProxies(['127.0.0.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
2723
}
2824

src/bref/tests/Lambda/LambdaClientTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
*/
1717
class LambdaClientTest extends TestCase
1818
{
19-
/** @var LambdaClient */
20-
private $lambda;
19+
private LambdaClient $lambda;
2120

2221
protected function setUp(): void
2322
{

0 commit comments

Comments
 (0)