Skip to content

Commit a39ee10

Browse files
authored
Enable more rules from PER-CS (#46)
1 parent 3a9bd1a commit a39ee10

File tree

10 files changed

+622
-663
lines changed

10 files changed

+622
-663
lines changed

.php-cs-fixer.dist.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
return (new PhpCsFixer\Config())
44
->setRules([
55
'@PER-CS' => true,
6-
'array_syntax' => false,
7-
'concat_space' => false,
86
'visibility_required' => ['elements' => ['property', 'method']], // Exclude 'const' for PHP 5.6 compatibility
97
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
108
'method_argument_space' => false,
11-
'array_indentation' => false,
12-
'braces_position' => false,
13-
'statement_indentation' => false,
14-
'binary_operator_spaces' => false,
159
])
1610
->setFinder(
1711
PhpCsFixer\Finder::create()

Spreadsheet/Excel/Writer/BIFFwriter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ protected function _setByteOrder()
128128
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
129129
if ($number == $teststr) {
130130
$byte_order = 0; // Little Endian
131-
} elseif ($number == strrev($teststr)){
131+
} elseif ($number == strrev($teststr)) {
132132
$byte_order = 1; // Big Endian
133133
} else {
134134
// Give up. I'll fix this in a later version.
135-
return $this->raiseError("Required floating point format ".
135+
return $this->raiseError("Required floating point format " .
136136
"not supported on this platform.");
137137
}
138138
$this->_byte_order = $byte_order;
@@ -149,7 +149,7 @@ protected function _prepend($data)
149149
if (strlen($data) > $this->_limit) {
150150
$data = $this->_addContinue($data);
151151
}
152-
$this->_data = $data.$this->_data;
152+
$this->_data = $data . $this->_data;
153153
$this->_datasize += strlen($data);
154154
}
155155

@@ -232,7 +232,7 @@ protected function _addContinue($data)
232232

233233
// The first 2080/8224 bytes remain intact. However, we have to change
234234
// the length field of the record.
235-
$tmp = substr($data, 0, 2).pack("v", $limit-4).substr($data, 4, $limit - 4);
235+
$tmp = substr($data, 0, 2) . pack("v", $limit - 4) . substr($data, 4, $limit - 4);
236236

237237
$header = pack("vv", $record, $limit); // Headers for continue records
238238

Spreadsheet/Excel/Writer/Format.php

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class Spreadsheet_Excel_Writer_Format extends PEAR
267267
* @param integer $index the XF index for the format.
268268
* @param array $properties array with properties to be set on initialization.
269269
*/
270-
public function __construct($BIFF_version, $index = 0, $properties = array())
270+
public function __construct($BIFF_version, $index = 0, $properties = [])
271271
{
272272
$this->_xf_index = $index;
273273
$this->_BIFF_version = $BIFF_version;
@@ -314,10 +314,9 @@ public function __construct($BIFF_version, $index = 0, $properties = array())
314314
$this->_diag_color = 0x40;
315315

316316
// Set properties passed to Spreadsheet_Excel_Writer_Workbook::addFormat()
317-
foreach ($properties as $property => $value)
318-
{
319-
if (method_exists($this, 'set'.ucwords($property))) {
320-
$method_name = 'set'.ucwords($property);
317+
foreach ($properties as $property => $value) {
318+
if (method_exists($this, 'set' . ucwords($property))) {
319+
$method_name = 'set' . ucwords($property);
321320
$this->$method_name($value);
322321
}
323322
}
@@ -409,8 +408,8 @@ public function getXf($style)
409408

410409
$header = pack("vv", $record, $length);
411410
$data = pack("vvvvvvvv", $ifnt, $ifmt, $style, $align,
412-
$icv, $fill,
413-
$border1, $border2);
411+
$icv, $fill,
412+
$border1, $border2);
414413
} elseif ($this->_BIFF_version == 0x0600) {
415414
$align = $this->_text_h_align; // Alignment
416415
$align |= $this->_text_wrap << 3;
@@ -497,12 +496,12 @@ public function getFont()
497496
$header = pack("vv", $record, $length);
498497
if ($this->_BIFF_version == 0x0500) {
499498
$data = pack("vvvvvCCCCC", $dyHeight, $grbit, $icv, $bls,
500-
$sss, $uls, $bFamily,
501-
$bCharSet, $reserved, $cch);
499+
$sss, $uls, $bFamily,
500+
$bCharSet, $reserved, $cch);
502501
} elseif ($this->_BIFF_version == 0x0600) {
503502
$data = pack("vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
504-
$sss, $uls, $bFamily,
505-
$bCharSet, $reserved, $cch, $encoding);
503+
$sss, $uls, $bFamily,
504+
$bCharSet, $reserved, $cch, $encoding);
506505
}
507506
return ($header . $data . $this->_font_name);
508507
}
@@ -549,26 +548,26 @@ public function getXfIndex()
549548
*/
550549
protected function _getColor($name_color = '')
551550
{
552-
$colors = array(
553-
'aqua' => 0x07,
554-
'cyan' => 0x07,
555-
'black' => 0x00,
556-
'blue' => 0x04,
557-
'brown' => 0x10,
558-
'magenta' => 0x06,
559-
'fuchsia' => 0x06,
560-
'gray' => 0x17,
561-
'grey' => 0x17,
562-
'green' => 0x11,
563-
'lime' => 0x03,
564-
'navy' => 0x12,
565-
'orange' => 0x35,
566-
'purple' => 0x14,
567-
'red' => 0x02,
568-
'silver' => 0x16,
569-
'white' => 0x01,
570-
'yellow' => 0x05,
571-
);
551+
$colors = [
552+
'aqua' => 0x07,
553+
'cyan' => 0x07,
554+
'black' => 0x00,
555+
'blue' => 0x04,
556+
'brown' => 0x10,
557+
'magenta' => 0x06,
558+
'fuchsia' => 0x06,
559+
'gray' => 0x17,
560+
'grey' => 0x17,
561+
'green' => 0x11,
562+
'lime' => 0x03,
563+
'navy' => 0x12,
564+
'orange' => 0x35,
565+
'purple' => 0x14,
566+
'red' => 0x02,
567+
'silver' => 0x16,
568+
'white' => 0x01,
569+
'yellow' => 0x05,
570+
];
572571

573572
// Return the default color, 0x7FFF, if undef,
574573
if ($name_color === '') {
@@ -998,35 +997,34 @@ public function setTextWrap()
998997
*/
999998
public function setTextRotation($angle)
1000999
{
1001-
switch ($angle)
1002-
{
1000+
switch ($angle) {
10031001
case 0:
10041002
$this->_rotation = 0;
10051003
break;
10061004
case 90:
10071005
if ($this->_BIFF_version == 0x0500) {
1008-
$this->_rotation = 3;
1006+
$this->_rotation = 3;
10091007
} elseif ($this->_BIFF_version == 0x0600) {
10101008
$this->_rotation = 180;
10111009
}
10121010
break;
10131011
case 270:
10141012
if ($this->_BIFF_version == 0x0500) {
1015-
$this->_rotation = 2;
1013+
$this->_rotation = 2;
10161014
} elseif ($this->_BIFF_version == 0x0600) {
10171015
$this->_rotation = 90;
10181016
}
10191017
break;
10201018
case -1:
10211019
if ($this->_BIFF_version == 0x0500) {
1022-
$this->_rotation = 1;
1020+
$this->_rotation = 1;
10231021
} elseif ($this->_BIFF_version == 0x0600) {
10241022
$this->_rotation = 255;
10251023
}
10261024
break;
10271025
default:
1028-
return $this->raiseError("Invalid value for angle.".
1029-
" Possible values are: 0, 90, 270 and -1 ".
1026+
return $this->raiseError("Invalid value for angle." .
1027+
" Possible values are: 0, 90, 270 and -1 " .
10301028
"for stacking top-to-bottom.");
10311029
$this->_rotation = 0;
10321030
break;
@@ -1087,15 +1085,15 @@ public function setScript($script)
10871085
$this->_font_script = $script;
10881086
}
10891087

1090-
/**
1091-
* Locks a cell.
1092-
*
1093-
* @access public
1094-
*/
1095-
public function setLocked()
1096-
{
1097-
$this->_locked = 1;
1098-
}
1088+
/**
1089+
* Locks a cell.
1090+
*
1091+
* @access public
1092+
*/
1093+
public function setLocked()
1094+
{
1095+
$this->_locked = 1;
1096+
}
10991097

11001098
/**
11011099
* Unlocks a cell. Useful for unprotecting particular cells of a protected sheet.

0 commit comments

Comments
 (0)