Skip to content

Commit 4e4b5df

Browse files
committed
Merge remote-tracking branch 'spatie/main' into v4
2 parents 2f13fdd + fb2c868 commit 4e4b5df

26 files changed

+525
-55
lines changed

.github/workflows/run-tests.yml

+8-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
test:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
fail-fast: true
1010
matrix:
11-
os: [ubuntu-latest, windows-latest]
12-
php: [8.2, 8.1, 8.0]
13-
laravel: [10.*, 9.*, 8.*]
14-
dependency-version: [prefer-lowest, prefer-stable]
15-
include:
16-
- laravel: 10.*
17-
testbench: 8.*
18-
- laravel: 9.*
19-
testbench: 7.*
20-
- laravel: 8.*
21-
testbench: ^6.23
22-
exclude:
23-
- laravel: 10.*
24-
php: 8.0
11+
os: [ ubuntu-latest, windows-latest ]
12+
php: [ 8.3, 8.2 ]
13+
laravel: [ 11.* ]
14+
dependency-version: [ prefer-stable ]
2515

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

2818
steps:
2919
- name: Checkout code
30-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
3121

3222
- name: Setup PHP
3323
uses: shivammathur/setup-php@v2
@@ -38,8 +28,8 @@ jobs:
3828

3929
- name: Install dependencies
4030
run: |
41-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
31+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
4232
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
4333
4434
- name: Execute tests
45-
run: vendor/bin/phpunit
35+
run: vendor/bin/pest

CHANGELOG.md

+97
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,103 @@
22

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

5+
## 3.0.0 - 2024-03-08
6+
7+
### What's Changed
8+
9+
* Add L11 stubs
10+
* Simplify request and factory by @mokhosh in https://github.com/spatie/laravel-stubs/pull/32
11+
12+
## 2.5.4 - 2024-02-14
13+
14+
### What's Changed
15+
16+
* remove unnecessary dockblocks by @mokhosh in https://github.com/spatie/laravel-stubs/pull/28
17+
* add laravel 11 support by @mokhosh in https://github.com/spatie/laravel-stubs/pull/29
18+
19+
### New Contributors
20+
21+
* @mokhosh made their first contribution in https://github.com/spatie/laravel-stubs/pull/28
22+
23+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.3...2.5.4
24+
25+
## 2.5.3 - 2023-12-21
26+
27+
### What's Changed
28+
29+
* Update rule stub by @Carnicero90 in https://github.com/spatie/laravel-stubs/pull/27
30+
31+
### New Contributors
32+
33+
* @Carnicero90 made their first contribution in https://github.com/spatie/laravel-stubs/pull/27
34+
35+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.2...2.5.3
36+
37+
## 2.5.2 - 2023-01-23
38+
39+
- support L10
40+
41+
## 2.5.1 - 2023-01-15
42+
43+
### What's Changed
44+
45+
- Polish stubs (by @freekmurze)
46+
- Convert all tests to pest by @alexmanase in https://github.com/spatie/laravel-stubs/pull/26
47+
48+
### New Contributors
49+
50+
- @alexmanase made their first contribution in https://github.com/spatie/laravel-stubs/pull/26
51+
52+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.5.0...2.5.1
53+
54+
## 2.5.0 - 2022-09-14
55+
56+
- use invokable rule by default
57+
58+
## 2.4.4 - 2022-07-29
59+
60+
### What's Changed
61+
62+
- Updated factory stub to use generics by @Xammie in https://github.com/spatie/laravel-stubs/pull/21
63+
64+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.3...2.4.4
65+
66+
## 2.4.3 - 2022-02-09
67+
68+
## What's Changed
69+
70+
- Add event stub by @geidelguerra in https://github.com/spatie/laravel-stubs/pull/19
71+
72+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.2...2.4.3
73+
74+
## 2.4.2 - 2022-02-07
75+
76+
## What's Changed
77+
78+
- Remove docblock from policy method by @Xammie in https://github.com/spatie/laravel-stubs/pull/18
79+
80+
## New Contributors
81+
82+
- @Xammie made their first contribution in https://github.com/spatie/laravel-stubs/pull/18
83+
84+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.1...2.4.2
85+
86+
## 2.4.1 - 2022-02-03
87+
88+
## What's Changed
89+
90+
- Move orchestra/testbench to dev dependencies by @geidelguerra in https://github.com/spatie/laravel-stubs/pull/17
91+
92+
## New Contributors
93+
94+
- @geidelguerra made their first contribution in https://github.com/spatie/laravel-stubs/pull/17
95+
96+
**Full Changelog**: https://github.com/spatie/laravel-stubs/compare/2.4.0...2.4.1
97+
98+
## 2.4.0 - 2022-01-14
99+
100+
- support Laravel 9
101+
5102
## 2.3.1 - 2021-12-01
6103

7104
## What's Changed

CONTRIBUTING.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Please be considerate towards maintainers when raising issues or presenting pull
1414
world that developers are civilized and selfless people.
1515

1616
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17-
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.
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the
18+
maintainer's decision, and do not be upset or abusive if your submission is not used.
1819

1920
## Viability
2021

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

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

43-
- **[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).
44+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
45+
** - The easiest way to apply the conventions is to
46+
install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
4447

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

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

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

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

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

5563
**Happy coding**!

composer.json

+11-8
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
}
2323
],
2424
"require": {
25-
"php": "^8.0",
26-
"laravel/framework": "^8.71|^9.0|^10.0",
27-
"orchestra/testbench": "^6.24|^7.0|^8.0"
25+
"php": "^8.2",
26+
"laravel/framework": "^11.0"
2827
},
2928
"require-dev": {
30-
"phpunit/phpunit": "^9.4",
31-
"mockery/mockery": "^1.4"
29+
"mockery/mockery": "^1.4",
30+
"orchestra/testbench": "^9.0",
31+
"pestphp/pest": "^2.0"
3232
},
3333
"autoload": {
3434
"psr-4": {
@@ -42,11 +42,14 @@
4242
},
4343
"scripts": {
4444
"format": "vendor/bin/php-cs-fixer fix",
45-
"test": "vendor/bin/phpunit",
46-
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
45+
"test": "vendor/bin/pest",
46+
"test-coverage": "vendor/bin/pest --coverage-html coverage"
4747
},
4848
"config": {
49-
"sort-packages": true
49+
"sort-packages": true,
50+
"allow-plugins": {
51+
"pestphp/pest-plugin": true
52+
}
5053
},
5154
"extra": {
5255
"laravel": {

stubs/cast.inbound.stub

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;
7+
8+
class {{ class }} implements CastsInboundAttributes
9+
{
10+
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
11+
{
12+
return $value;
13+
}
14+
}

stubs/cast.stub

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
7+
8+
class {{ class }} implements CastsAttributes
9+
{
10+
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
11+
{
12+
return $value;
13+
}
14+
15+
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
16+
{
17+
return $value;
18+
}
19+
}

stubs/class.invokable.stub

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
class {{ class }}
6+
{
7+
public function __invoke(): void
8+
{
9+
10+
}
11+
}

stubs/class.stub

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
class {{ class }}
6+
{
7+
8+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ namespacedModel }};
6+
use Illuminate\Http\Request;
7+
use {{ namespacedParentModel }};
8+
9+
class {{ class }}
10+
{
11+
public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
12+
{
13+
abort(404);
14+
}
15+
16+
public function show({{ parentModel }} ${{ parentModelVariable }})
17+
{
18+
//
19+
}
20+
21+
public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
22+
{
23+
//
24+
}
25+
26+
public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
27+
{
28+
abort(404);
29+
}
30+
}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ namespacedModel }};
6+
use Illuminate\Http\Request;
7+
use {{ namespacedParentModel }};
8+
9+
class {{ class }}
10+
{
11+
public function create({{ parentModel }} ${{ parentModelVariable }}): never
12+
{
13+
abort(404);
14+
}
15+
16+
public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
17+
{
18+
abort(404);
19+
}
20+
21+
public function show({{ parentModel }} ${{ parentModelVariable }})
22+
{
23+
//
24+
}
25+
26+
public function edit({{ parentModel }} ${{ parentModelVariable }})
27+
{
28+
//
29+
}
30+
31+
public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
32+
{
33+
//
34+
}
35+
36+
public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
37+
{
38+
abort(404);
39+
}
40+
}

stubs/controller.singleton.api.stub

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use {{ rootNamespace }}Http\Controllers\Controller;
6+
use Illuminate\Http\Request;
7+
8+
class {{ class }} extends Controller
9+
{
10+
public function store(Request $request): never
11+
{
12+
abort(404);
13+
}
14+
15+
public function show()
16+
{
17+
//
18+
}
19+
20+
public function update(Request $request)
21+
{
22+
//
23+
}
24+
25+
public function destroy(): never
26+
{
27+
abort(404);
28+
}
29+
}

0 commit comments

Comments
 (0)