Skip to content

Commit

Permalink
Add phpstan check and fix level 0 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Oct 10, 2023
1 parent fad59d8 commit e4f9ab4
Show file tree
Hide file tree
Showing 38 changed files with 619 additions and 615 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ jobs:
with:
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use php 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Cache module
uses: actions/cache@v3
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install phpstan
run: composer require --dev phpstan/phpstan
- name: Analyse files
run: ./vendor/bin/phpstan analyse src test
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.30
1.17.32
2 changes: 1 addition & 1 deletion resources/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
Package: ~#PKGNAME#~
Provides: php-~#PROJECT#~
Architecture: all
Depends: php (>= 5.4.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 2.0.0), php-tecnickcom-tc-lib-color (>= 1.14.29), ${misc:Depends}
Depends: php (>= 5.4.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 2.0.0), php-tecnickcom-tc-lib-color (>= 1.14.31), ${misc:Depends}
Description: PHP Barcode library
This library includes PHP classes to generate linear
and bidimensional barcodes:
Expand Down
2 changes: 1 addition & 1 deletion resources/rpm/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BuildArch: noarch

Requires: php(language) >= 5.4.0
Requires: php-composer(%{c_vendor}/tc-lib-color) < 2.0.0
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 1.14.29
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 1.14.31
Requires: php-bcmath
Requires: php-date
Requires: php-gd
Expand Down
107 changes: 0 additions & 107 deletions src/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,113 +34,6 @@
*/
abstract class Type extends \Com\Tecnick\Barcode\Type\Convert
{
/**
* Barcode type (linear or square)
*
* @var string
*/
protected $type = '';

/**
* Barcode format
*
* @var string
*/
protected $format = '';

/**
* Array containing extra parameters for the specified barcode type
*
* @var array
*/
protected $params;

/**
* Code to convert (barcode content)
*
* @var string
*/
protected $code = '';

/**
* Resulting code after applying checksum etc.
*
* @var string
*/
protected $extcode = '';

/**
* Total number of columns
*
* @var int
*/
protected $ncols = 0;

/**
* Total number of rows
*
* @var int
*/
protected $nrows = 1;

/**
* Array containing the position and dimensions of each barcode bar
* (x, y, width, height)
*
* @var array
*/
protected $bars = array();

/**
* Barcode width
*
* @var float
*/
protected $width;

/**
* Barcode height
*
* @var float
*/
protected $height;

/**
* Additional padding to add around the barcode (top, right, bottom, left) in user units.
* A negative value indicates the multiplication factor for each row or column.
*
* @var array
*/
protected $padding = array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0);

/**
* Ratio between the barcode width and the number of rows
*
* @var float
*/
protected $width_ratio;

/**
* Ratio between the barcode height and the number of columns
*
* @var float
*/
protected $height_ratio;

/**
* Foreground Color object
*
* @var Color object
*/
protected $color_obj;

/**
* Backgorund Color object
*
* @var Color object
*/
protected $bg_color_obj;

/**
* Initialize a new barcode object
*
Expand Down
107 changes: 107 additions & 0 deletions src/Type/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,113 @@
*/
abstract class Convert
{
/**
* Barcode type (linear or square)
*
* @var string
*/
protected $type = '';

/**
* Barcode format
*
* @var string
*/
protected $format = '';

/**
* Array containing extra parameters for the specified barcode type
*
* @var array
*/
protected $params;

/**
* Code to convert (barcode content)
*
* @var string
*/
protected $code = '';

/**
* Resulting code after applying checksum etc.
*
* @var string
*/
protected $extcode = '';

/**
* Total number of columns
*
* @var int
*/
protected $ncols = 0;

/**
* Total number of rows
*
* @var int
*/
protected $nrows = 1;

/**
* Array containing the position and dimensions of each barcode bar
* (x, y, width, height)
*
* @var array
*/
protected $bars = array();

/**
* Barcode width
*
* @var float
*/
protected $width;

/**
* Barcode height
*
* @var float
*/
protected $height;

/**
* Additional padding to add around the barcode (top, right, bottom, left) in user units.
* A negative value indicates the multiplication factor for each row or column.
*
* @var array
*/
protected $padding = array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0);

/**
* Ratio between the barcode width and the number of rows
*
* @var float
*/
protected $width_ratio;

/**
* Ratio between the barcode height and the number of columns
*
* @var float
*/
protected $height_ratio;

/**
* Foreground Color object
*
* @var Color object
*/
protected $color_obj;

/**
* Backgorund Color object
*
* @var Color object
*/
protected $bg_color_obj;

/**
* Import a binary sequence of comma-separated 01 strings
*
Expand Down
4 changes: 1 addition & 3 deletions src/Type/Linear/Codabar.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ protected function formatCode()
}

/**
* Get the bars array
*
* @return array
* Set the bars array.
*
* @throws BarcodeException in case of error
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Type/Linear/CodeNineThree.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected function getChecksum($code)
}

/**
* Get the bars array
* Set the bars array.
*
* @throws BarcodeException in case of error
*
Expand Down
4 changes: 1 addition & 3 deletions src/Type/Linear/CodeOneOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ protected function formatCode()
}

/**
* Get the bars array
*
* @return array
* Set the bars array.
*
* @throws BarcodeException in case of error
*/
Expand Down
Loading

0 comments on commit e4f9ab4

Please sign in to comment.