More cleanup PHPDoc according to PhpStorm

This commit is contained in:
Adrien Crivelli
2024-01-03 21:12:55 +08:00
parent c1eafc5336
commit aefde297df
4 changed files with 12 additions and 22 deletions
+8 -15
View File
@@ -16,27 +16,20 @@ $spreadsheet->getActiveSheet()->setPrintGridlines(true);
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
// Export to PDF (mpdf)
function mpdfCjkWriter(Mpdf $writer): void
{
/** @var callable */
$callback = 'mpdfCjk';
$writer->setEditHtmlCallback($callback);
}
$mpdfCjkWriter = function (Mpdf $writer): void {
$mpdfCjk = function (string $html): string {
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
function mpdfCjk(string $html): string
{
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
};
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
}
$writer->setEditHtmlCallback($mpdfCjk);
};
$helper->log('Write to Mpdf');
IOFactory::registerWriter('Pdf', Mpdf::class);
/** @var callable */
$callback = 'mpdfCjkWriter';
$filename = __FILE__;
//$filename = str_replace('.php', '.mdpf.php', __FILE__);
$helper->write($spreadsheet, $filename, ['Pdf'], false, $callback);
$helper->write($spreadsheet, $filename, ['Pdf'], false, $mpdfCjkWriter);
// Remove first two rows with field headers before exporting to CSV
$helper->log('Removing first two heading rows for CSV export');
@@ -2,6 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel;
use DateTime;
use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
@@ -28,12 +29,12 @@ class Month
* a negative value yields a past date.
* Or can be an array of adjustment values
*
* @return array|mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* @return array|DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
* If an array of values is passed as the argument, then the returned result will also be an array
* with the same dimensions
*/
public static function adjust(mixed $dateValue, array|string|bool|float|int $adjustmentMonths)
public static function adjust(mixed $dateValue, array|string|bool|float|int $adjustmentMonths): DateTime|float|int|string|array
{
if (is_array($dateValue) || is_array($adjustmentMonths)) {
return self::evaluateArrayArguments([self::class, __FUNCTION__], $dateValue, $adjustmentMonths);
@@ -59,11 +59,8 @@ class TimeValue
$PHPDateArray = Helpers::dateParse($timeValue);
$retValue = ExcelError::VALUE();
if (Helpers::dateParseSucceeded($PHPDateArray)) {
/** @var int $hour */
$hour = $PHPDateArray['hour'];
/** @var int $minute */
$minute = $PHPDateArray['minute'];
/** @var int $second */
$second = $PHPDateArray['second'];
// OpenOffice-specific code removed - it works just like Excel
$excelDateValue = SharedDateHelper::formattedPHPToExcel(1900, 1, 1, $hour, $minute, $second) - 1;
@@ -17,8 +17,7 @@ abstract class GammaBase
private const MAX_ITERATIONS = 256;
/** @return float|string */
protected static function calculateDistribution(float $value, float $a, float $b, bool $cumulative)
protected static function calculateDistribution(float $value, float $a, float $b, bool $cumulative): float
{
if ($cumulative) {
return self::incompleteGamma($a, $value / $b) / self::gammaValue($a);