Skip to content

Commit

Permalink
Merge remote-tracking branch 'spatie/main' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jidbo committed Mar 12, 2024
2 parents 2f13fdd + fb2c868 commit 433f651
Show file tree
Hide file tree
Showing 25 changed files with 519 additions and 49 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,15 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1, 8.0]
laravel: [10.*, 9.*, 8.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: ^6.23
exclude:
- laravel: 10.*
php: 8.0
php: [8.3, 8.2]
laravel: [11.*]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,103 @@

All notable changes to `laravel-stubs` will be documented in this file

## 3.0.0 - 2024-03-08

### What's Changed

* Add L11 stubs
* Simplify request and factory by @mokhosh in https://github.com/spatie/laravel-stubs/pull/32

## 2.5.4 - 2024-02-14

### What's Changed

* remove unnecessary dockblocks by @mokhosh in https://github.com/spatie/laravel-stubs/pull/28
* add laravel 11 support by @mokhosh in https://github.com/spatie/laravel-stubs/pull/29

### New Contributors

* @mokhosh made their first contribution in https://github.com/spatie/laravel-stubs/pull/28

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.3...2.5.4

## 2.5.3 - 2023-12-21

### What's Changed

* Update rule stub by @Carnicero90 in https://github.com/spatie/laravel-stubs/pull/27

### New Contributors

* @Carnicero90 made their first contribution in https://github.com/spatie/laravel-stubs/pull/27

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.2...2.5.3

## 2.5.2 - 2023-01-23

- support L10

## 2.5.1 - 2023-01-15

### What's Changed

- Polish stubs (by @freekmurze)
- Convert all tests to pest by @alexmanase in https://github.com/spatie/laravel-stubs/pull/26

### New Contributors

- @alexmanase made their first contribution in https://github.com/spatie/laravel-stubs/pull/26

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.0...2.5.1

## 2.5.0 - 2022-09-14

- use invokable rule by default

## 2.4.4 - 2022-07-29

### What's Changed

- Updated factory stub to use generics by @Xammie in https://github.com/spatie/laravel-stubs/pull/21

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.3...2.4.4

## 2.4.3 - 2022-02-09

## What's Changed

- Add event stub by @geidelguerra in https://github.com/spatie/laravel-stubs/pull/19

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.2...2.4.3

## 2.4.2 - 2022-02-07

## What's Changed

- Remove docblock from policy method by @Xammie in https://github.com/spatie/laravel-stubs/pull/18

## New Contributors

- @Xammie made their first contribution in https://github.com/spatie/laravel-stubs/pull/18

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.1...2.4.2

## 2.4.1 - 2022-02-03

## What's Changed

- Move orchestra/testbench to dev dependencies by @geidelguerra in https://github.com/spatie/laravel-stubs/pull/17

## New Contributors

- @geidelguerra made their first contribution in https://github.com/spatie/laravel-stubs/pull/17

**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.0...2.4.1

## 2.4.0 - 2022-01-14

- support Laravel 9

## 2.3.1 - 2021-12-01

## What's Changed
Expand Down
18 changes: 13 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Please be considerate towards maintainers when raising issues or presenting pull
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the
maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

Expand All @@ -40,16 +41,23 @@ Before submitting a pull request:

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
** - The easiest way to apply the conventions is to
install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept
up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs
is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make
multiple intermediate commits while developing,
please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages)
before submitting.

**Happy coding**!
19 changes: 11 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
}
],
"require": {
"php": "^8.0",
"laravel/framework": "^8.71|^9.0|^10.0",
"orchestra/testbench": "^6.24|^7.0|^8.0"
"php": "^8.2",
"laravel/framework": "^11.0"
},
"require-dev": {
"phpunit/phpunit": "^9.4",
"mockery/mockery": "^1.4"
"mockery/mockery": "^1.4",
"orchestra/testbench": "^9.0",
"pestphp/pest": "^2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -42,11 +42,14 @@
},
"scripts": {
"format": "vendor/bin/php-cs-fixer fix",
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage-html coverage"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
Expand Down
14 changes: 14 additions & 0 deletions stubs/cast.inbound.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;

class {{ class }} implements CastsInboundAttributes
{
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
19 changes: 19 additions & 0 deletions stubs/cast.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class {{ class }} implements CastsAttributes
{
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}

public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
11 changes: 11 additions & 0 deletions stubs/class.invokable.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace {{ namespace }};

class {{ class }}
{
public function __invoke(): void
{

}
}
8 changes: 8 additions & 0 deletions stubs/class.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

class {{ class }}
{

}
30 changes: 30 additions & 0 deletions stubs/controller.nested.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
40 changes: 40 additions & 0 deletions stubs/controller.nested.singleton.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function create({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function edit({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
29 changes: 29 additions & 0 deletions stubs/controller.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace {{ namespace }};

use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;

class {{ class }} extends Controller
{
public function store(Request $request): never
{
abort(404);
}

public function show()
{
//
}

public function update(Request $request)
{
//
}

public function destroy(): never
{
abort(404);
}
}
Loading

0 comments on commit 433f651

Please sign in to comment.