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: drop support for Laravel 10 #62

Merged
merged 1 commit into from
Mar 13, 2025
Merged
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
37 changes: 18 additions & 19 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# https://git-scm.com/docs/gitattributes
* text=auto

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/phpcs.xml export-ignore
/.php_cs.dist.php export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
/UPGRADING.md export-ignore
/phpstan.neon.dist export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
/UPGRADING.md export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/renovate.json export-ignore
/docker-compose.yml export-ignore
/docker export-ignore
/docker export-ignore
/docker-compose.yml export-ignore
26 changes: 0 additions & 26 deletions .github/workflows/phpstan.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Static Analysis

on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: composer test:types

ecs:
name: ECS

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install Dependencies
run: composer update --prefer-dist --no-interaction --no-progress --ansi

- name: Run ECS
run: composer test:style
17 changes: 6 additions & 11 deletions .github/workflows/run-tests.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ on:
jobs:
test:
runs-on: ${{ matrix.os }}
env:
PREVENT_OUTPUT: true
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.3, 8.4]
laravel: [10.*, 11.*, 12.*]
os: [ubuntu-latest]
php: [8.4, 8.3]
laravel: [12.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -36,7 +32,6 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
Expand Down
18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.idea
/.idea
/build
/vendor
/.php_cs.cache
/composer.lock
/phpunit.xml
/phpstan.neon
.php_cs
.php_cs.cache
.phpunit.result.cache
.phpunit.cache
build
composer.lock
.php-cs-fixer.cache
coverage
docs
phpunit.xml
phpstan.neon
testbench.yaml
vendor
node_modules
.php-cs-fixer.cache
testbench.yaml
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
}
],
"require": {
"php": "^8.2",
"illuminate/contracts": "^10.0 || ^11.0 || ^12.0"
"php": "^8.3",
"illuminate/contracts": "^11.0 || ^12.0"
},
"require-dev": {
"larastan/larastan": "^2.8 || ^3.0",
"nunomaduro/collision": "^7.0 || ^8.0",
"orchestra/testbench": "^8.20 || ^9.0 || ^10.0",
"pestphp/pest": "^2.30 || ^3.0",
"pestphp/pest-plugin-laravel": "^2.2 || ^3.0",
"worksome/coding-style": "^2.15 || ^3.1"
"larastan/larastan": "^3.1",
"nunomaduro/collision": "^7.10 || ^8.1.1",
"orchestra/testbench": "^9.12 || ^10.1",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-laravel": "^3.1",
"worksome/coding-style": "^3.2"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
php:
build: ./docker
Expand All @@ -8,11 +6,6 @@ services:
environment:
- XDEBUG_MODE=${XDEBUG_MODE:-off}
- XDEBUG_CONFIG=${XDEBUG_CONFIG:-client_host=host.docker.internal}
pest:
build: ./docker
entrypoint: ["php", "./vendor/bin/pest"]
volumes:
- .:/var/www/html
composer:
build: ./docker
entrypoint: ["composer"]
Expand Down
12 changes: 2 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
FROM php:8.2-cli
FROM php:8.3-cli-alpine

RUN apk add --no-cache $PHPIZE_DEPS linux-headers
RUN pecl install xdebug

RUN apt-get update \
&& apt-get install -y libpng-dev libjpeg-dev libzip-dev zip

RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-install gd

RUN docker-php-ext-install zip

RUN docker-php-ext-enable xdebug

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
Expand Down
46 changes: 32 additions & 14 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
parameters:
ignoreErrors:
-
message: '#^PHP files should declare strict types\.$#'
identifier: worksome.declareStrictTypes
count: 1
path: config/request-factories.php

-
message: '#^Method Worksome\\RequestFactories\\Actions\\CreateFactoryResultSteps\\InvokeAfterCreatingHooks\:\:handle\(\) has parameter \$data with generic class Illuminate\\Support\\Collection but does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
Expand All @@ -18,12 +24,6 @@ parameters:
count: 1
path: src/Actions/CreateFactoryResultSteps/InvokeAfterCreatingHooks.php

-
message: '#^Parameter \#1 \$callback of method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:reduce\(\) expects callable\(mixed, mixed, int\|string\)\: mixed, Closure\(mixed, Closure\)\: mixed given\.$#'
identifier: argument.type
count: 1
path: src/Actions/CreateFactoryResultSteps/InvokeAfterCreatingHooks.php

-
message: '#^Method Worksome\\RequestFactories\\Actions\\CreateFactoryResultSteps\\RecursiveStep\:\:handle\(\) has parameter \$data with generic class Illuminate\\Support\\Collection but does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
Expand Down Expand Up @@ -139,19 +139,37 @@ parameters:
path: src/Contracts/Actions/CreateFactoryResultStep.php

-
message: '#^Method Worksome\\RequestFactories\\RequestFactory\:\:getUndotsArrayKeysAction\(\) return type with generic interface Worksome\\RequestFactories\\Contracts\\Actions\\UndotsArrayKeys does not specify its types\: TValue$#'
identifier: missingType.generics
message: '#^Call to an undefined static method Worksome\\RequestFactories\\RequestFactoriesServiceProvider\:\:factory\(\)\.$#'
identifier: staticMethod.notFound
count: 1
path: src/RequestFactory.php
path: src/RequestFactoriesServiceProvider.php

-
message: '#^Parameter \#2 \$without of class Worksome\\RequestFactories\\RequestFactory constructor expects array\<int, string\>, array given\.$#'
identifier: argument.type
message: '#^Cannot access offset ''events'' on Illuminate\\Contracts\\Foundation\\Application\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/RequestFactory.php
path: src/RequestFactoriesServiceProvider.php

-
message: '#^Parameter \#3 \$afterCreatingHooks of class Worksome\\RequestFactories\\RequestFactory constructor expects array\<\(Closure\(array\)\: array\)\|void\>, array given\.$#'
identifier: argument.type
message: '#^Global helper function ''app'' should not be used\.$#'
identifier: larastanStrictRules.noGlobalLaravelFunction
count: 1
path: src/RequestFactoriesServiceProvider.php

-
message: '#^Global helper function ''config_path'' should not be used\.$#'
identifier: larastanStrictRules.noGlobalLaravelFunction
count: 1
path: src/RequestFactoriesServiceProvider.php

-
message: '#^Parameter \#2 \$macro of static method Illuminate\\Http\\Request\:\:macro\(\) expects bindable closure, static closure given\.$#'
identifier: argument.staticClosure
count: 2
path: src/RequestFactoriesServiceProvider.php

-
message: '#^Method Worksome\\RequestFactories\\RequestFactory\:\:getUndotsArrayKeysAction\(\) return type with generic interface Worksome\\RequestFactories\\Contracts\\Actions\\UndotsArrayKeys does not specify its types\: TValue$#'
identifier: missingType.generics
count: 1
path: src/RequestFactory.php
11 changes: 8 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ includes:
- phpstan-baseline.neon

parameters:
level: max
level: 8
paths:
- src
excludePaths:
- src/RequestFactoriesServiceProvider.php
- config
tmpDir: build/phpstan
checkModelProperties: true
parallel:
processTimeout: 300.0

ignoreErrors:
-
identifier: larastan.noEnvCallsOutsideOfConfig
path: config
reportUnmatched: false
23 changes: 17 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Worksome Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions src/Support/ConfigBasedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public function requestFactoriesLocation(string $name = ''): string

public function requestFactoriesNamespace(): string
{
return strval($this->config['namespace'] ?? 'Tests\\RequestFactories'); // @phpstan-ignore argument.type
return strval($this->config['namespace'] ?? 'Tests\\RequestFactories');
}

private function getName(): string
{
return strval($this->config['path'] ?? 'tests/RequestFactories'); // @phpstan-ignore argument.type
return strval($this->config['path'] ?? 'tests/RequestFactories');
}

private function withCorrectSeparator(string $path): string
Expand Down