Skip to content

Commit 3a9bd1a

Browse files
authored
Apply additional CS rules to get closer to PER-CS (#45)
1 parent da9cec7 commit 3a9bd1a

File tree

8 files changed

+244
-285
lines changed

8 files changed

+244
-285
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@
33
return (new PhpCsFixer\Config())
44
->setRules([
55
'@PER-CS' => true,
6-
'native_function_invocation' => false,
76
'array_syntax' => false,
87
'concat_space' => false,
9-
'blank_line_after_opening_tag' => false,
108
'visibility_required' => ['elements' => ['property', 'method']], // Exclude 'const' for PHP 5.6 compatibility
11-
'trailing_comma_in_multiline' => false,
9+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
1210
'method_argument_space' => false,
1311
'array_indentation' => false,
1412
'braces_position' => false,
1513
'statement_indentation' => false,
1614
'binary_operator_spaces' => false,
17-
'single_blank_line_at_eof' => false,
18-
'control_structure_braces' => false,
19-
'control_structure_continuation_position' => false,
2015
])
2116
->setFinder(
2217
PhpCsFixer\Finder::create()

Spreadsheet/Excel/Writer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Module written/ported by Xavier Noguer <[email protected]>
45
*
@@ -102,4 +103,4 @@ public function rowcolToCell($row, $col)
102103

103104
return $chr1 . $chr2 . $row;
104105
}
105-
}
106+
}

Spreadsheet/Excel/Writer/BIFFwriter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Module written/ported by Xavier Noguer <[email protected]>
45
*
@@ -265,4 +266,4 @@ public function setTempDir($dir)
265266
}
266267
return false;
267268
}
268-
}
269+
}

Spreadsheet/Excel/Writer/Format.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Module written/ported by Xavier Noguer <[email protected]>
45
*
@@ -322,7 +323,6 @@ public function __construct($BIFF_version, $index = 0, $properties = array())
322323
}
323324
}
324325

325-
326326
/**
327327
* Generate an Excel BIFF XF record (style or cell).
328328
*
@@ -567,7 +567,7 @@ protected function _getColor($name_color = '')
567567
'red' => 0x02,
568568
'silver' => 0x16,
569569
'white' => 0x01,
570-
'yellow' => 0x05
570+
'yellow' => 0x05,
571571
);
572572

573573
// Return the default color, 0x7FFF, if undef,
@@ -763,7 +763,6 @@ public function setBold($weight = 1)
763763
$this->_bold = $weight;
764764
}
765765

766-
767766
/************************************
768767
* FUNCTIONS FOR SETTING CELLS BORDERS
769768
*/
@@ -812,7 +811,6 @@ public function setRight($style)
812811
$this->_right = $style;
813812
}
814813

815-
816814
/**
817815
* Set cells borders to the same style
818816
*
@@ -827,7 +825,6 @@ public function setBorder($style)
827825
$this->setRight($style);
828826
}
829827

830-
831828
/*******************************************
832829
* FUNCTIONS FOR SETTING CELLS BORDERS COLORS
833830
*/
@@ -895,7 +892,6 @@ public function setRightColor($color)
895892
$this->_right_color = $value;
896893
}
897894

898-
899895
/**
900896
* Sets the cell's foreground color
901897
*
@@ -1122,4 +1118,4 @@ public function setFontFamily($font_family)
11221118
{
11231119
$this->_font_name = $font_family;
11241120
}
1125-
}
1121+
}

Spreadsheet/Excel/Writer/Parser.php

Lines changed: 228 additions & 227 deletions
Large diffs are not rendered by default.

Spreadsheet/Excel/Writer/Validator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Module written by Herman Kuiper <[email protected]>
45
*
@@ -225,4 +226,4 @@ public function setCol($col, $row1, $row2, $incell = true)
225226
$this->_incell = $incell;
226227
//$this->_formula1 = ...;
227228
}
228-
}*/
229+
}*/

Spreadsheet/Excel/Writer/Workbook.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Module written/ported by Xavier Noguer <[email protected]>
45
*
@@ -903,9 +904,6 @@ protected function _storeNames()
903904
}
904905
}
905906

906-
907-
908-
909907
/******************************************************************************
910908
*
911909
* BIFF RECORDS
@@ -1048,7 +1046,6 @@ protected function _storeStyle()
10481046
$this->_append($header . $data);
10491047
}
10501048

1051-
10521049
/**
10531050
* Writes Excel FORMAT record for non "built-in" numerical formats.
10541051
*
@@ -1106,7 +1103,6 @@ protected function _storeDatemode()
11061103
$this->_append($header . $data);
11071104
}
11081105

1109-
11101106
/**
11111107
* Write BIFF record EXTERNCOUNT to indicate the number of external sheet
11121108
* references in the workbook.
@@ -1130,7 +1126,6 @@ protected function _storeExterncount($cxals)
11301126
$this->_append($header . $data);
11311127
}
11321128

1133-
11341129
/**
11351130
* Writes the Excel BIFF EXTERNSHEET record. These references are used by
11361131
* formulas. NAME record is required to define the print area and the repeat
@@ -1154,7 +1149,6 @@ protected function _storeExternsheet($sheetname)
11541149
$this->_append($header . $data . $sheetname);
11551150
}
11561151

1157-
11581152
/**
11591153
* Store the NAME record in the short format that is used for storing the print
11601154
* area, repeat rows only and repeat columns only.
@@ -1218,7 +1212,6 @@ protected function _storeNameShort($index, $type, $rowmin, $rowmax, $colmin, $co
12181212
$this->_append($header . $data);
12191213
}
12201214

1221-
12221215
/**
12231216
* Store the NAME record in the long format that is used for storing the repeat
12241217
* rows and columns when both are specified. This shares a lot of code with
@@ -1395,7 +1388,6 @@ protected function _calculateSharedStringsSizes()
13951388
$header_length = 3; // Min string + header size -1
13961389
$space_remaining = $continue_limit - $written - $continue;
13971390

1398-
13991391
/* TODO: Unicode data should only be split on char (2 byte)
14001392
boundaries. Therefore, in some cases we need to reduce the
14011393
amount of available
@@ -1423,7 +1415,6 @@ protected function _calculateSharedStringsSizes()
14231415
}
14241416
}
14251417

1426-
14271418
if ($space_remaining > $header_length) {
14281419
// Write as much as possible of the string in the current block
14291420
$written += $space_remaining;
@@ -1468,7 +1459,6 @@ protected function _calculateSharedStringsSizes()
14681459
$this->_block_sizes[] = $written + $continue;
14691460
}
14701461

1471-
14721462
/* Calculate the total length of the SST and associated CONTINUEs (if any).
14731463
The SST record will have a length even if it contains no strings.
14741464
This length is required to set the offsets in the BOUNDSHEET records since
@@ -1525,16 +1515,11 @@ protected function _storeSharedStringsTable()
15251515
$length = 8;
15261516
}
15271517

1528-
1529-
15301518
// Write the SST block header information
15311519
$header = pack("vv", $record, $length);
15321520
$data = pack("VV", $this->_str_total, $this->_str_unique);
15331521
$this->_append($header . $data);
15341522

1535-
1536-
1537-
15381523
/* TODO: not good for performance */
15391524
foreach (array_keys($this->_str_table) as $string) {
15401525

@@ -1548,7 +1533,6 @@ protected function _storeSharedStringsTable()
15481533
//
15491534
$block_length += $string_length;
15501535

1551-
15521536
// We can write the string if it doesn't cross a CONTINUE boundary
15531537
if ($block_length < $continue_limit) {
15541538
$this->_append($string);
@@ -1568,7 +1552,6 @@ protected function _storeSharedStringsTable()
15681552
$header_length = 3; // Min string + header size -1
15691553
$space_remaining = $continue_limit - $written - $continue;
15701554

1571-
15721555
// Unicode data should only be split on char (2 byte) boundaries.
15731556
// Therefore, in some cases we need to reduce the amount of available
15741557
// space by 1 byte to ensure the correct alignment.
@@ -1595,7 +1578,6 @@ protected function _storeSharedStringsTable()
15951578
}
15961579
}
15971580

1598-
15991581
if ($space_remaining > $header_length) {
16001582
// Write as much as possible of the string in the current block
16011583
$tmp = substr($string, 0, $space_remaining);
@@ -1648,6 +1630,4 @@ protected function _storeSharedStringsTable()
16481630
}
16491631
}
16501632

1651-
16521633
}
1653-

0 commit comments

Comments
 (0)