Skip to content

Commit

Permalink
Merge branch 'feat/laravel-pint' of https://github.com/RobertBoes/ine…
Browse files Browse the repository at this point in the history
…rtia-breadcrumbs into feat/laravel-pint
  • Loading branch information
RobertBoes committed Mar 13, 2024
2 parents 985940c + a4bdd6d commit d909e60
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/inertia-breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use RobertBoes\InertiaBreadcrumbs\Classifier\AppendAllBreadcrumbs;
use RobertBoes\InertiaBreadcrumbs\Classifier\IgnoreSingleBreadcrumbs;
use RobertBoes\InertiaBreadcrumbs\Collectors\DiglacticBreadcrumbsCollector;
use RobertBoes\InertiaBreadcrumbs\Collectors\TabunaBreadcrumbsCollector;
use RobertBoes\InertiaBreadcrumbs\Collectors\GretelBreadcrumbsCollector;
use RobertBoes\InertiaBreadcrumbs\Collectors\TabunaBreadcrumbsCollector;

return [
'middleware' => [
Expand Down
4 changes: 1 addition & 3 deletions src/BreadcrumbCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class BreadcrumbCollection implements Arrayable
public Collection $items;

/**
*
* @param array|Collection $items
* @param null|Closure(mixed): Breadcrumb $initializer
* @param null|Closure(mixed): Breadcrumb $initializer
* @return void
*/
public function __construct(array|Collection $items, ?Closure $initializer = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Collectors/DiglacticBreadcrumbsCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private function getBreadcrumbs(Request $request): Collection

try {
return Breadcrumbs::generate($route->getName(), ...array_values($route->parameters()));
} catch (InvalidBreadcrumbException | UnnamedRouteException) {
} catch (InvalidBreadcrumbException|UnnamedRouteException) {
return collect();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/PackageNotInstalledException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class PackageNotInstalledException extends Exception
{
public function __construct(string $packageIdentifier)
{
parent::__construct(sprintf("%s is not installed", $packageIdentifier));
parent::__construct(sprintf('%s is not installed', $packageIdentifier));
}
}
6 changes: 4 additions & 2 deletions tests/DiglacticCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function usesCustomMiddlewareGroup($app)
}

/**
* @param \Illuminate\Routing\Router $router
* @param \Illuminate\Routing\Router $router
*/
public function defineRoutes($router)
{
Expand Down Expand Up @@ -86,7 +86,6 @@ public function it_throws_an_exception_when_package_is_not_installed()

/**
* @test
*
*/
public function it_collects_diglactic_breadcrumbs()
{
Expand Down Expand Up @@ -136,6 +135,7 @@ public function it_can_use_a_reserved_keyword()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_resolves_a_single_route_parameter()
Expand Down Expand Up @@ -182,6 +182,7 @@ public function it_returns_empty_collection_for_404_page()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_ignores_the_query_string_by_default_when_determining_current_route()
Expand All @@ -208,6 +209,7 @@ public function it_ignores_the_query_string_by_default_when_determining_current_

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_does_not_ignore_query_parameters_when_configured_to_do_so_when_determining_current_route()
Expand Down
4 changes: 3 additions & 1 deletion tests/GretelCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function getPackageProviders($app)
}

/**
* @param \Illuminate\Routing\Router $router
* @param \Illuminate\Routing\Router $router
*/
public function defineRoutes($router)
{
Expand Down Expand Up @@ -111,6 +111,7 @@ public function it_returns_empty_collection_for_404_page()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_ignores_the_query_string_by_default_when_determining_current_route()
Expand All @@ -134,6 +135,7 @@ public function it_ignores_the_query_string_by_default_when_determining_current_

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_does_not_ignore_query_parameters_when_configured_to_do_so_when_determining_current_route()
Expand Down
9 changes: 5 additions & 4 deletions tests/Helpers/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class RequestBuilder
* @example RequestBuilder::create('post.show', ['postId' => 1], PostShowRequest::class);
* @example RequestBuilder::create('post.index');
*
* @param string $routeName Name of the route.
* @param array $parameters Array of route or input parameters.
* @param string $class Request class.
* @throws \Exception If the route name doesn't exist.
* @param string $routeName Name of the route.
* @param array $parameters Array of route or input parameters.
* @param string $class Request class.
* @return Request
*
* @throws \Exception If the route name doesn't exist.
*/
public static function create(string $routeName, array $parameters = [], string $class = Request::class)
{
Expand Down
8 changes: 7 additions & 1 deletion tests/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function hasMiddlewareDisabled($app)
}

/**
* @param \Illuminate\Routing\Router $router
* @param \Illuminate\Routing\Router $router
*/
public function defineRoutes($router)
{
Expand All @@ -53,6 +53,7 @@ public function it_adds_middleware_to_web_group()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_adds_middleware_to_custom_group()
Expand All @@ -69,6 +70,7 @@ public function it_adds_middleware_to_custom_group()

/**
* @test
*
* @define-env hasMiddlewareDisabled
*/
public function it_only_adds_middleware_when_enabled_in_config()
Expand All @@ -78,6 +80,7 @@ public function it_only_adds_middleware_when_enabled_in_config()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_adds_breadcrumbs_for_current_route()
Expand All @@ -104,6 +107,7 @@ public function it_adds_breadcrumbs_for_current_route()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_adds_diglactic_breadcrumbs_with_additional_data()
Expand Down Expand Up @@ -131,6 +135,7 @@ public function it_adds_diglactic_breadcrumbs_with_additional_data()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
* @define-env usesCustomSharedKey
*/
Expand Down Expand Up @@ -159,6 +164,7 @@ public function it_does_change_key_of_breadcrumb()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_does_not_add_breadcrumbs_when_route_has_no_breadcrumbs()
Expand Down
2 changes: 1 addition & 1 deletion tests/SerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class SerializationTest extends TestCase
{
/**
* @param \Illuminate\Routing\Router $router
* @param \Illuminate\Routing\Router $router
*/
public function defineRoutes($router): void
{
Expand Down
4 changes: 3 additions & 1 deletion tests/TabunaCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function collector(): string
}

/**
* @param \Illuminate\Routing\Router $router
* @param \Illuminate\Routing\Router $router
*/
public function defineRoutes($router)
{
Expand Down Expand Up @@ -138,6 +138,7 @@ public function it_returns_empty_collection_for_404_page()

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_ignores_the_query_string_by_default_when_determining_current_route()
Expand Down Expand Up @@ -166,6 +167,7 @@ public function it_ignores_the_query_string_by_default_when_determining_current_

/**
* @test
*
* @define-env usesCustomMiddlewareGroup
*/
public function it_does_not_ignore_query_parameters_when_configured_to_do_so_when_determining_current_route()
Expand Down

0 comments on commit d909e60

Please sign in to comment.