diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5d4a3bf..994d016 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index e140b29..2bc41dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b4ae1c4..3d244da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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**! diff --git a/composer.json b/composer.json index 9c95cfa..0ee7486 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -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": { diff --git a/stubs/cast.inbound.stub b/stubs/cast.inbound.stub new file mode 100644 index 0000000..e2425f3 --- /dev/null +++ b/stubs/cast.inbound.stub @@ -0,0 +1,14 @@ + + */ + public function attachments(): array + { + return []; + } +} diff --git a/stubs/markdown-notification.stub b/stubs/markdown-notification.stub new file mode 100644 index 0000000..cec12db --- /dev/null +++ b/stubs/markdown-notification.stub @@ -0,0 +1,35 @@ +markdown('{{ view }}'); + } + + public function toArray(object $notifiable): array + { + return [ + // + ]; + } +} diff --git a/stubs/notification.stub b/stubs/notification.stub index cd4ebd1..4cf386b 100644 --- a/stubs/notification.stub +++ b/stubs/notification.stub @@ -16,12 +16,12 @@ class {{ class }} extends Notification ) { } - public function via($notifiable): array + public function via(object $notifiable): array { return ['mail']; } - public function toMail($notifiable): MailMessage + public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') @@ -29,7 +29,7 @@ class {{ class }} extends Notification ->line('Thank you for using our application!'); } - public function toArray($notifiable): array + public function toArray(object $notifiable): array { return [ // diff --git a/stubs/observer.plain.stub b/stubs/observer.plain.stub new file mode 100644 index 0000000..e2506b7 --- /dev/null +++ b/stubs/observer.plain.stub @@ -0,0 +1,8 @@ +in('.'); diff --git a/tests/StubPublishCommandTest.php b/tests/StubPublishCommandTest.php index c300a02..9cc0c91 100644 --- a/tests/StubPublishCommandTest.php +++ b/tests/StubPublishCommandTest.php @@ -1,24 +1,19 @@ app->basePath('stubs'); +use function PHPUnit\Framework\assertFileEquals; + +it('can publish stubs', function () { + $targetStubsPath = $this->app->basePath('stubs'); - File::deleteDirectory($targetStubsPath); + File::deleteDirectory($targetStubsPath); - $this->artisan('spatie-stub:publish')->assertExitCode(0); + $this->artisan('spatie-stub:publish')->assertExitCode(0); - $stubPath = __DIR__ . '/../stubs/migration.stub'; + $stubPath = __DIR__ . '/../stubs/migration.stub'; - $publishedStubPath = $targetStubsPath . '/migration.stub'; + $publishedStubPath = $targetStubsPath . '/migration.stub'; - $this->assertFileEquals($stubPath, $publishedStubPath); - } -} + assertFileEquals($stubPath, $publishedStubPath); +});