Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 1ccf8a2

Browse files
committed
First rework
- Add php8 support - Add response validation - Upgrade dependencies - Add phpstan - Add code coverage generation
1 parent 91406f9 commit 1ccf8a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1153
-512
lines changed

.github/workflows/php.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ jobs:
3939

4040
- name: Run test suite
4141
run: composer run-script test
42+
43+
- name: Run static analysis
44+
run: composer run-script stan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
vendor
2+
build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Daniel Jakob
3+
Copyright (c) 2021 Daniel Jakob
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,17 @@
3434
"laminas/laminas-diactoros": "^2.4",
3535
"mikey179/vfsstream": "^1.6",
3636
"mockery/mockery": "^1.4",
37+
"phpstan/phpstan": "^0.12.80",
38+
"phpstan/phpstan-mockery": "^0.12.12",
39+
"phpstan/phpstan-strict-rules": "^0.12.9",
3740
"phpunit/phpunit": "^9.5"
3841
},
3942
"config": {
4043
"sort-packages": true
4144
},
4245
"scripts": {
43-
"test": "./vendor/bin/phpunit tests"
46+
"test": "./vendor/bin/phpunit tests",
47+
"stan": "./vendor/bin/phpstan analyse",
48+
"coverage": "./vendor/bin/phpunit --warm-coverage-cache tests && XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html build/coverage tests"
4449
}
4550
}

composer.lock

Lines changed: 165 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function handle(
2626
stdClass $parameter
2727
): array {
2828
return [
29-
'styles' => [
29+
'beer_style_list' => [
3030
'ipa',
3131
'lager',
3232
'porter',

example/schema/beerlist.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"type": "string"
2727
}
2828
}
29-
}
29+
},
30+
"required": ["beer_style_list"]
3031
}
3132
}
3233
}

phpstan.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
level: 8
3+
paths:
4+
- src
5+
6+
includes:
7+
- vendor/phpstan/phpstan-mockery/extension.neon
8+
- vendor/phpstan/phpstan-strict-rules/rules.neon

phpunit.xml.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
5+
backupGlobals="true"
6+
backupStaticAttributes="false"
7+
bootstrap="tests/bootstrap.php"
8+
cacheResult="true"
9+
colors="true"
10+
convertErrorsToExceptions="true"
11+
convertNoticesToExceptions="true"
12+
convertWarningsToExceptions="true"
13+
forceCoversAnnotation="false"
14+
processIsolation="false"
15+
stopOnError="false"
16+
stopOnFailure="false"
17+
stopOnIncomplete="false"
18+
stopOnSkipped="false"
19+
stopOnRisky="false">
20+
<coverage cacheDirectory="build/coverageCache">
21+
<include>
22+
<directory suffix=".php">src</directory>
23+
</include>
24+
</coverage>
25+
</phpunit>

src/Contract/ApiMethodInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
interface ApiMethodInterface
1212
{
1313
/**
14+
* @return array<mixed, mixed>
15+
*
1416
* @throws ApiMethodException
1517
*/
1618
public function handle(

0 commit comments

Comments
 (0)