diff --git a/src/BarcodeGeneratorDynamicHTML.php b/src/BarcodeGeneratorDynamicHTML.php index d2e7cb5..52809d3 100644 --- a/src/BarcodeGeneratorDynamicHTML.php +++ b/src/BarcodeGeneratorDynamicHTML.php @@ -11,11 +11,11 @@ class BarcodeGeneratorDynamicHTML extends BarcodeGenerator * This 'dynamic' version uses percentage based widths and heights, resulting in a vector-y qualitative result. * * @param string $barcode code to print - * @param string $type type of barcode + * @param BarcodeGenerator::Type_* $type (string) type of barcode * @param string $foregroundColor Foreground color for bar elements as '#333' or 'orange' for example (background is transparent). * @return string HTML code. */ - public function getBarcode($barcode, $type, string $foregroundColor = 'black') + public function getBarcode(string $barcode, $type, string $foregroundColor = 'black'): string { $barcodeData = $this->getBarcodeData($barcode, $type); diff --git a/src/BarcodeGeneratorHTML.php b/src/BarcodeGeneratorHTML.php index 25a8820..294b680 100644 --- a/src/BarcodeGeneratorHTML.php +++ b/src/BarcodeGeneratorHTML.php @@ -9,13 +9,13 @@ class BarcodeGeneratorHTML extends BarcodeGenerator * This original version uses pixel based widths and heights. Use Dynamic HTML version for better quality representation. * * @param string $barcode code to print - * @param string $type type of barcode + * @param BarcodeGenerator::Type_* $type (string) type of barcode * @param int $widthFactor Width of a single bar element in pixels. * @param int $height Height of a single bar element in pixels. * @param string $foregroundColor Foreground color for bar elements as '#333' or 'orange' for example (background is transparent). * @return string HTML code. */ - public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, string $foregroundColor = 'black') + public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, string $foregroundColor = 'black'): string { $barcodeData = $this->getBarcodeData($barcode, $type); diff --git a/src/BarcodeGeneratorPNG.php b/src/BarcodeGeneratorPNG.php index e73a054..bc7943c 100644 --- a/src/BarcodeGeneratorPNG.php +++ b/src/BarcodeGeneratorPNG.php @@ -11,6 +11,9 @@ class BarcodeGeneratorPNG extends BarcodeGenerator { protected $useImagick = true; + /** + * @throws BarcodeException + */ public function __construct() { // Auto switch between GD and Imagick based on what is installed @@ -43,13 +46,13 @@ public function useGd() * Return a PNG image representation of barcode (requires GD or Imagick library). * * @param string $barcode code to print - * @param string $type type of barcode: + * @param BarcodeGenerator::Type_* $type (string) type of barcode * @param int $widthFactor Width of a single bar element in pixels. * @param int $height Height of a single bar element in pixels. * @param array $foregroundColor RGB (0-255) foreground color for bar elements (background is transparent). * @return string image data or false in case of error. */ - public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, array $foregroundColor = [0, 0, 0]) + public function getBarcode(string $barcode, $type, int $widthFactor = 2, int $height = 30, array $foregroundColor = [0, 0, 0]): string { $barcodeData = $this->getBarcodeData($barcode, $type); $width = round($barcodeData->getWidth() * $widthFactor); diff --git a/src/BarcodeGeneratorSVG.php b/src/BarcodeGeneratorSVG.php index 6f8fb16..e67527f 100644 --- a/src/BarcodeGeneratorSVG.php +++ b/src/BarcodeGeneratorSVG.php @@ -15,7 +15,7 @@ class BarcodeGeneratorSVG extends BarcodeGenerator * @return string SVG code. * @public */ - public function getBarcode(string $barcode, $type, float $widthFactor = 2, float $height = 30, string $foregroundColor = 'black') + public function getBarcode(string $barcode, $type, float $widthFactor = 2, float $height = 30, string $foregroundColor = 'black'): string { $barcodeData = $this->getBarcodeData($barcode, $type);