Skip to content

Commit d30174b

Browse files
committed
More typehinting
1 parent 622a0c7 commit d30174b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/BarcodeGeneratorDynamicHTML.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class BarcodeGeneratorDynamicHTML extends BarcodeGenerator
1111
* This 'dynamic' version uses percentage based widths and heights, resulting in a vector-y qualitative result.
1212
*
1313
* @param string $barcode code to print
14-
* @param string $type type of barcode
14+
* @param BarcodeGenerator::Type_* $type (string) type of barcode
1515
* @param string $foregroundColor Foreground color for bar elements as '#333' or 'orange' for example (background is transparent).
1616
* @return string HTML code.
1717
*/
18-
public function getBarcode($barcode, $type, string $foregroundColor = 'black')
18+
public function getBarcode(string $barcode, $type, string $foregroundColor = 'black'): string
1919
{
2020
$barcodeData = $this->getBarcodeData($barcode, $type);
2121

src/BarcodeGeneratorHTML.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ class BarcodeGeneratorHTML extends BarcodeGenerator
99
* This original version uses pixel based widths and heights. Use Dynamic HTML version for better quality representation.
1010
*
1111
* @param string $barcode code to print
12-
* @param string $type type of barcode
12+
* @param BarcodeGenerator::Type_* $type (string) type of barcode
1313
* @param int $widthFactor Width of a single bar element in pixels.
1414
* @param int $height Height of a single bar element in pixels.
1515
* @param string $foregroundColor Foreground color for bar elements as '#333' or 'orange' for example (background is transparent).
1616
* @return string HTML code.
1717
*/
18-
public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, string $foregroundColor = 'black')
18+
public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, string $foregroundColor = 'black'): string
1919
{
2020
$barcodeData = $this->getBarcodeData($barcode, $type);
2121

src/BarcodeGeneratorPNG.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class BarcodeGeneratorPNG extends BarcodeGenerator
1111
{
1212
protected $useImagick = true;
1313

14+
/**
15+
* @throws BarcodeException
16+
*/
1417
public function __construct()
1518
{
1619
// Auto switch between GD and Imagick based on what is installed
@@ -43,13 +46,13 @@ public function useGd()
4346
* Return a PNG image representation of barcode (requires GD or Imagick library).
4447
*
4548
* @param string $barcode code to print
46-
* @param string $type type of barcode:
49+
* @param BarcodeGenerator::Type_* $type (string) type of barcode
4750
* @param int $widthFactor Width of a single bar element in pixels.
4851
* @param int $height Height of a single bar element in pixels.
4952
* @param array $foregroundColor RGB (0-255) foreground color for bar elements (background is transparent).
5053
* @return string image data or false in case of error.
5154
*/
52-
public function getBarcode($barcode, $type, int $widthFactor = 2, int $height = 30, array $foregroundColor = [0, 0, 0])
55+
public function getBarcode(string $barcode, $type, int $widthFactor = 2, int $height = 30, array $foregroundColor = [0, 0, 0]): string
5356
{
5457
$barcodeData = $this->getBarcodeData($barcode, $type);
5558
$width = round($barcodeData->getWidth() * $widthFactor);

src/BarcodeGeneratorSVG.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BarcodeGeneratorSVG extends BarcodeGenerator
1515
* @return string SVG code.
1616
* @public
1717
*/
18-
public function getBarcode(string $barcode, $type, float $widthFactor = 2, float $height = 30, string $foregroundColor = 'black')
18+
public function getBarcode(string $barcode, $type, float $widthFactor = 2, float $height = 30, string $foregroundColor = 'black'): string
1919
{
2020
$barcodeData = $this->getBarcodeData($barcode, $type);
2121

0 commit comments

Comments
 (0)