Skip to content

Commit f8afe32

Browse files
authored
Merge pull request #31 from leanphp/code-style-guide
Code style guide
2 parents 98b5ee0 + 76e7f43 commit f8afe32

26 files changed

+113
-42
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ install:
7777

7878
test_script:
7979
- cd c:\projects\behat-code-coverage
80+
- bin\phpcs
8081
- phpdbg -qrr vendor\phpunit\phpunit\phpunit -vvv
8182

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ before_script:
1616
- composer validate
1717
- if [[ $deps = low ]]; then composer update --prefer-lowest --prefer-stable; else composer update; fi
1818

19-
script: ./bin/phpunit -vvv
19+
script:
20+
- ./bin/phpcs
21+
- ./bin/phpunit -vvv
2022

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1919
- Version constraints in composer.json have been updated from `~` to `^`.
2020

2121

22+
## [3.2.1] - 2018-03-19
23+
24+
- Fix Text report generation #5
25+
2226
## [3.2.0] - 2017-10-17 - Guzzle 6.0 support release
2327

2428
- Updated `guzzlehttp/guzzle` requirement from `~4.0||~5.0` to `~6.0`. We are

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
},
3838
"require-dev": {
3939
"phpunit/phpunit": "^6.0",
40-
"mikey179/vfsStream": "1.6.*"
40+
"mikey179/vfsStream": "1.6.*",
41+
"squizlabs/php_codesniffer": "^3.2",
42+
"escapestudios/symfony2-coding-standard": "^3.1"
4143
},
4244
"suggest": {
4345
"ext-xdebug": "Xdebug extension is required to collect coverage via Xdebug driver and run tests",

phpcs.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<!-- leanphp/common-dev phpcs.xml example config -->
3+
<ruleset name="LeanPHP Coding Standard">
4+
<description>LeanPHP Coding Standard</description>
5+
6+
<!-- directories and files to scan -->
7+
<file>src</file>
8+
9+
<!-- directories and files to exclude -->
10+
<exclude-pattern>test</exclude-pattern>
11+
<exclude-pattern>tests</exclude-pattern>
12+
<exclude-pattern>*Spec.php</exclude-pattern>
13+
14+
<!-- uncomment for a summary instead of detailed report -->
15+
<!--<arg name="report" value="summary"/>-->
16+
<arg value="p"/>>
17+
18+
<!-- Use Symfony2 Coding Standard -->
19+
<rule ref="vendor/escapestudios/symfony2-coding-standard/Symfony"/>
20+
</ruleset>

src/Common/Driver/Factory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Code Coverage Driver Factory
44
*
55
* @copyright 2013 Anthon Pang
6+
*
67
* @license BSD-3-Clause
78
*/
89

src/Common/Driver/HHVM.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* HHVM Code Coverage Driver
44
*
55
* @copyright 2013 Anthon Pang
6+
*
67
* @license BSD-3-Clause
78
*/
89

@@ -27,7 +28,7 @@ class HHVM implements DriverInterface
2728
*/
2829
public function __construct()
2930
{
30-
if ( ! defined('HPHP_VERSION')) {
31+
if (! defined('HPHP_VERSION')) {
3132
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires HHVM');
3233
}
3334
}

src/Common/Driver/Stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Code Coverage Stub Driver
44
*
55
* @copyright 2013 Anthon Pang
6+
*
67
* @license BSD-3-Clause
78
*/
89

src/Common/Driver/XCache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* XCache Code Coverage Driver
44
*
55
* @copyright 2013 Anthon Pang
6+
*
67
* @license BSD-3-Clause
78
*/
89

@@ -26,7 +27,7 @@ class XCache implements DriverInterface
2627
*/
2728
public function __construct()
2829
{
29-
if ( ! extension_loaded('xcache')) {
30+
if (! extension_loaded('xcache')) {
3031
throw new \SebastianBergmann\CodeCoverage\RuntimeException('This driver requires XCache');
3132
}
3233

src/Common/Model/Aggregate.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Aggregate
44
*
55
* @copyright 2013 Anthon Pang
6+
*
67
* @license BSD-3-Clause
78
*/
89

@@ -36,14 +37,14 @@ public function __construct()
3637
*/
3738
public function update($class, array $counts)
3839
{
39-
if ( ! isset($this->coverage[$class])) {
40+
if (! isset($this->coverage[$class])) {
4041
$this->coverage[$class] = $counts;
4142

4243
return;
4344
}
4445

4546
foreach ($counts as $line => $status) {
46-
if ( ! isset($this->coverage[$class][$line]) || $status > 0) {
47+
if (! isset($this->coverage[$class][$line]) || $status > 0) {
4748
// converts "hits" to "status"
4849
$status = ! $status ? -1 : ($status > 1 ? 1 : $status);
4950

0 commit comments

Comments
 (0)