Skip to content

Commit 8f0a23c

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

33 files changed

+77
-169
lines changed

src/bref/bref/Context.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,14 @@
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)
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+
)
2721
{
28-
$this->awsRequestId = $awsRequestId;
29-
$this->deadlineMs = $deadlineMs;
30-
$this->invokedFunctionArn = $invokedFunctionArn;
31-
$this->traceId = $traceId;
3222
}
3323

3424
/**

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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
final class ContextBuilder
1111
{
1212
/** @var string */
13-
private $awsRequestId;
13+
private string $awsRequestId;
1414

1515
/** @var int */
16-
private $deadlineMs;
16+
private int $deadlineMs;
1717

1818
/** @var string */
19-
private $invokedFunctionArn;
19+
private string $invokedFunctionArn;
2020

2121
/** @var string */
22-
private $traceId;
22+
private string $traceId;
2323

2424
public function __construct()
2525
{

src/bref/src/Lambda/LambdaClient.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,20 @@ final class LambdaClient
3838
private $returnHandler;
3939

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

4643
public static function fromEnvironmentVariable(string $layer): self
4744
{
4845
return new self((string) getenv('AWS_LAMBDA_RUNTIME_API'), $layer);
4946
}
5047

51-
public function __construct(string $apiUrl, string $layer)
48+
public function __construct(string $apiUrl, private string $layer)
5249
{
5350
if ('' === $apiUrl) {
5451
exit('At the moment lambdas can only be executed in an Lambda environment');
5552
}
5653

5754
$this->apiUrl = $apiUrl;
58-
$this->layer = $layer;
5955
}
6056

6157
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class LambdaClientTest extends TestCase
1818
{
1919
/** @var LambdaClient */
20-
private $lambda;
20+
private LambdaClient $lambda;
2121

2222
protected function setUp(): void
2323
{

0 commit comments

Comments
 (0)