@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @throws Exception |
582 | 582 | * |
583 | - * @return false|Chart |
|
583 | + * @return Chart |
|
584 | 584 | */ |
585 | 585 | public function getChartByIndex($index) |
586 | 586 | { |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | * @param string $column Return the highest data row for the specified column, |
1092 | 1092 | * or the highest data row of any column if no column letter is passed |
1093 | 1093 | * |
1094 | - * @return string Highest row number that contains data |
|
1094 | + * @return integer Highest row number that contains data |
|
1095 | 1095 | */ |
1096 | 1096 | public function getHighestDataRow($column = null) |
1097 | 1097 | { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * Set a cell value. |
1144 | 1144 | * |
1145 | 1145 | * @param string $pCoordinate Coordinate of the cell, eg: 'A1' |
1146 | - * @param mixed $pValue Value of the cell |
|
1146 | + * @param string $pValue Value of the cell |
|
1147 | 1147 | * @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* |
1148 | 1148 | * |
1149 | 1149 | * @return Worksheet |
@@ -1163,7 +1163,6 @@ discard block |
||
1163 | 1163 | * @param int $pRow Numeric row coordinate of the cell |
1164 | 1164 | * @param mixed $pValue Value of the cell |
1165 | 1165 | * @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* |
1166 | - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) |
|
1167 | 1166 | * |
1168 | 1167 | * @return Worksheet |
1169 | 1168 | */ |
@@ -1349,7 +1348,7 @@ discard block |
||
1349 | 1348 | * Get row dimension at a specific row. |
1350 | 1349 | * |
1351 | 1350 | * @param int $pRow Numeric index of the row |
1352 | - * @param mixed $create |
|
1351 | + * @param boolean $create |
|
1353 | 1352 | * |
1354 | 1353 | * @return Worksheet\RowDimension |
1355 | 1354 | */ |
@@ -1375,7 +1374,7 @@ discard block |
||
1375 | 1374 | * Get column dimension at a specific column. |
1376 | 1375 | * |
1377 | 1376 | * @param string $pColumn String index of the column eg: 'A' |
1378 | - * @param mixed $create |
|
1377 | + * @param boolean $create |
|
1379 | 1378 | * |
1380 | 1379 | * @return Worksheet\ColumnDimension |
1381 | 1380 | */ |
@@ -1921,7 +1920,7 @@ discard block |
||
1921 | 1920 | /** |
1922 | 1921 | * Set AutoFilter. |
1923 | 1922 | * |
1924 | - * @param Worksheet\AutoFilter|string $pValue |
|
1923 | + * @param string $pValue |
|
1925 | 1924 | * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility |
1926 | 1925 | * |
1927 | 1926 | * @throws Exception |
@@ -2985,7 +2984,7 @@ discard block |
||
2985 | 2984 | * |
2986 | 2985 | * @throws Exception |
2987 | 2986 | * |
2988 | - * @return objWorksheet |
|
2987 | + * @return Worksheet |
|
2989 | 2988 | */ |
2990 | 2989 | public function setCodeName($pValue, $validate = true) |
2991 | 2990 | { |
@@ -8,111 +8,111 @@ |
||
8 | 8 | |
9 | 9 | class WorksheetTest extends PHPUnit_Framework_TestCase |
10 | 10 | { |
11 | - public function testSetTitle() |
|
12 | - { |
|
13 | - $test_title = str_repeat('a', 31); |
|
14 | - |
|
15 | - $worksheet = new Worksheet(); |
|
16 | - $worksheet->setTitle($test_title); |
|
17 | - $this->assertSame($test_title, $worksheet->getTitle()); |
|
18 | - } |
|
19 | - |
|
20 | - public function setTitleInvalidProvider() |
|
21 | - { |
|
22 | - return [ |
|
23 | - [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet title.'], |
|
24 | - ['invalid*title', 'Invalid character found in sheet title'], |
|
25 | - ]; |
|
26 | - } |
|
27 | - |
|
28 | - /** @dataProvider setTitleInvalidProvider */ |
|
29 | - public function testSetTitleInvalid($title, $expect_message) |
|
30 | - { |
|
31 | - // First, test setting title with validation disabled -- should be successful |
|
32 | - $worksheet = new Worksheet(); |
|
33 | - $worksheet->setTitle($title, true, false); |
|
34 | - |
|
35 | - // Next, test again with validation enabled -- this time we should fail |
|
36 | - $worksheet = new Worksheet(); |
|
37 | - $this->expectException(\Exception::class); |
|
38 | - $this->expectExceptionMessage($expect_message); |
|
39 | - $worksheet->setTitle($title); |
|
40 | - } |
|
41 | - |
|
42 | - public function testSetTitleDuplicate() |
|
43 | - { |
|
44 | - // Create a Spreadsheet with three Worksheets (the first is created automatically) |
|
45 | - $spreadsheet = new Spreadsheet(); |
|
46 | - $spreadsheet->createSheet(); |
|
47 | - $spreadsheet->createSheet(); |
|
48 | - |
|
49 | - // Set unique title -- should be unchanged |
|
50 | - $sheet = $spreadsheet->getSheet(0); |
|
51 | - $sheet->setTitle('Test Title'); |
|
52 | - $this->assertSame('Test Title', $sheet->getTitle()); |
|
53 | - |
|
54 | - // Set duplicate title -- should have numeric suffix appended |
|
55 | - $sheet = $spreadsheet->getSheet(1); |
|
56 | - $sheet->setTitle('Test Title'); |
|
57 | - $this->assertSame('Test Title 1', $sheet->getTitle()); |
|
58 | - |
|
59 | - // Set duplicate title with validation disabled -- should be unchanged |
|
60 | - $sheet = $spreadsheet->getSheet(2); |
|
61 | - $sheet->setTitle('Test Title', true, false); |
|
62 | - $this->assertSame('Test Title', $sheet->getTitle()); |
|
63 | - } |
|
64 | - |
|
65 | - public function testSetCodeName() |
|
66 | - { |
|
67 | - $test_code_name = str_repeat('a', 31); |
|
68 | - |
|
69 | - $worksheet = new Worksheet(); |
|
70 | - $worksheet->setCodeName($test_code_name); |
|
71 | - $this->assertSame($test_code_name, $worksheet->getCodeName()); |
|
72 | - } |
|
73 | - |
|
74 | - public function setCodeNameInvalidProvider() |
|
75 | - { |
|
76 | - return [ |
|
77 | - [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet code name.'], |
|
78 | - ['invalid*code*name', 'Invalid character found in sheet code name'], |
|
79 | - ]; |
|
80 | - } |
|
81 | - |
|
82 | - /** @dataProvider setCodeNameInvalidProvider */ |
|
83 | - public function testSetCodeNameInvalid($code_name, $expect_message) |
|
84 | - { |
|
85 | - // First, test setting code name with validation disabled -- should be successful |
|
86 | - $worksheet = new Worksheet(); |
|
87 | - $worksheet->setCodeName($code_name, false); |
|
88 | - |
|
89 | - // Next, test again with validation enabled -- this time we should fail |
|
90 | - $worksheet = new Worksheet(); |
|
91 | - $this->expectException(\Exception::class); |
|
92 | - $this->expectExceptionMessage($expect_message); |
|
93 | - $worksheet->setCodeName($code_name); |
|
94 | - } |
|
95 | - |
|
96 | - public function testSetCodeNameDuplicate() |
|
97 | - { |
|
98 | - // Create a Spreadsheet with three Worksheets (the first is created automatically) |
|
99 | - $spreadsheet = new Spreadsheet(); |
|
100 | - $spreadsheet->createSheet(); |
|
101 | - $spreadsheet->createSheet(); |
|
102 | - |
|
103 | - // Set unique code name -- should be massaged to Snake_Case |
|
104 | - $sheet = $spreadsheet->getSheet(0); |
|
105 | - $sheet->setCodeName('Test Code Name'); |
|
106 | - $this->assertSame('Test_Code_Name', $sheet->getCodeName()); |
|
107 | - |
|
108 | - // Set duplicate code name -- should be massaged and have numeric suffix appended |
|
109 | - $sheet = $spreadsheet->getSheet(1); |
|
110 | - $sheet->setCodeName('Test Code Name'); |
|
111 | - $this->assertSame('Test_Code_Name_1', $sheet->getCodeName()); |
|
112 | - |
|
113 | - // Set duplicate code name with validation disabled -- should be unchanged, and unmassaged |
|
114 | - $sheet = $spreadsheet->getSheet(2); |
|
115 | - $sheet->setCodeName('Test Code Name', false); |
|
116 | - $this->assertSame('Test Code Name', $sheet->getCodeName()); |
|
117 | - } |
|
11 | + public function testSetTitle() |
|
12 | + { |
|
13 | + $test_title = str_repeat('a', 31); |
|
14 | + |
|
15 | + $worksheet = new Worksheet(); |
|
16 | + $worksheet->setTitle($test_title); |
|
17 | + $this->assertSame($test_title, $worksheet->getTitle()); |
|
18 | + } |
|
19 | + |
|
20 | + public function setTitleInvalidProvider() |
|
21 | + { |
|
22 | + return [ |
|
23 | + [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet title.'], |
|
24 | + ['invalid*title', 'Invalid character found in sheet title'], |
|
25 | + ]; |
|
26 | + } |
|
27 | + |
|
28 | + /** @dataProvider setTitleInvalidProvider */ |
|
29 | + public function testSetTitleInvalid($title, $expect_message) |
|
30 | + { |
|
31 | + // First, test setting title with validation disabled -- should be successful |
|
32 | + $worksheet = new Worksheet(); |
|
33 | + $worksheet->setTitle($title, true, false); |
|
34 | + |
|
35 | + // Next, test again with validation enabled -- this time we should fail |
|
36 | + $worksheet = new Worksheet(); |
|
37 | + $this->expectException(\Exception::class); |
|
38 | + $this->expectExceptionMessage($expect_message); |
|
39 | + $worksheet->setTitle($title); |
|
40 | + } |
|
41 | + |
|
42 | + public function testSetTitleDuplicate() |
|
43 | + { |
|
44 | + // Create a Spreadsheet with three Worksheets (the first is created automatically) |
|
45 | + $spreadsheet = new Spreadsheet(); |
|
46 | + $spreadsheet->createSheet(); |
|
47 | + $spreadsheet->createSheet(); |
|
48 | + |
|
49 | + // Set unique title -- should be unchanged |
|
50 | + $sheet = $spreadsheet->getSheet(0); |
|
51 | + $sheet->setTitle('Test Title'); |
|
52 | + $this->assertSame('Test Title', $sheet->getTitle()); |
|
53 | + |
|
54 | + // Set duplicate title -- should have numeric suffix appended |
|
55 | + $sheet = $spreadsheet->getSheet(1); |
|
56 | + $sheet->setTitle('Test Title'); |
|
57 | + $this->assertSame('Test Title 1', $sheet->getTitle()); |
|
58 | + |
|
59 | + // Set duplicate title with validation disabled -- should be unchanged |
|
60 | + $sheet = $spreadsheet->getSheet(2); |
|
61 | + $sheet->setTitle('Test Title', true, false); |
|
62 | + $this->assertSame('Test Title', $sheet->getTitle()); |
|
63 | + } |
|
64 | + |
|
65 | + public function testSetCodeName() |
|
66 | + { |
|
67 | + $test_code_name = str_repeat('a', 31); |
|
68 | + |
|
69 | + $worksheet = new Worksheet(); |
|
70 | + $worksheet->setCodeName($test_code_name); |
|
71 | + $this->assertSame($test_code_name, $worksheet->getCodeName()); |
|
72 | + } |
|
73 | + |
|
74 | + public function setCodeNameInvalidProvider() |
|
75 | + { |
|
76 | + return [ |
|
77 | + [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet code name.'], |
|
78 | + ['invalid*code*name', 'Invalid character found in sheet code name'], |
|
79 | + ]; |
|
80 | + } |
|
81 | + |
|
82 | + /** @dataProvider setCodeNameInvalidProvider */ |
|
83 | + public function testSetCodeNameInvalid($code_name, $expect_message) |
|
84 | + { |
|
85 | + // First, test setting code name with validation disabled -- should be successful |
|
86 | + $worksheet = new Worksheet(); |
|
87 | + $worksheet->setCodeName($code_name, false); |
|
88 | + |
|
89 | + // Next, test again with validation enabled -- this time we should fail |
|
90 | + $worksheet = new Worksheet(); |
|
91 | + $this->expectException(\Exception::class); |
|
92 | + $this->expectExceptionMessage($expect_message); |
|
93 | + $worksheet->setCodeName($code_name); |
|
94 | + } |
|
95 | + |
|
96 | + public function testSetCodeNameDuplicate() |
|
97 | + { |
|
98 | + // Create a Spreadsheet with three Worksheets (the first is created automatically) |
|
99 | + $spreadsheet = new Spreadsheet(); |
|
100 | + $spreadsheet->createSheet(); |
|
101 | + $spreadsheet->createSheet(); |
|
102 | + |
|
103 | + // Set unique code name -- should be massaged to Snake_Case |
|
104 | + $sheet = $spreadsheet->getSheet(0); |
|
105 | + $sheet->setCodeName('Test Code Name'); |
|
106 | + $this->assertSame('Test_Code_Name', $sheet->getCodeName()); |
|
107 | + |
|
108 | + // Set duplicate code name -- should be massaged and have numeric suffix appended |
|
109 | + $sheet = $spreadsheet->getSheet(1); |
|
110 | + $sheet->setCodeName('Test Code Name'); |
|
111 | + $this->assertSame('Test_Code_Name_1', $sheet->getCodeName()); |
|
112 | + |
|
113 | + // Set duplicate code name with validation disabled -- should be unchanged, and unmassaged |
|
114 | + $sheet = $spreadsheet->getSheet(2); |
|
115 | + $sheet->setCodeName('Test Code Name', false); |
|
116 | + $this->assertSame('Test Code Name', $sheet->getCodeName()); |
|
117 | + } |
|
118 | 118 | } |