Skip to content

Commit

Permalink
chore: prep laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra committed Mar 17, 2024
1 parent 79e40a1 commit 67ee20b
Show file tree
Hide file tree
Showing 13 changed files with 214 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.0, 8.1]
php: [8.2, 8.3]
stability: [prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
Expand All @@ -39,7 +39,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
command: COMPOSER_ROOT_VERSION=dev-master composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/pest
2 changes: 1 addition & 1 deletion .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
#issue-comment: |
# This issue has been locked since it has been closed for more than 14 days.
issue-lock-reason: ""
process-only: "issues"
process-only: "issues"
20 changes: 20 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PHP Linting
on:
pull_request:
push:
branches:
- master
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "laravel-pint"
uses: aglipanci/laravel-pint-action@2.0.0
with:
preset: laravel
verboseMode: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "fix: pint"

5 changes: 3 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"
- cron: "0 0 * * *"

jobs:
close-issues:
Expand All @@ -12,10 +12,11 @@ jobs:
steps:
- uses: actions/stale@v5
with:
exempt-issue-labels: "bug,security,enhancement,pinned"
days-before-issue-stale: 30
days-before-issue-close: 7
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days."
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,33 @@ on:

jobs:
static-analysis-phpstan:

name: "Static Analysis with PHPStan"
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php-version:
- "8.1"
php: [8.2, 8.3]
stability: [prefer-stable]

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
- name: Checkout code
uses: actions/checkout@v2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
- name: Install dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: COMPOSER_ROOT_VERSION=dev-master composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan --error-format=checkstyle | cs2pr"
run: "vendor/bin/phpstan --error-format=table"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## UNRELEASED

- Added support for Laravel 11

## v10.0.0 - 2023-02-19

- Added support for Laravel 10
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ This package was based on the great package [Caffeinated/Shinobi](https://github
| 8.x and below | 6.x |
| 9.x | 9.x |
| 10.x | 10.x |
| 11.x | 11.x |

## Installation

Via Composer

``` bash
$ composer require yajra/laravel-acl
$ composer require yajra/laravel-acl:^11
```

## Configuration
Expand Down
132 changes: 77 additions & 55 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,80 @@
{
"name": "yajra/laravel-acl",
"description": "Laravel ACL is a simple role, permission ACL for Laravel Framework.",
"keywords": [
"yajra",
"laravel",
"acl",
"user",
"role",
"permissions"
],
"homepage": "https://github.com/yajra/laravel-acl",
"license": "MIT",
"authors": [
{
"name": "Arjay Angeles",
"email": "aqangeles@gmail.com",
"homepage": "https://yajrabox.com",
"role": "Developer"
}
],
"require": {
"illuminate/support": "^10.0",
"illuminate/database": "^10.0"
},
"require-dev": {
"nunomaduro/larastan": "^2.4",
"orchestra/testbench": "^8.0"
},
"autoload": {
"psr-4": {
"Yajra\\Acl\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Yajra\\Acl\\Tests\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "10.0-dev"
"name": "yajra/laravel-acl",
"description": "Laravel ACL is a simple role, permission ACL for Laravel Framework.",
"keywords": [
"yajra",
"laravel",
"acl",
"user",
"role",
"permissions"
],
"homepage": "https://github.com/yajra/laravel-acl",
"license": "MIT",
"authors": [
{
"name": "Arjay Angeles",
"email": "aqangeles@gmail.com",
"homepage": "https://yajrabox.com",
"role": "Developer"
}
],
"require": {
"illuminate/support": "^11.0",
"illuminate/database": "^11.0"
},
"laravel": {
"providers": [
"Yajra\\Acl\\AclServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
"require-dev": {
"larastan/larastan": "^2.9.1",
"laravel/pint": "^1.14",
"rector/rector": "^1.0",
"orchestra/testbench": "^9.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-laravel": "^2.3"
},
"autoload": {
"psr-4": {
"Yajra\\Acl\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Yajra\\Acl\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "11.x-dev"
},
"laravel": {
"providers": [
"Yajra\\Acl\\AclServiceProvider"
]
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": "./vendor/bin/pest",
"pint": "./vendor/bin/pint",
"rector": "./vendor/bin/rector",
"stan": "./vendor/bin/phpstan analyse --memory-limit=2G --ansi --no-progress --no-interaction --configuration=phpstan.neon.dist",
"pr": [
"@rector",
"@pint",
"@stan",
"@test"
]
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/yajra"
}
]
}
9 changes: 2 additions & 7 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./vendor/larastan/larastan/extension.neon

parameters:

Expand All @@ -9,12 +9,7 @@ parameters:
level: max

ignoreErrors:
- '#Cannot call method load\(\) on Illuminate\\Foundation\\Auth\\User\|null.#'
- '#Cannot call method canAtLeast\(\) on Illuminate\\Foundation\\Auth\\User\|null.#'
- '#Call to an undefined method Illuminate\\Foundation\\Auth\\User\:\:hasRole\(\).#'

excludePaths:

checkMissingIterableValueType: false

checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: true
22 changes: 13 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?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">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<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/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="ACL Test Suite">
<directory suffix="Test.php">./tests/</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
3 changes: 3 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "laravel"
}
22 changes: 22 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
]);
};
Loading

0 comments on commit 67ee20b

Please sign in to comment.