Skip to content

Commit 947e85c

Browse files
authored
Improve (#33)
1 parent e94a32b commit 947e85c

File tree

11 files changed

+33
-44
lines changed

11 files changed

+33
-44
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

behat.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,17 @@ default:
33
default:
44
contexts:
55
- Tests\Functional\BehatContext\DemoAppContext: ~
6+
coverage:
7+
extensions:
8+
LeanPHP\Behat\CodeCoverage\Extension:
9+
drivers:
10+
- local
11+
filter:
12+
whitelist:
13+
include:
14+
directories:
15+
'src': ~
16+
report:
17+
format: html
18+
options:
19+
target: build/behat-coverage

features/demo_app/src/DefaultKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class DefaultKernel extends AbstractKernel
99
{
1010
public function registerBundles()
1111
{
12+
/** @noinspection PhpIncludeInspection */
1213
$contents = require $this->getProjectDir().'/'.$this->getConfigDirectory().'/bundles.php';
1314
foreach ($contents as $class => $envs) {
1415
if (isset($envs['all']) || isset($envs[$this->environment])) {

features/demo_app/src/Method/MethodA.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodA implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

features/demo_app/src/Method/MethodB.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodB implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

features/demo_app/src/Method/MethodC.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodC implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

features/demo_app/src/Method/MethodD.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodD implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
processIsolation="false"
99

1010
stopOnRisky="true"
11-
1211
stopOnError="true"
1312
stopOnFailure="true"
1413

src/DependencyInjection/JsonRpcHttpServerExtension.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ private function compileAndProcessConfigurations(array $configs, ContainerBuilde
108108

109109
/**
110110
* @param ContainerBuilder $container
111-
*
112-
* @return Reference|null Null in case no dispatcher found
113111
*/
114112
private function bindJsonRpcServerDispatcher(ContainerBuilder $container) : void
115113
{
@@ -170,7 +168,7 @@ private function binJsonRpcMethods(ContainerBuilder $container) : void
170168

171169
/**
172170
* @param string $methodName
173-
* @param Definition $jsonRpcMethodDefinition
171+
* @param string $jsonRpcMethodServiceId
174172
* @param Definition[] $mappingAwareServiceDefinitionList
175173
*/
176174
private function bindJsonRpcMethod(
@@ -190,7 +188,6 @@ private function bindJsonRpcMethod(
190188
* @param ContainerBuilder $container
191189
*
192190
* @return array
193-
* @throws \ReflectionException
194191
*/
195192
private function findAndValidateMappingAwareDefinitionList(ContainerBuilder $container): array
196193
{

src/DependencyInjection/JsonRpcMethodDefinitionHelper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class JsonRpcMethodDefinitionHelper
1515
* @param ContainerBuilder $container
1616
*
1717
* @return array
18-
* @throws \ReflectionException
1918
*/
2019
public function findAndValidateJsonRpcMethodDefinition(ContainerBuilder $container) : array
2120
{
@@ -56,7 +55,6 @@ private function validateJsonRpcMethodTagAttributes(string $serviceId, array $ta
5655
* @param string $serviceId
5756
* @param Definition $definition
5857
*
59-
* @throws \ReflectionException
6058
* @throws \LogicException In case definition is not valid
6159
*/
6260
private function validateJsonRpcMethodDefinition(string $serviceId, Definition $definition) : void

0 commit comments

Comments
 (0)