Skip to content

Commit b3e4dd6

Browse files
committed
4.0 | Reports: add parameter types
1 parent 14ff869 commit b3e4dd6

20 files changed

+181
-181
lines changed

src/Reports/Cbf.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Cbf implements Report
4242
* @return bool
4343
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
4444
*/
45-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
45+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
4646
{
4747
$errors = $phpcsFile->getFixableCount();
4848
if ($errors !== 0) {
@@ -134,15 +134,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
134134
* @return void
135135
*/
136136
public function generate(
137-
$cachedData,
138-
$totalFiles,
139-
$totalErrors,
140-
$totalWarnings,
141-
$totalFixable,
142-
$showSources=false,
143-
$width=80,
144-
$interactive=false,
145-
$toScreen=true
137+
string $cachedData,
138+
int $totalFiles,
139+
int $totalErrors,
140+
int $totalWarnings,
141+
int $totalFixable,
142+
bool $showSources=false,
143+
int $width=80,
144+
bool $interactive=false,
145+
bool $toScreen=true
146146
) {
147147
$lines = explode(PHP_EOL, $cachedData);
148148
array_pop($lines);

src/Reports/Checkstyle.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Checkstyle implements Report
3232
*
3333
* @return bool
3434
*/
35-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
35+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3636
{
3737
$out = new XMLWriter;
3838
$out->openMemory();
@@ -90,15 +90,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
9090
* @return void
9191
*/
9292
public function generate(
93-
$cachedData,
94-
$totalFiles,
95-
$totalErrors,
96-
$totalWarnings,
97-
$totalFixable,
98-
$showSources=false,
99-
$width=80,
100-
$interactive=false,
101-
$toScreen=true
93+
string $cachedData,
94+
int $totalFiles,
95+
int $totalErrors,
96+
int $totalWarnings,
97+
int $totalFixable,
98+
bool $showSources=false,
99+
int $width=80,
100+
bool $interactive=false,
101+
bool $toScreen=true
102102
) {
103103
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
104104
echo '<checkstyle version="'.Config::VERSION.'">'.PHP_EOL;

src/Reports/Code.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Code implements Report
3434
*
3535
* @return bool
3636
*/
37-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
37+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3838
{
3939
if ($report['errors'] === 0 && $report['warnings'] === 0) {
4040
// Nothing to print.
@@ -335,15 +335,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
335335
* @return void
336336
*/
337337
public function generate(
338-
$cachedData,
339-
$totalFiles,
340-
$totalErrors,
341-
$totalWarnings,
342-
$totalFixable,
343-
$showSources=false,
344-
$width=80,
345-
$interactive=false,
346-
$toScreen=true
338+
string $cachedData,
339+
int $totalFiles,
340+
int $totalErrors,
341+
int $totalWarnings,
342+
int $totalFixable,
343+
bool $showSources=false,
344+
int $width=80,
345+
bool $interactive=false,
346+
bool $toScreen=true
347347
) {
348348
if ($cachedData === '') {
349349
return;

src/Reports/Csv.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Csv implements Report
3030
*
3131
* @return bool
3232
*/
33-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
33+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3434
{
3535
if ($report['errors'] === 0 && $report['warnings'] === 0) {
3636
// Nothing to print.
@@ -73,15 +73,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
7373
* @return void
7474
*/
7575
public function generate(
76-
$cachedData,
77-
$totalFiles,
78-
$totalErrors,
79-
$totalWarnings,
80-
$totalFixable,
81-
$showSources=false,
82-
$width=80,
83-
$interactive=false,
84-
$toScreen=true
76+
string $cachedData,
77+
int $totalFiles,
78+
int $totalErrors,
79+
int $totalWarnings,
80+
int $totalFixable,
81+
bool $showSources=false,
82+
int $width=80,
83+
bool $interactive=false,
84+
bool $toScreen=true
8585
) {
8686
echo 'File,Line,Column,Type,Message,Source,Severity,Fixable'.PHP_EOL;
8787
echo $cachedData;

src/Reports/Diff.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Diff implements Report
3232
*
3333
* @return bool
3434
*/
35-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
35+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3636
{
3737
$errors = $phpcsFile->getFixableCount();
3838
if ($errors === 0) {
@@ -101,15 +101,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
101101
* @return void
102102
*/
103103
public function generate(
104-
$cachedData,
105-
$totalFiles,
106-
$totalErrors,
107-
$totalWarnings,
108-
$totalFixable,
109-
$showSources=false,
110-
$width=80,
111-
$interactive=false,
112-
$toScreen=true
104+
string $cachedData,
105+
int $totalFiles,
106+
int $totalErrors,
107+
int $totalWarnings,
108+
int $totalFixable,
109+
bool $showSources=false,
110+
int $width=80,
111+
bool $interactive=false,
112+
bool $toScreen=true
113113
) {
114114
echo $cachedData;
115115
if ($toScreen === true && $cachedData !== '') {

src/Reports/Emacs.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Emacs implements Report
3030
*
3131
* @return bool
3232
*/
33-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
33+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3434
{
3535
if ($report['errors'] === 0 && $report['warnings'] === 0) {
3636
// Nothing to print.
@@ -73,15 +73,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
7373
* @return void
7474
*/
7575
public function generate(
76-
$cachedData,
77-
$totalFiles,
78-
$totalErrors,
79-
$totalWarnings,
80-
$totalFixable,
81-
$showSources=false,
82-
$width=80,
83-
$interactive=false,
84-
$toScreen=true
76+
string $cachedData,
77+
int $totalFiles,
78+
int $totalErrors,
79+
int $totalWarnings,
80+
int $totalFixable,
81+
bool $showSources=false,
82+
int $width=80,
83+
bool $interactive=false,
84+
bool $toScreen=true
8585
) {
8686
echo $cachedData;
8787

src/Reports/Full.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Full implements Report
3030
*
3131
* @return bool
3232
*/
33-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
33+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3434
{
3535
if ($report['errors'] === 0 && $report['warnings'] === 0) {
3636
// Nothing to print.
@@ -233,15 +233,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
233233
* @return void
234234
*/
235235
public function generate(
236-
$cachedData,
237-
$totalFiles,
238-
$totalErrors,
239-
$totalWarnings,
240-
$totalFixable,
241-
$showSources=false,
242-
$width=80,
243-
$interactive=false,
244-
$toScreen=true
236+
string $cachedData,
237+
int $totalFiles,
238+
int $totalErrors,
239+
int $totalWarnings,
240+
int $totalFixable,
241+
bool $showSources=false,
242+
int $width=80,
243+
bool $interactive=false,
244+
bool $toScreen=true
245245
) {
246246
if ($cachedData === '') {
247247
return;

src/Reports/Gitblame.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Gitblame extends VersionControl
3131
*
3232
* @return mixed string or false if impossible to recover.
3333
*/
34-
protected function getAuthor($line)
34+
protected function getAuthor(string $line)
3535
{
3636
$blameParts = [];
3737
$line = preg_replace('|\s+|', ' ', $line);
@@ -66,7 +66,7 @@ protected function getAuthor($line)
6666
* @return array
6767
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
6868
*/
69-
protected function getBlameContent($filename)
69+
protected function getBlameContent(string $filename)
7070
{
7171
$cwd = getcwd();
7272

src/Reports/Hgblame.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Hgblame extends VersionControl
3131
*
3232
* @return string|false String or FALSE if impossible to recover.
3333
*/
34-
protected function getAuthor($line)
34+
protected function getAuthor(string $line)
3535
{
3636
$blameParts = [];
3737
$line = preg_replace('|\s+|', ' ', $line);
@@ -67,7 +67,7 @@ protected function getAuthor($line)
6767
* @return array
6868
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
6969
*/
70-
protected function getBlameContent($filename)
70+
protected function getBlameContent(string $filename)
7171
{
7272
$cwd = getcwd();
7373

src/Reports/Info.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Info implements Report
3030
*
3131
* @return bool
3232
*/
33-
public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
33+
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
3434
{
3535
$metrics = $phpcsFile->getMetrics();
3636
foreach ($metrics as $metric => $data) {
@@ -61,15 +61,15 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
6161
* @return void
6262
*/
6363
public function generate(
64-
$cachedData,
65-
$totalFiles,
66-
$totalErrors,
67-
$totalWarnings,
68-
$totalFixable,
69-
$showSources=false,
70-
$width=80,
71-
$interactive=false,
72-
$toScreen=true
64+
string $cachedData,
65+
int $totalFiles,
66+
int $totalErrors,
67+
int $totalWarnings,
68+
int $totalFixable,
69+
bool $showSources=false,
70+
int $width=80,
71+
bool $interactive=false,
72+
bool $toScreen=true
7373
) {
7474
$lines = explode(PHP_EOL, $cachedData);
7575
array_pop($lines);

0 commit comments

Comments
 (0)