Skip to content

Commit

Permalink
chore:support laravel 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tintnaingwinn committed Apr 9, 2024
1 parent 1ca6a40 commit f182fd3
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 75 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@ on: [push]

jobs:
php-code-styling:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
fail-fast: true

steps:
- name: Checkout code
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
- name: Install composer dependencies
uses: nick-fields/retry@v2
with:
commit_message: Fix styling
timeout_minutes: 3
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Check code style
timeout-minutes: 2
run: ./vendor/bin/pint --test --preset laravel
25 changes: 18 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,31 @@ on:

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
fail-fast: true

name: Static Analysis

steps:
- uses: actions/checkout@v4
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress
- name: Install composer dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 3
max_attempts: 5
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Run PHPStan
timeout-minutes: 2
run: ./vendor/bin/phpstan --error-format=github
run: ./vendor/bin/phpstan analyse --error-format=github
32 changes: 16 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04

strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [10.*, 9.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
larastan: 2.4.*
- laravel: 9.*
testbench: 7.*
larastan: 2.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9, 10, 11 ]
exclude:
- php: 8.1
laravel: 11
- php: 8.3
laravel: 9

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
Expand All @@ -34,6 +31,9 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none

- name: Setup problem matchers
run: |
Expand All @@ -42,8 +42,8 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nunomaduro/larastan:${{ matrix.larastan }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
composer require "laravel/framework:^${{ matrix.laravel }}" --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
timeout-minutes: 2
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: "Update Changelog"

on:
release:
types: [released]
release:
types: [released]

jobs:
update:
runs-on: ubuntu-latest
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<h1 align="center">Laravel Barcode</h1>

[![Latest Version on Packagist](https://img.shields.io/packagist/v/ageekdev/laravel-barcode.svg?style=flat-square&logo=Packagist)](https://packagist.org/packages/ageekdev/laravel-barcode)
[![Laravel 9.x](https://img.shields.io/badge/Laravel-9.x-red.svg?style=flat-square)](https://laravel.com/docs/9.x)
[![Laravel 10.x](https://img.shields.io/badge/Laravel-10.x-red.svg?style=flat-square)](http://laravel.com/docs/10.x)
[![Laravel 11.x](https://img.shields.io/badge/Laravel-11.x-red.svg?style=flat-square)](http://laravel.com/docs/11.x)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/ageekdev/laravel-barcode/run-tests.yml?style=flat-square)](https://github.com/ageekdev/laravel-barcode/actions/workflows/run-tests.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/ageekdev/laravel-barcode.svg?style=flat-square&logo=Packagist)](https://packagist.org/packages/ageekdev/laravel-barcode)

This package can generate SVG, PNG, JPG and HTML images from the most used 1D barcode standards. Here's how you can use it:

Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
}
],
"require": {
"php": "^8.1|^8.2",
"php": "^8.1",
"ext-bcmath": "*",
"illuminate/support": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0|^11.0",
"spatie/color": "^1.5"
},
"require-dev": {
"laravel/pint": "^1.10",
"nunomaduro/collision": "^6.0|^7.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^7.0|^8.0",
"larastan/larastan": "^2.0",
"orchestra/testbench": "^7.31|^8.11|^9.0",
"pestphp/pest": "^1.0|^2.0",
"pestphp/pest-plugin-laravel": "^1.4|^2.0",
"phpstan/extension-installer": "^1.1",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
beStrictAboutOutputDuringTests="true"
>
<testsuites>
<testsuite name="Genie Fintech Test Suite">
<testsuite name="Barcode Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/BarcodeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(Container $container)
/**
* Get a image type instance.
*/
public function imageType(string $name = null): ImageType
public function imageType(?string $name = null): ImageType
{
$name = $name ?: $this->getDefaultDriver();

Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
interface Factory
{
/**
* Get a image type implementation.
* Get image type implementation.
*/
public function imageType(string $name = null): ImageType;
public function imageType(?string $name = null): ImageType;
}
2 changes: 1 addition & 1 deletion src/Drivers/DynamicHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DynamicHTML extends AbstractGenerator
* Return an HTML representation of barcode.
* This 'dynamic' version uses percentage based widths and heights, resulting in a vector-y qualitative result.
*
* @param string $text code to print
* @param string $text code to print
*/
public function generate(string $text): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/PNG.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function useGd(): self
}

/**
* @param string $text code to print
* @param string $text code to print
*
* @throws \ImagickDrawException
* @throws \ImagickException
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/SVG.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SVG extends AbstractGenerator
/**
* Return SVG string representation of barcode.
*
* @param string $text code to print
* @param string $text code to print
*/
public function generate(string $text): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Types/TypeCode128.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public function getBarcodeData(string $code): Barcode
/**
* Split text code in A/B sequence for 128 code
*
* @param $code (string) code to split.
* @param $code (string) code to split.
*/
protected function get128ABsequence(string $code): array
{
Expand Down
4 changes: 2 additions & 2 deletions src/Types/TypeCode39.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getBarcodeData(string $code): Barcode
/**
* Encode a string to be used for CODE 39 Extended mode.
*
* @param string $code code to represent.
* @param string $code code to represent.
*
* @throws InvalidCharacterException
*/
Expand Down Expand Up @@ -268,7 +268,7 @@ protected function encode_code39_ext(string $code): string
/**
* Calculate CODE 39 checksum (modulo 43).
*
* @param string $code code to represent.
* @param string $code code to represent.
*/
protected function checksum_code39(string $code): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Types/TypeCode93.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function getBarcodeData(string $code): Barcode
/**
* Calculate CODE 93 checksum (modulo 47).
*
* @param $code (string) code to represent.
* @param $code (string) code to represent.
*/
protected function checksum_code93(string $code): string
{
Expand Down
12 changes: 6 additions & 6 deletions src/Types/TypeIntelligentMailBarcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function getBarcodeData(string $code): Barcode
* Convert large integer number to hexadecimal representation.
* (requires PHP bcmath extension)
*
* @param $number (string) number to convert specified as a string
* @param $number (string) number to convert specified as a string
*/
protected function dec_to_hex(string $number): string
{
Expand All @@ -436,7 +436,7 @@ protected function dec_to_hex(string $number): string
/**
* Intelligent Mail Barcode calculation of Frame Check Sequence
*
* @param $code_arr array of hexadecimal values (13 bytes holding 102 bits right justified).
* @param $code_arr array of hexadecimal values (13 bytes holding 102 bits right justified).
* @return int 11 bit Frame Check Sequence as integer (decimal base)
*/
protected function imb_crc11fcs(array $code_arr): int
Expand Down Expand Up @@ -475,7 +475,7 @@ protected function imb_crc11fcs(array $code_arr): int
* Convert large hexadecimal number to decimal representation (string).
* (requires PHP bcmath extension)
*
* @param $hex (string) hexadecimal number to convert specified as a string
* @param $hex (string) hexadecimal number to convert specified as a string
* @return int|string hexadecimal representation
*/
protected function hex_to_dec(string $hex): int|string
Expand All @@ -494,8 +494,8 @@ protected function hex_to_dec(string $hex): int|string
/**
* generate Nof13 tables used for Intelligent Mail Barcode
*
* @param $n (int) is the type of table: 2 for 2of13 table, 5 for 5of13table
* @param $size (int) size of table (78 for n=2 and 1287 for n=5)
* @param $n (int) is the type of table: 2 for 2of13 table, 5 for 5of13table
* @param $size (int) size of table (78 for n=2 and 1287 for n=5)
*/
protected function imb_tables(int $n, int $size): array
{
Expand Down Expand Up @@ -533,7 +533,7 @@ protected function imb_tables(int $n, int $size): array
/**
* Reverse unsigned short value
*
* @param $num (int) value to reverse
* @param $num (int) value to reverse
*/
protected function imb_reverse_us(int $num): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Types/TypeStandard2of5.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getBarcodeData(string $code): Barcode
/**
* Checksum for standard 2 of 5 barcodes.
*
* @param $code (string) code to process.
* @param $code (string) code to process.
* @return int checksum.
*/
protected function checksum_s25(string $code): int
Expand Down

0 comments on commit f182fd3

Please sign in to comment.