Skip to content

Commit 1b6044c

Browse files
authored
Merge pull request #10 from drupol/use-php-conventions
Use drupol/php-conventions for code-style and standards.
2 parents 373f877 + 6c7cf7d commit 1b6044c

10 files changed

+325
-280
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
.editorconfig export-ignore
55
.gitattributes export-ignore
66
.gitignore export-ignore
7+
.scrutinizer export-ignore
78
.travis.yml export-ignore
89
CHANGELOG.md export-ignore
10+
grumphp.yml.dist export-ignore
911
LICENSE export-ignore
1012
phpspec.yml export-ignore
1113
README.md export-ignore

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ before_script:
2929
script:
3030
- composer validate
3131
- composer update
32-
# - bin/phpcs
33-
- vendor/bin/phpspec run --no-code-generation
32+
- composer grumphp
3433

3534
install:
3635
- travis_retry composer install

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"phpunit/php-code-coverage": "^5.0 || ^6.0 || ^7.0"
4444
},
4545
"require-dev": {
46-
"squizlabs/php_codesniffer": "^3.2",
46+
"drupol/php-conventions": "^1",
4747
"scrutinizer/ocular": "^1"
4848
},
4949
"suggest": {
@@ -62,6 +62,7 @@
6262
},
6363
"minimum-stability": "stable",
6464
"scripts": {
65+
"grumphp": "./vendor/bin/grumphp run",
6566
"scrutinizer": "./vendor/bin/ocular code-coverage:upload --format=php-clover build/coverage.xml"
6667
},
6768
"support": {

grumphp.yml.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
imports:
2+
- { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }
3+
4+
parameters:
5+
extra_tasks:
6+
phpspec:
7+
verbose: true
8+
metadata:
9+
priority: 3000

spec/CodeCoverageExtensionSpec.php

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace spec\LeanPHP\PhpSpec\CodeCoverage;
46

7+
use LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension;
58
use PhpSpec\ObjectBehavior;
69
use PhpSpec\ServiceContainer\IndexedServiceContainer;
7-
use Prophecy\Argument;
8-
use LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension;
910

1011
/**
1112
* @author Henrik Bjornskov
1213
*/
1314
class CodeCoverageExtensionSpec extends ObjectBehavior
1415
{
15-
function it_is_initializable()
16+
public function it_is_initializable(): void
1617
{
1718
$this->shouldHaveType(CodeCoverageExtension::class);
1819
}
1920

20-
function it_should_use_html_format_by_default()
21+
public function it_should_transform_format_into_array(): void
2122
{
22-
$container = new IndexedServiceContainer;
23-
$this->load($container, []);
23+
$container = new IndexedServiceContainer();
24+
$container->setParam('code_coverage', ['format' => 'html']);
25+
$this->load($container);
2426

2527
$options = $container->get('code_coverage.options');
28+
2629
if ($options['format'] !== ['html']) {
27-
throw new Exception("Default format is not html");
30+
throw new Exception('Default format is not transformed to an array');
2831
}
2932
}
3033

31-
function it_should_transform_format_into_array()
34+
public function it_should_use_html_format_by_default(): void
3235
{
33-
$container = new IndexedServiceContainer;
34-
$container->setParam('code_coverage', array('format' => 'html'));
35-
$this->load($container);
36+
$container = new IndexedServiceContainer();
37+
$this->load($container, []);
3638

3739
$options = $container->get('code_coverage.options');
40+
3841
if ($options['format'] !== ['html']) {
39-
throw new Exception("Default format is not transformed to an array");
42+
throw new Exception('Default format is not html');
4043
}
41-
4244
}
4345

44-
function it_should_use_singular_output()
46+
public function it_should_use_singular_output(): void
4547
{
46-
$container = new IndexedServiceContainer;
47-
$container->setParam('code_coverage', array('output' => 'test', 'format' => 'foo'));
48+
$container = new IndexedServiceContainer();
49+
$container->setParam('code_coverage', ['output' => 'test', 'format' => 'foo']);
4850
$this->load($container);
4951

5052
$options = $container->get('code_coverage.options');
51-
if ($options['output'] !== ['foo' => 'test']) {
52-
throw new Exception("Default format is not singular output");
53+
54+
if (['foo' => 'test'] !== $options['output']) {
55+
throw new Exception('Default format is not singular output');
5356
}
5457
}
5558
}

spec/Exception/NoCoverageDriverAvailableExceptionSpec.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace spec\LeanPHP\PhpSpec\CodeCoverage\Exception;
46

5-
use PhpSpec\ObjectBehavior;
67
use LeanPHP\PhpSpec\CodeCoverage\Exception\NoCoverageDriverAvailableException;
8+
use PhpSpec\ObjectBehavior;
79

810
/**
911
* @author Stéphane Hulard
1012
*/
1113
class NoCoverageDriverAvailableExceptionSpec extends ObjectBehavior
1214
{
13-
function it_is_initializable()
15+
public function it_is_initializable(): void
1416
{
1517
$this->shouldBeAnInstanceOf(\RuntimeException::class);
1618
$this->shouldHaveType(NoCoverageDriverAvailableException::class);

0 commit comments

Comments
 (0)