Skip to content

Commit ecbd702

Browse files
committed
Phpstan and Samples
Phpstan hasn't identified any errors in Samples in a long time. But, as it turns out, one particular error is suppressed: ``` Variable $helper might not be defined. ``` This error would be generated by almost all samples, and the errors that it suppresses will become problematic if we move to Level 10. We are not yet committed to doing that, but it is pretty easy to write a script to change the samples so that error no longer happens, and there isn't really any reason to delay doing so. The results of that script constitute this PR.
1 parent d51bf5f commit ecbd702

File tree

299 files changed

+300
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+300
-221
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ parameters:
2828
ignoreErrors:
2929
# Accept a bit anything for assert methods
3030
- '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~'
31-
- '~^Variable \$helper might not be defined\.$~'
3231
- identifier: missingType.iterableValue

samples/Autofilter/10_Autofilter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Spreadsheet;
44

55
require __DIR__ . '/../Header.php';
6+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
67

78
// Create new Spreadsheet object
89
$helper->log('Create new Spreadsheet object');

samples/Autofilter/10_Autofilter_dynamic_dates.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function createSheet(Sample $helper, Spreadsheet $spreadsheet, string $rule, boo
6767
}
6868

6969
// Create new Spreadsheet object
70+
/** @var Sample $helper */
7071
$helper->log('Create new Spreadsheet object');
7172
$spreadsheet = new Spreadsheet();
7273

samples/Autofilter/10_Autofilter_selection_1.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule;
88

99
require __DIR__ . '/../Header.php';
10+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
1011

1112
// Create new Spreadsheet object
1213
$helper->log('Create new Spreadsheet object');

samples/Autofilter/10_Autofilter_selection_2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule;
88

99
require __DIR__ . '/../Header.php';
10+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
1011

1112
// Create new Spreadsheet object
1213
$helper->log('Create new Spreadsheet object');

samples/Autofilter/10_Autofilter_selection_display.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule;
88

99
require __DIR__ . '/../Header.php';
10+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
1011

1112
// Create new Spreadsheet object
1213
$helper->log('Create new Spreadsheet object');

samples/Basic/01_Simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Spreadsheet;
44

55
require __DIR__ . '/../Header.php';
6-
6+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
77
$helper->log('Create new Spreadsheet object');
88
$spreadsheet = new Spreadsheet();
99

samples/Basic/02_Types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
99

1010
require __DIR__ . '/../Header.php';
11+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
1112

1213
// Create new Spreadsheet object
1314
$helper->log('Create new Spreadsheet object');

samples/Basic/03_Formulas.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Spreadsheet;
44

55
require __DIR__ . '/../Header.php';
6+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
67

78
// Create new Spreadsheet object
89
$helper->log('Create new Spreadsheet object');

samples/Basic/04_Printing.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
77

88
require __DIR__ . '/../Header.php';
9+
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
910

1011
// Create new Spreadsheet object
1112
$helper->log('Create new Spreadsheet object');

0 commit comments

Comments
 (0)