From fa73c5b490680461c2200965a6ece99e2208c9dc Mon Sep 17 00:00:00 2001 From: tm <107902074+mp-31@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:58:40 +0900 Subject: [PATCH 1/6] Modify branch name in README.md (#72) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ea3d981..711b55b 100644 --- a/README.md +++ b/README.md @@ -1003,7 +1003,7 @@ Contributing ------------ **Documentation:** If you think the documentation can be improved in any way, please do -[edit this file](https://github.com/diglactic/laravel-breadcrumbs/edit/master/README.md) and make a pull request. +[edit this file](https://github.com/diglactic/laravel-breadcrumbs/edit/main/README.md) and make a pull request. **Bug fixes:** Please fix it and open a [pull request](https://github.com/diglactic/laravel-breadcrumbs/pulls). ([See below](#creating-a-pull-request) for more detailed instructions.) Bonus points if you add a unit test to make sure @@ -1025,11 +1025,11 @@ rm -rf vendor/diglactic/laravel-breadcrumbs composer install --prefer-source ``` -Then checkout the master branch and create your own local branch to work on: +Then checkout the main branch and create your own local branch to work on: ```bash cd vendor/diglactic/laravel-breadcrumbs -git checkout -t origin/master +git checkout -t origin/main git checkout -b YOUR_BRANCH ``` From cdcb7cc46226fa9c4b6992025f54b89163b01895 Mon Sep 17 00:00:00 2001 From: Sheng-Liang Slogar <4350009+shengslogar@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:19:24 -0600 Subject: [PATCH 2/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 711b55b..cfd6083 100644 --- a/README.md +++ b/README.md @@ -399,8 +399,8 @@ Or with a parameter: Structured Data --------------- -To render breadcrumbs as JSON-LD [structured data](https://developers.google.com/search/docs/data-types/breadcrumbs) ( -usually for SEO reasons), use `Breadcrumbs::view()` to render the `breadcrumbs::json-ld` template in addition to the +To render breadcrumbs as JSON-LD [structured data](https://developers.google.com/search/docs/data-types/breadcrumbs) +(usually for SEO reasons), use `Breadcrumbs::view()` to render the `breadcrumbs::json-ld` template in addition to the normal one. For example: ```blade From 48c89b975d98e68951284030dad422190ba60989 Mon Sep 17 00:00:00 2001 From: Sheng-Liang Slogar <4350009+shengslogar@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:52:22 -0600 Subject: [PATCH 3/6] Exclude .github/ from releases --- .gitattributes | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 39083ab..1ce6343 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,17 +1,15 @@ -# Exclude development files from exported zip files -# To test this, commit the changes then run: -# scripts/list-production-files.sh +# Exclude development files from exported ZIP files /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore +/.github export-ignore /*.md export-ignore /*.svg export-ignore /*.xml export-ignore /*.yml export-ignore -/scripts/ export-ignore /tests/ export-ignore # Ensure the correct line endings are used in tests on Windows From 1d2a6797311c1ac06e1b0d9030685a2850a4ffa3 Mon Sep 17 00:00:00 2001 From: Samuel Date: Sun, 3 Mar 2024 06:54:45 +0100 Subject: [PATCH 4/6] Update Laravel links to version 10.x (#79) --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cfd6083..1b1a46a 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { }); ``` -The `$post` object (probably an Eloquent [Model](https://laravel.com/api/8.x/Illuminate/Database/Eloquent/Model.html), +The `$post` object (probably an Eloquent [Model](https://laravel.com/api/10.x/Illuminate/Database/Eloquent/Model.html), but could be anything) would be passed in from the view: ```blade @@ -348,7 +348,7 @@ you to make edits directly. #### View data -The view will receive a [Collection](https://laravel.com/api/8.x/Illuminate/Support/Collection.html) +The view will receive a [Collection](https://laravel.com/api/10.x/Illuminate/Support/Collection.html) called `$breadcrumbs`. Each breadcrumb is an [object](https://www.php.net/manual/en/language.types.object.php) with the following keys: @@ -460,7 +460,7 @@ Route::name('home')->get('/', 'HomeController@index'); Route::name('post')->get('/post/{id}', 'PostController@show'); ``` -For more details, see [Named Routes](https://laravel.com/docs/8.x/routing#named-routes) in the Laravel documentation. +For more details, see [Named Routes](https://laravel.com/docs/10.x/routing#named-routes) in the Laravel documentation. ### Name your breadcrumbs to match @@ -485,7 +485,7 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { }); ``` -To add breadcrumbs to a [custom 404 Not Found page](https://laravel.com/docs/8.x/errors#custom-http-error-pages), use +To add breadcrumbs to a [custom 404 Not Found page](https://laravel.com/docs/10.x/errors#custom-http-error-pages), use the name `errors.404`: ```php @@ -576,7 +576,7 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { // <-- This makes your code less verbose and more efficient by only loading the post from the database once. -For more details see [Route Model Binding](https://laravel.com/docs/8.x/routing#route-model-binding) in the Laravel +For more details see [Route Model Binding](https://laravel.com/docs/10.x/routing#route-model-binding) in the Laravel documentation. ### Resourceful controllers @@ -641,7 +641,7 @@ Breadcrumbs::for('photo.edit', function (BreadcrumbTrail $trail, Photo $photo) { }); ``` -For more details see [Resource Controllers](https://laravel.com/docs/8.x/controllers#resource-controllers) in the +For more details see [Resource Controllers](https://laravel.com/docs/10.x/controllers#resource-controllers) in the Laravel documentation. (Related FAQ: [Why is there no Breadcrumbs::resource() method?](#why-is-there-no-breadcrumbsresource-method).) @@ -742,7 +742,7 @@ Breadcrumbs::after(function (BreadcrumbTrail $trail) { ``` For more advanced filtering, use `Breadcrumbs::generate()` and Laravel's -[Collection class](https://laravel.com/api/8.x/Illuminate/Support/Collection.html) methods instead: +[Collection class](https://laravel.com/api/10.x/Illuminate/Support/Collection.html) methods instead: ```php Date: Sun, 3 Mar 2024 00:02:44 -0600 Subject: [PATCH 5/6] Update README - Reformat - Include instructions to keep laravel.com links up-to-date --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1b1a46a..e2caa65 100644 --- a/README.md +++ b/README.md @@ -912,9 +912,9 @@ FAQ ### Why is there no `Breadcrumbs::resource()` method? A few people have suggested adding `Breadcrumbs::resource()` to match -[`Route::resource()`](https://laravel.com/docs/10.x/controllers#resource-controllers), but no one has come up with a good -implementation that a) is flexible enough to deal with translations, nested resources, etc., and b) isn't overly complex -as a result. +[`Route::resource()`](https://laravel.com/docs/10.x/controllers#resource-controllers), but no one has come up with a +good implementation that a) is flexible enough to deal with translations, nested resources, etc., and b) isn't overly +complex as a result. You can always create your own using `Breadcrumbs::macro()`. Here's a good starting point: @@ -1110,10 +1110,14 @@ The following files will need to be updated to run tests against a new Laravel v - `jobs.phpunit.strategy.matrix.php` (PHP versions) - `jobs.phpunit.strategy.matrix.exclude` (Unsupported combinations) -If changes are required, also update: +And the following documentation, as needed: - [`README.md`](README.md) - [Compatibility Chart](#compatibility-chart) + - All links to `https://laravel.com/docs/*` and `https://laravel.com/api/*` + +- [`UPGRADE.md`](UPGRADE.md) + - Add new section detailing any breaking package changes License ------- From 88e8f01e013e811215770e27b40a74014c28f2c4 Mon Sep 17 00:00:00 2001 From: Sheng-Liang Slogar Date: Mon, 11 Mar 2024 19:42:39 -0500 Subject: [PATCH 6/6] Add support for Laravel 11 (#81) * Add Laravel 11 dependency * Remove/replace broken links * Tweak package versions * Attempt to support PHPUnit v10 and v8 simultaneously * Drop support of PHPUnit v8 Dropping support of PHPUnit v8 means dropping support of PHP 7.2 which means dropping support of Laravel v6 and v7 * Update workflow * Update tests and upgrade phpunit.xml * Update upgrade guide * Attempt to use newer GH actions * Configure Codecov * Formatting * Remove unneeded test case IDE Helper-related issue was patched in v2.9.1, which only supported Laravel 7+. Since we dropped older Laravel versions, we can remove this. @see https://github.com/barryvdh/laravel-ide-helper/issues/627 * Improve phrasing * Whoops * Rearrange --- .github/workflows/tests.yml | 39 +++++++++-------------- README.md | 58 ++++++++++++++++++----------------- UPGRADE.md | 7 ++++- composer.json | 12 ++++---- phpunit.xml | 14 ++++----- tests/CustomGeneratorTest.php | 1 - tests/DeferredLoadingTest.php | 4 +-- tests/FacadePhpDocTest.php | 21 ++----------- tests/IgnitionTest.php | 2 +- tests/TemplatesTest.php | 6 ++-- 10 files changed, 71 insertions(+), 93 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 89a65f7..fc3ee28 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,44 +13,32 @@ jobs: phpunit: strategy: matrix: - php: [ 8.2, 8.1, 8.0, 7.4, 7.3, 7.2 ] - laravel: [ 10.*, 9.*, 8.*, 7.*, 6.* ] + php: [ 8.2, 8.1, 8.0, 7.4, 7.3 ] + laravel: [ 11.*, 10.*, 9.*, 8.* ] os: [ ubuntu-latest, windows-latest ] # Unsupported combinations exclude: + - laravel: 11.* + php: 8.1 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 7.4 + - laravel: 11.* + php: 7.3 + - laravel: 10.* php: 8.0 - laravel: 10.* php: 7.4 - laravel: 10.* php: 7.3 - - laravel: 10.* - php: 7.2 - laravel: 9.* php: 7.4 - laravel: 9.* php: 7.3 - - laravel: 9.* - php: 7.2 - - - laravel: 8.* - php: 7.2 - - - laravel: 7.* - php: 8.2 - - laravel: 7.* - php: 8.1 - - laravel: 7.* - php: 8.0 - - - laravel: 6.* - php: 8.2 - - laravel: 6.* - php: 8.1 - - laravel: 6.* - php: 8.0 # Continue running through matrix even if one combination fails fail-fast: false @@ -61,7 +49,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -81,6 +69,7 @@ jobs: run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml - name: Report coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} file: build/logs/clover.xml diff --git a/README.md b/README.md index e2caa65..9a3f472 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ A simple Laravel-style way to create breadcrumbs. -This project is the [official fork](https://newsroom.diglactic.com/laravel-breadcrumbs/) of the fantastically original -[Laravel Breadcrumbs by Dave James Miller](https://github.com/davejamesmiller/laravel-breadcrumbs) and wouldn't have -been possible without -[a bunch of awesome day-one contributors](https://github.com/davejamesmiller/laravel-breadcrumbs/graphs/contributors). +This project is the official fork of the fantastically +original [Laravel Breadcrumbs by Dave James Miller](https://github.com/davejamesmiller/laravel-breadcrumbs) and wouldn't +have been possible +without [a bunch of awesome day-one contributors](https://github.com/davejamesmiller/laravel-breadcrumbs/graphs/contributors). Thanks, all! @@ -39,9 +39,10 @@ Compatibility Chart | Laravel | Laravel Breadcrumbs | |---------|---------------------| -| 10.x | 8.x | -| 9.x | 8.x | -| 8.x | 8.x | +| 11.x | 9.x | +| 10.x | 9.x | +| 9.x | 9.x | +| 8.x | 9.x | | 7.x | 8.x | | 6.x | 8.x | @@ -117,7 +118,7 @@ The possible values are: - `breadcrumbs::bootstrap4` – [Bootstrap 4](https://getbootstrap.com/docs/4.0/components/breadcrumb/) - `breadcrumbs::bulma` – [Bulma](https://bulma.io/documentation/components/breadcrumb/) - `breadcrumbs::foundation6` – [Foundation 6](https://get.foundation/sites/docs/breadcrumbs.html) -- `breadcrumbs::json-ld` – [JSON-LD Structured Data](https://developers.google.com/search/docs/data-types/breadcrumbs) +- `breadcrumbs::json-ld` – [JSON-LD Structured Data](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb) - `breadcrumbs::materialize` – [Materialize](https://materializecss.com/breadcrumbs.html) - `breadcrumbs::tailwind` – [Tailwind CSS](https://tailwindcss.com/) - `breadcrumbs::uikit` – [UIkit](https://getuikit.com/docs/breadcrumb) @@ -141,8 +142,8 @@ parameters: {{ Breadcrumbs::render('category', $category) }} ``` -See the [Outputting Breadcrumbs](#outputting-breadcrumbs) section for other output options, and see -[Route-Bound Breadcrumbs](#route-bound-breadcrumbs) for a way to link breadcrumb names to route names automatically. +See the [Outputting Breadcrumbs](#outputting-breadcrumbs) section for other output options, and +see [Route-Bound Breadcrumbs](#route-bound-breadcrumbs) for a way to link breadcrumb names to route names automatically. Defining Breadcrumbs @@ -236,8 +237,9 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { }); ``` -The `$post` object (probably an Eloquent [Model](https://laravel.com/api/10.x/Illuminate/Database/Eloquent/Model.html), -but could be anything) would be passed in from the view: +The `$post` object (probably an +Eloquent [Model](https://laravel.com/api/master/Illuminate/Database/Eloquent/Model.html), but could be anything) would +be passed in from the view: ```blade {{ Breadcrumbs::render('post', $post) }} @@ -348,7 +350,7 @@ you to make edits directly. #### View data -The view will receive a [Collection](https://laravel.com/api/10.x/Illuminate/Support/Collection.html) +The view will receive a [Collection](https://laravel.com/api/master/Illuminate/Support/Collection.html) called `$breadcrumbs`. Each breadcrumb is an [object](https://www.php.net/manual/en/language.types.object.php) with the following keys: @@ -399,7 +401,8 @@ Or with a parameter: Structured Data --------------- -To render breadcrumbs as JSON-LD [structured data](https://developers.google.com/search/docs/data-types/breadcrumbs) +To render breadcrumbs as +JSON-LD [structured data](httpshttps://developers.google.com/search/docs/appearance/structured-data/breadcrumb) (usually for SEO reasons), use `Breadcrumbs::view()` to render the `breadcrumbs::json-ld` template in addition to the normal one. For example: @@ -460,7 +463,7 @@ Route::name('home')->get('/', 'HomeController@index'); Route::name('post')->get('/post/{id}', 'PostController@show'); ``` -For more details, see [Named Routes](https://laravel.com/docs/10.x/routing#named-routes) in the Laravel documentation. +For more details, see [Named Routes](https://laravel.com/docs/routing#named-routes) in the Laravel documentation. ### Name your breadcrumbs to match @@ -485,8 +488,8 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { }); ``` -To add breadcrumbs to a [custom 404 Not Found page](https://laravel.com/docs/10.x/errors#custom-http-error-pages), use -the name `errors.404`: +To add breadcrumbs to a [custom 404 Not Found page](https://laravel.com/docs/errors#custom-http-error-pages), use the +name `errors.404`: ```php Breadcrumbs::for('errors.404', function (BreadcrumbTrail $trail) { @@ -576,7 +579,7 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { // <-- This makes your code less verbose and more efficient by only loading the post from the database once. -For more details see [Route Model Binding](https://laravel.com/docs/10.x/routing#route-model-binding) in the Laravel +For more details see [Route Model Binding](https://laravel.com/docs/routing#route-model-binding) in the Laravel documentation. ### Resourceful controllers @@ -641,7 +644,7 @@ Breadcrumbs::for('photo.edit', function (BreadcrumbTrail $trail, Photo $photo) { }); ``` -For more details see [Resource Controllers](https://laravel.com/docs/10.x/controllers#resource-controllers) in the +For more details see [Resource Controllers](https://laravel.com/docs/controllers#resource-controllers) in the Laravel documentation. (Related FAQ: [Why is there no Breadcrumbs::resource() method?](#why-is-there-no-breadcrumbsresource-method).) @@ -742,7 +745,7 @@ Breadcrumbs::after(function (BreadcrumbTrail $trail) { ``` For more advanced filtering, use `Breadcrumbs::generate()` and Laravel's -[Collection class](https://laravel.com/api/10.x/Illuminate/Support/Collection.html) methods instead: +[Collection class](https://laravel.com/api/master/Illuminate/Support/Collection.html) methods instead: ```php where('current', '!==', false)->last(); ### Switching views at runtime -You can use `Breadcrumbs::view()` in place of `Breadcrumbs::render()` to render a template other than the -[default one](#3-style): +You can use `Breadcrumbs::view()` in place of `Breadcrumbs::render()` to render a template other than +the [default one](#3-style): ```blade {{ Breadcrumbs::view('partials.breadcrumbs2', 'category', $category) }} @@ -846,7 +849,7 @@ class MyServiceProvider extends ServiceProvider ### Dependency injection -You can use [dependency injection](https://laravel.com/docs/10.x/providers#the-boot-method) to access the `Manager` +You can use [dependency injection](https://laravel.com/docs/providers#the-boot-method) to access the `Manager` instance if you prefer, instead of using the `Breadcrumbs::` facade: ```php @@ -866,9 +869,8 @@ class MyServiceProvider extends ServiceProvider ### Macros -The breadcrumbs `Manager` class is -[macroable](https://unnikked.ga/understanding-the-laravel-macroable-trait-dab051f09172), so you can add your own -methods. For example: +The breadcrumbs `Manager` class is [macroable](https://tighten.com/insights/the-magic-of-laravel-macros/), so you can +add your own methods. For example: ```php - tests/ - + - - + + src/ - - - + + diff --git a/tests/CustomGeneratorTest.php b/tests/CustomGeneratorTest.php index ba4864f..992c144 100644 --- a/tests/CustomGeneratorTest.php +++ b/tests/CustomGeneratorTest.php @@ -30,5 +30,4 @@ public function generate(array $callbacks, array $before, array $after, string $ { return new Collection(['custom-generator']); } - } diff --git a/tests/DeferredLoadingTest.php b/tests/DeferredLoadingTest.php index c2fff15..951d56d 100644 --- a/tests/DeferredLoadingTest.php +++ b/tests/DeferredLoadingTest.php @@ -17,7 +17,7 @@ protected function getEnvironmentSetUp($app): void $app->config->set('breadcrumbs.files', [__DIR__ . '/routes/should-not-be-loaded.php']); } - protected function resolveApplicationConsoleKernel($app) + protected function resolveApplicationConsoleKernel($app): void { // Disable the console kernel because it calls loadDeferredProviders() // which defeats the purpose of this test @@ -36,7 +36,7 @@ public function testDeferredLoading() class DisabledConsoleKernel extends \Orchestra\Testbench\Foundation\Console\Kernel { - public function bootstrap() + public function bootstrap(): void { // } diff --git a/tests/FacadePhpDocTest.php b/tests/FacadePhpDocTest.php index b2a83aa..0e4d26a 100644 --- a/tests/FacadePhpDocTest.php +++ b/tests/FacadePhpDocTest.php @@ -4,6 +4,7 @@ use Diglactic\Breadcrumbs\Breadcrumbs; use Diglactic\Breadcrumbs\Manager; +use Generator; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; use ReflectionClass; @@ -13,7 +14,7 @@ class FacadePhpDocTest extends TestCase { - public function tags() + public static function tags(): Generator { $code = file_get_contents(__DIR__ . '/../src/Manager.php'); @@ -38,24 +39,6 @@ public function tags() } } - /** @dataProvider tags */ - public function testFullyQualifiedClassNames($class, $line) - { - // IDE Helper (v2.4.3) doesn't rewrite class names to FQCNs, so make sure only - // fully qualified class names and built-in types are used in the Manager class - // ---------------------------------------------------------------------------- - // Note: we'll eventually need to update with `assertMatchesRegularExpression`. - // This is currently slated for removal in PHPUnit 10, but hasn't been enforced - // yet. Laravel 10 supports PHPUnit 10 and 9, so we've stuck with v9 for now. - // @see https://github.com/laravel/framework/blob/10.x/composer.json#L101 - // @see https://github.com/sebastianbergmann/phpunit/issues/4086 - $this->assertRegExp( - '/^(\\\\.*|array|object|bool|callable|int|mixed|null|string|void)$/', - $class, - "Must use fully qualified class names in BreadcrumbsManger PhpDoc: $line" - ); - } - public function testBreadcrumbsFacade() { $class = new ReflectionClass(Manager::class); diff --git a/tests/IgnitionTest.php b/tests/IgnitionTest.php index ce1c79d..784848e 100644 --- a/tests/IgnitionTest.php +++ b/tests/IgnitionTest.php @@ -25,7 +25,7 @@ private function assertSolutionMatchesSnapshot(ProvidesSolution $exception) $this->assertMatchesSnapshot($solution->getDocumentationLinks()); } - public function dataOneOrManyConfigFiles(): array + public static function dataOneOrManyConfigFiles(): array { return [ 'Single config file' => [['routes/breadcrumbs.php']], diff --git a/tests/TemplatesTest.php b/tests/TemplatesTest.php index 4ef8bb0..7270829 100644 --- a/tests/TemplatesTest.php +++ b/tests/TemplatesTest.php @@ -37,7 +37,7 @@ protected function setUp(): void ]; } - public function viewProvider(): Generator + public static function viewProvider(): Generator { foreach (glob(__DIR__ . '/../resources/views/*.blade.php') as $filename) { $name = basename($filename, '.blade.php'); @@ -53,7 +53,7 @@ public function testView($view) $this->assertMatchesXmlSnapshot($html); } - public function testCanResolveFacade() + public function testCanResolveFacadeAbsolutely() { $this->expectNotToPerformAssertions(); @@ -63,7 +63,7 @@ public function testCanResolveFacade() }); } - public function testCanResolveDirectly() + public function testCanResolveFacadeDirectly() { $this->expectNotToPerformAssertions();