Skip to content

Commit d50f119

Browse files
authored
Merge pull request #14 from TomHAnderson/feature/2.0
Feature/2.0
2 parents c5079b4 + 3f58e83 commit d50f119

File tree

9 files changed

+32
-37
lines changed

9 files changed

+32
-37
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
name: "Coding Standards"
1616
uses: "doctrine/.github/.github/workflows/[email protected]"
1717
with:
18-
php-version: '8.0'
18+
php-version: '8.1'
1919
composer-options: '--prefer-dist --ignore-platform-req=php'
2020

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
php-version:
22-
- "8.0"
2322
- "8.1"
23+
- "8.2"
24+
- "8.3"
2425
dependencies:
2526
- "highest"
2627
optional-dependencies:
2728
- true
2829
- false
2930
include:
30-
- php-version: "8.0"
31+
- php-version: "8.1"
3132
dependencies: "lowest"
3233
optional-dependencies: false
33-
- php-version: "8.0"
34+
- php-version: "8.1"
3435
dependencies: "lowest"
3536
optional-dependencies: true
3637

.github/workflows/php.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,3 @@ jobs:
2828
2929
- name: Install dependencies
3030
run: composer install --prefer-dist --no-progress
31-
32-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
33-
# Docs: https://getcomposer.org/doc/articles/scripts.md
34-
35-
# - name: Run test suite
36-
# run: composer run-script test

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
2020
with:
21-
php-version: '8.0'
21+
php-version: '8.1'
2222
- uses: actions/checkout@v2
2323
- name: Install Dependencies
2424
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

composer.json

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^8.0",
24-
"laravel-doctrine/orm": "^1.6",
23+
"php": "^8.1",
24+
"laravel-doctrine/orm": "^2.0",
2525
"api-skeletons/laravel-api-problem": "^1.0.1"
2626
},
2727
"require-dev": {
28-
"doctrine/coding-standard": "^9.0",
29-
"doctrine/dbal": "^3.1.1",
30-
"doctrine/annotations": "^1.13.2",
31-
"orchestra/testbench": "^6.23",
28+
"doctrine/coding-standard": "^12.0",
29+
"doctrine/dbal": "^3.8",
30+
"doctrine/annotations": "^2.0",
3231
"phpunit/phpunit": "^9.5",
33-
"vimeo/psalm": "^4.15"
32+
"vimeo/psalm": "^4.15",
33+
"orchestra/testbench": "^7.41",
34+
"php-parallel-lint/php-parallel-lint": "^1.4"
3435
},
3536
"extra": {
3637
"laravel": {
@@ -40,6 +41,16 @@
4041
}
4142
},
4243
"scripts": {
43-
"test": "vendor/bin/phpcs && vendor/bin/phpunit && vendor/bin/psalm"
44+
"test": [
45+
"parallel-lint src/ test/",
46+
"vendor/bin/phpcs",
47+
"vendor/bin/psalm",
48+
"vendor/bin/phpunit"
49+
]
50+
},
51+
"config": {
52+
"allow-plugins": {
53+
"dealerdirect/phpcodesniffer-composer-installer": true
54+
}
4455
}
4556
}

src/Console/Command/Command.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,17 @@
1414

1515
abstract class Command extends IlluminateCommand
1616
{
17-
protected ApiKeyService $apiKeyService;
18-
1917
/**
2018
* Create a new command instance.
2119
*
2220
* @return void
2321
*/
24-
public function __construct(ApiKeyService $apiKeyService)
22+
public function __construct(protected ApiKeyService $apiKeyService)
2523
{
2624
parent::__construct();
27-
28-
$this->apiKeyService = $apiKeyService;
2925
}
3026

31-
/**
32-
* @param ApiKey[] $apiKeys
33-
*/
27+
/** @param ApiKey[] $apiKeys */
3428
protected function printApiKeys(array $apiKeys): void
3529
{
3630
$headers = ['name', 'api_key', 'status', 'scopes'];
@@ -53,9 +47,7 @@ protected function printApiKeys(array $apiKeys): void
5347
$this->table($headers, $rows);
5448
}
5549

56-
/**
57-
* @param Scope[] $scopes
58-
*/
50+
/** @param Scope[] $scopes */
5951
protected function printScopes(array $scopes): void
6052
{
6153
$headers = ['name', 'apikey count'];

src/Http/Middleware/AuthorizeApiKey.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313

1414
class AuthorizeApiKey
1515
{
16-
private ApiKeyService $apiKeyService;
17-
18-
public function __construct(ApiKeyService $apiKeyService)
16+
public function __construct(private ApiKeyService $apiKeyService)
1917
{
20-
$this->apiKeyService = $apiKeyService;
2118
}
2219

2320
/**
2421
* Handle request
2522
*/
26-
public function handle(Request $request, Closure $next, ?string $scope = null): mixed
23+
public function handle(Request $request, Closure $next, string|null $scope = null): mixed
2724
{
2825
$header = $request->header('Authorization');
2926
if (! $header) {

src/Repository/ApiKeyRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function removeScope(ApiKey $apiKey, Scope $scope): ApiKey
133133

134134
if (! $found) {
135135
throw new ApiKeyDoesNotHaveScope(
136-
'The requested Scope to remove does not exist on the ApiKey'
136+
'The requested Scope to remove does not exist on the ApiKey',
137137
);
138138
}
139139

src/Service/ApiKeyService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class ApiKeyService
1616
{
17-
private ?EntityManager $entityManager = null;
17+
private EntityManager|null $entityManager = null;
1818

1919
public function getEntityManager(): EntityManager
2020
{

0 commit comments

Comments
 (0)