Skip to content

Commit

Permalink
Scrutinizer Samples/Tests (#3733)
Browse files Browse the repository at this point in the history
* Scrutinizer Samples/Tests

A great many statements recently flagged. Attend to those in Samples and Tests.

* Missed a Few

* Update XlsTest.php
  • Loading branch information
oleibman authored Sep 14, 2023
1 parent c74255c commit 1b01b7d
Show file tree
Hide file tree
Showing 80 changed files with 131 additions and 15 deletions.
4 changes: 2 additions & 2 deletions samples/Basic/25_In_memory_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$drawing = new MemoryDrawing();
$drawing->setName('Sample image');
$drawing->setDescription('Sample image');
$drawing->setImageResource($gdImage);
$drawing->setImageResource(/** @scrutinizer ignore-type */ $gdImage);
$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG);
$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setHeight(36);
Expand All @@ -56,7 +56,7 @@
$drawing = new MemoryDrawing();
$drawing->setName('Sample image');
$drawing->setDescription('Sample image');
$drawing->setImageResource($gdImage);
$drawing->setImageResource(/** @scrutinizer ignore-type */ $gdImage);
$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG);
$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setHeight(36);
Expand Down
2 changes: 2 additions & 0 deletions samples/Calculations/DateTime/DAYS360.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
));
$helper->log(sprintf(
'Days: %d (US) %d (European)',
/** @scrutinizer ignore-type */
$worksheet->getCell('G' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('H' . $row)->getCalculatedValue()
));
}
1 change: 1 addition & 0 deletions samples/Calculations/DateTime/EDATE.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'%s and %d months is %d (%s)',
$worksheet->getCell('B' . $row)->getFormattedValue(),
$worksheet->getCell('C' . $row)->getFormattedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
$worksheet->getCell('D' . $row)->getFormattedValue()
));
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/DateTime/EOMONTH.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'%s and %d months is %d (%s)',
$worksheet->getCell('B' . $row)->getFormattedValue(),
$worksheet->getCell('C' . $row)->getFormattedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
$worksheet->getCell('D' . $row)->getFormattedValue()
));
Expand Down
2 changes: 2 additions & 0 deletions samples/Calculations/DateTime/NETWORKDAYS.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
'Between %s and %s is %d working days; %d with public holidays',
$worksheet->getCell('A1')->getFormattedValue(),
$worksheet->getCell('B' . $row)->getFormattedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue()
));
}
1 change: 1 addition & 0 deletions samples/Calculations/DateTime/NOW.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// Test the formulae
$helper->log(sprintf(
'Today is %f (%s)',
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue(),
$worksheet->getCell('A1')->getFormattedValue()
));
1 change: 1 addition & 0 deletions samples/Calculations/DateTime/TODAY.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// Test the formulae
$helper->log(sprintf(
'Today is %d (%s)',
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue(),
$worksheet->getCell('A1')->getFormattedValue()
));
2 changes: 2 additions & 0 deletions samples/Calculations/DateTime/WEEKDAY.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
$helper->log(sprintf('(E%d): %s', $row, $worksheet->getCell('E' . $row)->getFormattedValue()));
$helper->log(sprintf(
'Weekday is: %d (1-7 = Sun-Sat)',
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue()
));
$helper->log(sprintf(
'Weekday is: %d (1-7 = Mon-Sun)',
/** @scrutinizer ignore-type */
$worksheet->getCell('G' . $row)->getCalculatedValue()
));
}
5 changes: 5 additions & 0 deletions samples/Calculations/DateTime/YEARFRAC.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,27 @@
));
$helper->log(sprintf(
'Days: %f - US (NASD) 30/360',
/** @scrutinizer ignore-type */
$worksheet->getCell('G' . $row)->getCalculatedValue()
));
$helper->log(sprintf(
'Days: %f - Actual',
/** @scrutinizer ignore-type */
$worksheet->getCell('H' . $row)->getCalculatedValue()
));
$helper->log(sprintf(
'Days: %f - Actual/360',
/** @scrutinizer ignore-type */
$worksheet->getCell('I' . $row)->getCalculatedValue()
));
$helper->log(sprintf(
'Days: %f - Actual/365',
/** @scrutinizer ignore-type */
$worksheet->getCell('J' . $row)->getCalculatedValue()
));
$helper->log(sprintf(
'Days: %f - European 30/360',
/** @scrutinizer ignore-type */
$worksheet->getCell('K' . $row)->getCalculatedValue()
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BESSELI.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$helper->log(sprintf(
'%s = %f',
$worksheet->getCell('A1')->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue()
));
}
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BESSELJ.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$helper->log(sprintf(
'%s = %f',
$worksheet->getCell('A1')->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue()
));
}
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BESSELK.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$helper->log(sprintf(
'%s = %f',
$worksheet->getCell('A1')->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue()
));
}
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BESSELY.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$helper->log(sprintf(
'%s = %f',
$worksheet->getCell('A1')->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('A1')->getCalculatedValue()
));
}
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BIN2DEC.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'(B%d): Binary %s is decimal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BIN2HEX.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'(B%d): Binary %s is hexadecimal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/BIN2OCT.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'(B%d): Binary %s is octal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
4 changes: 4 additions & 0 deletions samples/Calculations/Engineering/BITAND.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
'(E%d): Bitwise AND of %d (%s) and %d (%s) is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('E' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue(),
));
}
9 changes: 9 additions & 0 deletions samples/Calculations/Engineering/BITLSHIFT.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,33 @@
'(E%d): Bitwise Left Shift of %d (%s) by 1 bit is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
));
$helper->log(sprintf(
'(E%d): Bitwise Left Shift of %d (%s) by 2 bits is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('E' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue(),
));
$helper->log(sprintf(
'(E%d): Bitwise Left Shift of %d (%s) by 3 bits is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('G' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('H' . $row)->getCalculatedValue(),
));
}
4 changes: 4 additions & 0 deletions samples/Calculations/Engineering/BITOR.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
'(E%d): Bitwise OR of %d (%s) and %d (%s) is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('E' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue(),
));
}
9 changes: 9 additions & 0 deletions samples/Calculations/Engineering/BITRSHIFT.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,33 @@
'(E%d): Bitwise Right Shift of %d (%s) by 1 bit is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
));
$helper->log(sprintf(
'(E%d): Bitwise Right Shift of %d (%s) by 2 bits is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('E' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue(),
));
$helper->log(sprintf(
'(E%d): Bitwise Right Shift of %d (%s) by 3 bits is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('G' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('H' . $row)->getCalculatedValue(),
));
}
4 changes: 4 additions & 0 deletions samples/Calculations/Engineering/BITXOR.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
'(E%d): Bitwise XOR of %d (%s) and %d (%s) is %d (%s)',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('E' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('F' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/COMPLEX.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'(A%d): Formula %s result is %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('A' . $row)->getCalculatedValue()
));
}
2 changes: 2 additions & 0 deletions samples/Calculations/Engineering/CONVERT.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
$worksheet->getCell('D' . $row)->getValue(),
$worksheet->getCell('A' . $row)->getValue(),
trim($worksheet->getCell('B' . $row)->getValue(), '"'),
/** @scrutinizer ignore-type */
$worksheet->getCell('D' . $row)->getCalculatedValue(),
trim($worksheet->getCell('C' . $row)->getValue(), '"')
));
Expand All @@ -54,5 +55,6 @@
'(A%d): Unit of Measure Conversion Formula %s result is %s',
$row,
$worksheet->getCell('H1')->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('H1')->getCalculatedValue()
));
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/DEC2BIN.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'(B%d): Decimal %s is binary %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/DEC2HEX.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'(B%d): Decimal %s is hexadecimal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/DEC2OCT.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'(B%d): Decimal %s is octal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
2 changes: 2 additions & 0 deletions samples/Calculations/Engineering/DELTA.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
$row,
$worksheet->getCell('A' . $row)->getValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
/** @scrutinizer ignore-type */
$comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()]
));
}
2 changes: 2 additions & 0 deletions samples/Calculations/Engineering/ERF.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$row,
$worksheet->getCell('C' . $row)->getValue(),
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
));
}
Expand All @@ -62,6 +63,7 @@
$worksheet->getCell('C' . $row)->getValue(),
$worksheet->getCell('A' . $row)->getValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/ERFC.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
$row,
$worksheet->getCell('C' . $row)->getValue(),
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
));
}
2 changes: 2 additions & 0 deletions samples/Calculations/Engineering/GESTEP.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
$row,
$worksheet->getCell('A' . $row)->getValue(),
$worksheet->getCell('B' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('C' . $row)->getCalculatedValue(),
sprintf(
/** @scrutinizer ignore-type */
$comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()],
$worksheet->getCell('A' . $row)->getValue(),
$worksheet->getCell('B' . $row)->getValue(),
Expand Down
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/HEX2BIN.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'(B%d): Hexadecimal %s is binary %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/HEX2DEC.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'(B%d): Hexadecimal %s is decimal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
1 change: 1 addition & 0 deletions samples/Calculations/Engineering/HEX2OCT.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'(B%d): Hexadecimal %s is octal %s',
$row,
$worksheet->getCell('A' . $row)->getValue(),
/** @scrutinizer ignore-type */
$worksheet->getCell('B' . $row)->getCalculatedValue(),
));
}
Loading

0 comments on commit 1b01b7d

Please sign in to comment.