Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Laravel 12.x Compatibility #63

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: CI

on:
push:
pull_request:

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
laravel: [11.*, 10.*, 9.*]
laravel: ['9.*', '10.*', '11.*', '12.*']
dependency-version: [prefer-stable]
include:
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
Expand All @@ -21,42 +26,55 @@ jobs:
exclude:
- laravel: 11.*
php: 8.1
- laravel: 12.*
php: 8.1

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

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, xdebug
coverage: xdebug

- name: Report PHP version
run: php -v

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-

- name: Install Composer dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Check quality code
env:
PHP_CS_FIXER_IGNORE_ENV: 1
PHP_CS_FIXER_IGNORE_ENV: 1
run: vendor/bin/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose

- name: Execute phpstan
run: vendor/bin/phpstan

- name: Execute tests
run: vendor/bin/phpunit --coverage-clover ./build/coverage.clover

- name: Uploading code coverage to scrutinize
uses: sudo-bot/action-scrutinizer@latest
with:
cli-args: "--format=php-clover build/coverage.clover"
cli-args: --format=php-clover build/coverage.clover
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ composer.lock
docs
vendor
coverage
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
.php-cs-fixer.cache
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.4",
"illuminate/support": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0|^12.0",
"openfoodfacts/openfoodfacts-php": "^0.3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.9.5",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.5.21|^10.5"
"larastan/larastan": "^2.9|^3.1",
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
"phpstan/phpstan": "^1.10|^2.1",
"phpstan/phpstan-phpunit": "^1.3|^2.0",
"phpunit/phpunit": "^9.5.21|^10.5|^11.5.3"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ includes:

parameters:
level: 9
reportUnmatchedIgnoredErrors: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be removed when phpstan 1.* is updated to 2.*

paths:
- src
- tests
ignoreErrors:
- identifier: method.alreadyNarrowedType
- identifier: missingType.iterableValue
-
message: "#^Cannot access offset '[a-z.]+' on Illuminate\\\\Contracts\\\\Container\\\\Container.$#"
Expand Down
10 changes: 6 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage" lowUpperBound="35" highLowerBound="70"/>
Expand All @@ -18,4 +15,9 @@
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
Comment on lines +18 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update of the configuration to phpunit (from 9 to 11)

</phpunit>
2 changes: 1 addition & 1 deletion src/Facades/OpenBeautyFacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* @method static array barcode(string $value)
* @method static \Illuminate\Support\Collection find(string $searchTerm)
* @method static \Illuminate\Support\Collection<int, array> find(string $searchTerm)
* @method static \OpenFoodFacts\Document getProduct(string $barcode)
*
* @see \OpenFoodFacts\Laravel\OpenFoodFacts
Expand Down
2 changes: 1 addition & 1 deletion src/Facades/OpenFoodFacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* @method static array barcode(string $value)
* @method static \Illuminate\Support\Collection find(string $searchTerm)
* @method static \Illuminate\Support\Collection<int, array> find(string $searchTerm)
* @method static \OpenFoodFacts\Document getProduct(string $barcode)
*
* @see \OpenFoodFacts\Laravel\OpenFoodFacts
Expand Down
2 changes: 1 addition & 1 deletion src/Facades/OpenPetFoodFacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* @method static array barcode(string $value)
* @method static \Illuminate\Support\Collection find(string $searchTerm)
* @method static \Illuminate\Support\Collection<int, array> find(string $searchTerm)
* @method static \OpenFoodFacts\Document getProduct(string $barcode)
*
* @see \OpenFoodFacts\Laravel\OpenFoodFacts
Expand Down
Loading