Skip to content

Commit 3570a99

Browse files
authored
Improve (#6)
1 parent 77ff8a1 commit 3570a99

24 files changed

+52
-102
lines changed

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ COVERAGE_OUTPUT_STYLE ?= html
66
BUILD_DIRECTORY ?= build
77
REPORTS_DIRECTORY ?= ${BUILD_DIRECTORY}/reports
88
COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/coverage
9+
BEHAT_COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/behat-coverage
910
COVERAGE_CLOVER_FILE_PATH ?= ${COVERAGE_DIRECTORY}/clover.xml
1011

1112
## Commands options
1213
### Composer
1314
#COMPOSER_OPTIONS=
1415
### Phpcs
1516
PHPCS_REPORT_STYLE ?= full
17+
PHPCS_DISABLE_WARNING ?= "false"
1618
#PHPCS_REPORT_FILE=
1719
#PHPCS_REPORT_FILE_OPTION=
1820

@@ -51,6 +53,12 @@ ifneq ("${PHPCS_REPORT_FILE}","")
5153
PHPCS_REPORT_FILE_OPTION ?= --report-file=${PHPCS_REPORT_FILE}
5254
endif
5355

56+
ifneq ("${PHPCS_DISABLE_WARNING}","true")
57+
PHPCS_DISABLE_WARNING_OPTION=
58+
else
59+
PHPCS_DISABLE_WARNING_OPTION=-n
60+
endif
61+
5462

5563
## Project build (install and configure)
5664
build: install configure
@@ -76,20 +84,26 @@ test-functional:
7684
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets
7785

7886
codestyle: create-reports-directory
79-
./vendor/bin/phpcs --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
87+
./vendor/bin/phpcs ${PHPCS_DISABLE_WARNING_OPTION} --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
8088

8189
coverage: create-coverage-directory
8290
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} ${PHPUNIT_COVERAGE_OPTION}
8391

92+
behat-coverage: create-behat-coverage-directory
93+
composer required leanphp/behat-code-coverage
94+
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets --profile coverage
8495

8596

8697
# Internal commands
8798
create-coverage-directory:
8899
mkdir -p ${COVERAGE_DIRECTORY}
89100

101+
create-behat-coverage-directory:
102+
mkdir -p ${BEHAT_COVERAGE_DIRECTORY}
103+
90104
create-reports-directory:
91105
mkdir -p ${REPORTS_DIRECTORY}
92106

93107

94-
.PHONY: build install configure test test-technical test-functional codestyle coverage create-coverage-directory create-reports-directory
108+
.PHONY: build install configure test test-technical test-functional codestyle coverage behat-coverage create-coverage-directory create-behat-coverage-directory create-reports-directory
95109
.DEFAULT: build

README.md

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

44
[![Scrutinizer Build Status](https://img.shields.io/scrutinizer/build/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk.svg?label=Scrutinizer&logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/build-status/master) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/master.svg?logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/?branch=master) [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/master.svg?logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/?branch=master)
55

6-
[![Travis Build Status](https://img.shields.io/travis/com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/master.svg?label=Travis&logo=travis)](https://travis-ci.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk) [![Travis PHP versions](https://img.shields.io/travis/php-v/yoanm/php-jsonrpc-http-server-openapi-doc-sdk.svg?logo=travis)](https://php.net/)
6+
[![Travis Build Status](https://img.shields.io/travis/com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/master.svg?label=Travis&logo=travis)](https://travis-ci.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk) [![Travis PHP versions](https://img.shields.io/travis/php-v/yoanm/php-jsonrpc-http-server-openapi-doc-sdk.svg?logo=travis)](https://php.net/) [![Travis Symfony Versions](https://img.shields.io/badge/Symfony-v3%20%2F%20v4-8892BF.svg?logo=travis)](https://symfony.com/)
77

88
[![Latest Stable Version](https://img.shields.io/packagist/v/yoanm/jsonrpc-http-server-openapi-doc-sdk.svg)](https://packagist.org/packages/yoanm/jsonrpc-http-server-openapi-doc-sdk) [![Packagist PHP version](https://img.shields.io/packagist/php-v/yoanm/jsonrpc-http-server-openapi-doc-sdk.svg)](https://packagist.org/packages/yoanm/jsonrpc-http-server-openapi-doc-sdk)
99

behat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ default:
22
suites:
33
default:
44
contexts:
5-
- Tests\Functional\BehatContext\DocNormalizerContext: ~
5+
- Tests\Functional\BehatContext\DocNormalizerContext: ~

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"yoanm/jsonrpc-server-doc-sdk": "dev-release/1.0.0"
3030
},
3131
"require-dev": {
32+
"ext-json": "*",
3233
"behat/behat": "~3.0",
3334
"squizlabs/php_codesniffer": "3.*",
3435
"phpunit/phpunit": "^6.0 || ^7.0",

features/bootstrap/AbstractContext.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ protected function jsonDecode($encodedData)
2222
/**
2323
* @param object $object
2424
* @param array $decodedMethodCalls
25-
*
26-
* @return mixed
2725
*/
2826
protected function callMethods($object, array $decodedMethodCalls)
2927
{

src/App/Normalizer/Component/ErrorDocNormalizer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function __construct(
2727

2828
/**
2929
* {@inheritdoc}
30+
*
31+
* @throws \ReflectionException
3032
*/
3133
public function normalize(ErrorDoc $errorDoc)
3234
{

src/App/Normalizer/Component/ExternalSchemaListDocNormalizer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ public function __construct(
3434

3535
/**
3636
* @param ServerDoc $doc
37+
*
3738
* @return array
39+
*
40+
* @throws \ReflectionException
3841
*/
3942
public function normalize(ServerDoc $doc)
4043
{
@@ -49,6 +52,8 @@ public function normalize(ServerDoc $doc)
4952
* @param ServerDoc $doc
5053
*
5154
* @return array
55+
*
56+
* @throws \ReflectionException
5257
*/
5358
protected function getMethodsExternalSchemaList(ServerDoc $doc)
5459
{
@@ -65,6 +70,8 @@ protected function getMethodsExternalSchemaList(ServerDoc $doc)
6570
* @param ServerDoc $doc
6671
*
6772
* @return array
73+
*
74+
* @throws \ReflectionException
6875
*/
6976
protected function getMethodErrorsExternalSchemaList(ServerDoc $doc)
7077
{
@@ -84,7 +91,11 @@ protected function getMethodErrorsExternalSchemaList(ServerDoc $doc)
8491

8592

8693
/**
94+
* @param ServerDoc $doc
95+
*
8796
* @return array
97+
*
98+
* @throws \ReflectionException
8899
*/
89100
protected function getServerErrorsExtraSchemaList(ServerDoc $doc)
90101
{
@@ -112,6 +123,8 @@ protected function getServerErrorsExtraSchemaList(ServerDoc $doc)
112123
* @param MethodDoc $method
113124
*
114125
* @return array[]
126+
*
127+
* @throws \ReflectionException
115128
*/
116129
protected function getMethodExternalSchemaList(MethodDoc $method) : array
117130
{

src/App/Normalizer/Component/SchemaTypeNormalizer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class SchemaTypeNormalizer
1212
* @param TypeDoc $doc
1313
*
1414
* @return mixed|string
15+
*
16+
* @throws \ReflectionException
1517
*/
1618
public function normalize(TypeDoc $doc)
1719
{

src/App/Normalizer/Component/TypeDocNormalizer.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ public function __construct(SchemaTypeNormalizer $schemaTypeNormalizer)
2626
{
2727
$this->schemaTypeNormalizer = $schemaTypeNormalizer;
2828
}
29+
2930
/**
3031
* @param TypeDoc $doc
3132
*
32-
* @return array
33+
* @return array|mixed
34+
*
35+
* @throws \ReflectionException
3336
*/
3437
public function normalize(TypeDoc $doc)
3538
{
@@ -58,8 +61,8 @@ public function normalize(TypeDoc $doc)
5861

5962
/**
6063
* @param TypeDoc $doc
61-
* @param $paramDocMinMax
62-
* @return mixed
64+
*
65+
* @return array
6366
*/
6467
protected function getMinMaxDoc(TypeDoc $doc)
6568
{
@@ -87,6 +90,8 @@ protected function getMinMaxDoc(TypeDoc $doc)
8790
* @param array $siblingsDoc
8891
*
8992
* @return array
93+
*
94+
* @throws \ReflectionException
9095
*/
9196
protected function appendArrayDoc(TypeDoc $doc, array $siblingsDoc)
9297
{

src/App/Resolver/DefinitionRefResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ public function getErrorDefinitionId(ErrorDoc $error, $definitionType)
5757
}
5858

5959
/**
60-
* @param ErrorDoc $errorDoc
60+
* @param string $path
61+
*
6162
* @return string
6263
*/
63-
public function getDefinitionRef($path)
64+
public function getDefinitionRef(string $path)
6465
{
6566
return sprintf('#/components/schemas/%s', $path);
6667
}

0 commit comments

Comments
 (0)