Skip to content

Commit

Permalink
Merge pull request #13 from RobertBoes/feat/laravel-pint
Browse files Browse the repository at this point in the history
feat: introduce pint
  • Loading branch information
RobertBoes committed Mar 13, 2024
2 parents 4c7b9e2 + d909e60 commit d1a9f51
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Expand Up @@ -8,7 +8,7 @@
/phpunit.xml.dist export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist export-ignore
/pint.json export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
Expand Up @@ -3,7 +3,7 @@ name: Check & fix styling
on: [push]

jobs:
php-cs-fixer:
pint:
runs-on: ubuntu-latest

steps:
Expand All @@ -12,12 +12,12 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
- name: Run Laravel Pint
uses: aglipanci/laravel-pint-action@2.4
with:
args: --config=.php_cs.dist.php --allow-risky=yes
verboseMode: true

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
commit_message: "style: PHP Linting (Pint)"
3 changes: 0 additions & 3 deletions .gitignore
@@ -1,6 +1,4 @@
.idea
.php_cs
.php_cs.cache
.phpunit.result.cache
.phpunit.cache
build
Expand All @@ -12,5 +10,4 @@ phpstan.neon
testbench.yaml
vendor
node_modules
.php-cs-fixer.cache
yarn-error.log
40 changes: 0 additions & 40 deletions .php_cs.dist.php

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@
[![Latest Version on Packagist](https://img.shields.io/packagist/v/robertboes/inertia-breadcrumbs.svg?style=flat-square)](https://packagist.org/packages/robertboes/inertia-breadcrumbs)
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/robertboes/inertia-breadcrumbs?style=flat-square)](https://packagist.org/packages/robertboes/inertia-breadcrumbs)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/RobertBoes/inertia-breadcrumbs/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/robertboes/inertia-breadcrumbs/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/RobertBoes/inertia-breadcrumbs/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/RobertBoes/inertia-breadcrumbs/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain++)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/RobertBoes/inertia-breadcrumbs/pint.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/RobertBoes/inertia-breadcrumbs/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain++)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/RobertBoes/inertia-breadcrumbs?label=latest%20version&style=flat-square)](https://github.com/RobertBoes/inertia-breadcrumbs/releases/latest)
[![Total Downloads](https://img.shields.io/packagist/dt/robertboes/inertia-breadcrumbs.svg?style=flat-square)](https://packagist.org/packages/robertboes/inertia-breadcrumbs)
[![GitHub](https://img.shields.io/github/license/RobertBoes/inertia-breadcrumbs?style=flat-square)](https://github.com/RobertBoes/inertia-breadcrumbs/blob/main/LICENSE.md)
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -27,6 +27,7 @@
"composer/composer": "^2.1",
"diglactic/laravel-breadcrumbs": "^8.0",
"glhd/gretel": "^1.7",
"laravel/pint": "^1.14",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0",
Expand Down
2 changes: 1 addition & 1 deletion config/inertia-breadcrumbs.php
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
3 changes: 3 additions & 0 deletions pint.json
@@ -0,0 +1,3 @@
{
"preset": "laravel"
}
4 changes: 1 addition & 3 deletions src/BreadcrumbCollection.php
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
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
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
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
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
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
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
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
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 d1a9f51

Please sign in to comment.