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

V4 #2

Merged
merged 53 commits into from
Mar 12, 2024
Merged

V4 #2

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
564ca92
wip
freekmurze Jan 14, 2022
3c131da
Update CHANGELOG
freekmurze Jan 14, 2022
824c267
Move orchestra/testbench to dev dependencies
Feb 3, 2022
acc091b
Merge pull request #17 from geidelguerra/patch-1
freekmurze Feb 3, 2022
cca2551
Update CHANGELOG
freekmurze Feb 3, 2022
e6cf5a0
Removed docblock from policy method
Xammie Feb 7, 2022
77f8aa1
Merge pull request #18 from Xammie/fix-policy
freekmurze Feb 7, 2022
e7e1ef2
Update CHANGELOG
freekmurze Feb 7, 2022
6840136
Add event stub
Feb 8, 2022
59fef89
Merge pull request #19 from geidelguerra/patch-1
freekmurze Feb 9, 2022
e862f8b
Update CHANGELOG
freekmurze Feb 9, 2022
d15b874
Add banner
AdrianMrn Mar 9, 2022
d87f81c
Change copy
AdrianMrn Mar 21, 2022
f84b7f6
Change copy
AdrianMrn Mar 21, 2022
57005eb
Use organisation-wide community health files
AdrianMrn Mar 21, 2022
53bebaf
Updated factory stub to use generics
Xammie Jul 20, 2022
206c50b
Merge pull request #21 from Xammie/patch-1
freekmurze Jul 29, 2022
aee341f
Update CHANGELOG
freekmurze Jul 29, 2022
9ff225d
Update request stub to use generics
Sparclex Aug 8, 2022
087f725
Merge pull request #24 from Sparclex/patch-1
freekmurze Aug 8, 2022
1c244e4
wip
freekmurze Sep 14, 2022
049798e
Update CHANGELOG
freekmurze Sep 14, 2022
2c60ecd
Update README.md
freekmurze Sep 18, 2022
0813d4b
install Pest
alexmanase Jan 6, 2023
ec3dfea
refactor: StubPublishCommandTest
alexmanase Jan 6, 2023
0836abd
replace test suite in Github action and `composer.json`
alexmanase Jan 6, 2023
c22b3dc
fix: composer.json
alexmanase Jan 6, 2023
f0b9f31
Merge pull request #26 from alexmanase/convert-all-tests-to-pest
freekmurze Jan 9, 2023
b6932f7
add comment
freekmurze Jan 15, 2023
dd61079
update stubs
freekmurze Jan 15, 2023
374397b
Update README.md
freekmurze Jan 15, 2023
3219a0a
Update CHANGELOG
freekmurze Jan 15, 2023
5037adf
wip
freekmurze Jan 23, 2023
66aecc1
Update CHANGELOG
freekmurze Jan 23, 2023
cc140ca
Update rule stub
Carnicero90 Dec 21, 2023
c3592fc
Merge pull request #27 from Carnicero90/main
freekmurze Dec 21, 2023
9526a29
Update CHANGELOG
freekmurze Dec 21, 2023
a5d1ce4
remove unnecessary dockblocks
mokhosh Feb 10, 2024
91747d6
Merge pull request #28 from mokhosh/remove-mail-docblocks
freekmurze Feb 10, 2024
12246d0
add laravel 11 support
mokhosh Feb 14, 2024
bac20af
Merge pull request #29 from mokhosh/add-laravel-11-support
freekmurze Feb 14, 2024
3969770
Update run-tests.yml
freekmurze Feb 14, 2024
4c5c620
Update CHANGELOG
freekmurze Feb 14, 2024
3ed09cb
remoce unnecessary docblock
mokhosh Feb 14, 2024
158c8d2
remove unused import
mokhosh Feb 14, 2024
460a6c0
remove unnecessary property override
mokhosh Feb 14, 2024
b0ad611
Merge pull request #32 from mokhosh/simplify-request-and-factory
freekmurze Feb 15, 2024
d270dc4
Update README.md
freekmurze Mar 8, 2024
c9a191c
L11 only
freekmurze Mar 8, 2024
67530ca
add L11 stubs
freekmurze Mar 8, 2024
fb2c868
Update CHANGELOG
freekmurze Mar 8, 2024
4e4b5df
Merge remote-tracking branch 'spatie/main' into v4
Jidbo Mar 12, 2024
1b3401b
Fix styling
Jidbo Mar 12, 2024
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
26 changes: 8 additions & 18 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
name: run-tests

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
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
os: [ ubuntu-latest, windows-latest ]
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 All @@ -38,8 +28,8 @@ jobs:

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

- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/pest
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