Skip to content

Commit 263f7a8

Browse files
committed
Add Void return types (PHP 7.1)
https://wiki.php.net/rfc/void_return_type
1 parent 5ebc647 commit 263f7a8

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ documented in this file.
66
The format is based on [Keep a Changelog](http://keepachangelog.com/)
77
and this project adheres to [Semantic Versioning](http://semver.org/).
88

9+
## 4.x-dev
10+
11+
- PHP 7.1 specific code improvements
12+
913
## [4.2.1] - 2018-03-21
1014

1115
- Integrate fixes from 4.1.2 (`--no-coverage` option bugfix)

src/Listener/CodeCoverageListener.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public function __construct(ConsoleIO $io, CodeCoverage $coverage, array $report
4242
$this->io = $io;
4343
$this->coverage = $coverage;
4444
$this->reports = $reports;
45-
$this->options = array(
46-
'whitelist' => array('src', 'lib'),
47-
'blacklist' => array('test', 'vendor', 'spec'),
48-
'whitelist_files' => array(),
49-
'blacklist_files' => array(),
50-
'output' => array('html' => 'coverage'),
51-
'format' => array('html'),
52-
);
45+
$this->options = [
46+
'whitelist' => ['src', 'lib'],
47+
'blacklist' => ['test', 'vendor', 'spec'],
48+
'whitelist_files' => [],
49+
'blacklist_files' => [],
50+
'output' => ['html' => 'coverage'],
51+
'format' => ['html'],
52+
];
5353

5454
$this->enabled = extension_loaded('xdebug') || (PHP_SAPI === 'phpdbg');
5555
$this->skipCoverage = $skipCoverage;
@@ -61,7 +61,7 @@ public function __construct(ConsoleIO $io, CodeCoverage $coverage, array $report
6161
*
6262
* @param SuiteEvent $event
6363
*/
64-
public function beforeSuite(SuiteEvent $event)
64+
public function beforeSuite(SuiteEvent $event) : void
6565
{
6666
if (!$this->enabled || $this->skipCoverage) {
6767
return;
@@ -90,26 +90,26 @@ public function beforeSuite(SuiteEvent $event)
9090
/**
9191
* @param ExampleEvent $event
9292
*/
93-
public function beforeExample(ExampleEvent $event)
93+
public function beforeExample(ExampleEvent $event): void
9494
{
9595
if (!$this->enabled || $this->skipCoverage) {
9696
return;
9797
}
9898

9999
$example = $event->getExample();
100100

101-
$name = strtr('%spec%::%example%', array(
101+
$name = strtr('%spec%::%example%', [
102102
'%spec%' => $example->getSpecification()->getClassReflection()->getName(),
103103
'%example%' => $example->getFunctionReflection()->getName(),
104-
));
104+
]);
105105

106106
$this->coverage->start($name);
107107
}
108108

109109
/**
110110
* @param ExampleEvent $event
111111
*/
112-
public function afterExample(ExampleEvent $event)
112+
public function afterExample(ExampleEvent $event): void
113113
{
114114
if (!$this->enabled || $this->skipCoverage) {
115115
return;
@@ -121,7 +121,7 @@ public function afterExample(ExampleEvent $event)
121121
/**
122122
* @param SuiteEvent $event
123123
*/
124-
public function afterSuite(SuiteEvent $event)
124+
public function afterSuite(SuiteEvent $event): void
125125
{
126126
if (!$this->enabled || $this->skipCoverage) {
127127
if ($this->io && $this->io->isVerbose()) {
@@ -156,7 +156,7 @@ public function afterSuite(SuiteEvent $event)
156156
/**
157157
* @param array $options
158158
*/
159-
public function setOptions(array $options)
159+
public function setOptions(array $options): void
160160
{
161161
$this->options = $options + $this->options;
162162
}

0 commit comments

Comments
 (0)