fix phpstan (#28695)

* fix phpstan

* fix typo

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-03-07 22:13:09 +01:00 committed by GitHub
parent 7f277e9578
commit 3035a7bc7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Andreu Bisquerra <jove@bisquerra.com>
*
* This program is free software; you can redistribute it and/or modify
@ -133,6 +133,10 @@ class dolReceiptPrinter extends Printer
* @var string[] array of tags
*/
public $tags;
/**
* @var \Mike42\Escpos\Printer
*/
public $printer;
public $template;
@ -1033,6 +1037,7 @@ class dolReceiptPrinter extends Printer
try {
$type = $obj['fk_type'];
$found = true;
switch ($type) {
case 1:
$this->connector = new DummyPrintConnector();
@ -1051,10 +1056,15 @@ class dolReceiptPrinter extends Printer
$this->connector = new CupsPrintConnector($parameter);
break;
default:
$this->connector = 'CONNECTOR_UNKNOWN';
$found = false;;
break;
}
$this->printer = new Printer($this->connector, $this->profile);
if ($found) {
$this->printer = new Printer($this->connector, $this->profile);
} else {
$error++;
$this->errors[] = 'CONNECTOR_UNKNOWN';
}
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
$error++;

View file

@ -12,6 +12,8 @@ ReceiptPrinterProfileDesc=Description of Receipt Printer's Profile
ListPrinters=List of Printers
FromServerPointOfView=From the web server point of view. This method must be reachable from the web server hosting.
SetupReceiptTemplate=Template Setup
PrinterNameEmpty=Printer name is empty
PrinterParameterEmpty=Printer parameters are empty
CONNECTOR_DUMMY=Dummy Printer
CONNECTOR_NETWORK_PRINT=Network Printer
CONNECTOR_FILE_PRINT=Local Printer