Skip to content

Commit

Permalink
Merge pull request #538 from timacdonald/facade
Browse files Browse the repository at this point in the history
Automatically update Facade docblocks
  • Loading branch information
jessarcher authored Sep 6, 2023
2 parents d22ed91 + ebc6c68 commit a657a07
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 15 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/facade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: facades

on:
push:
branches:
- 'master'

jobs:
update:
runs-on: ubuntu-22.04

strategy:
fail-fast: true

name: Facade DocBlocks

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: none

- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: "composer config repositories.facade-documenter vcs git@github.com:laravel/facade-documenter.git && composer require --dev laravel/facade-documenter:dev-main"

- name: Update facade docblocks
run: php -f vendor/bin/facade.php -- Inertia\\Inertia

- name: Commit facade docblocks
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update facade docblocks
file_pattern: src/
21 changes: 12 additions & 9 deletions src/Inertia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
namespace Inertia;

use Illuminate\Support\Facades\Facade;
use Illuminate\Contracts\Support\Arrayable;

/**
* @method static void setRootView(string $name)
* @method static void share($key, $value = null)
* @method static array getShared(string $key = null, $default = null)
* @method static array flushShared()
* @method static void version($version)
* @method static int|string getVersion()
* @method static LazyProp lazy(callable $callback)
* @method static Response render($component, array|Arrayable $props = [])
* @method static \Symfony\Component\HttpFoundation\Response location(string $url)
* @method static void share(string|array|\Illuminate\Contracts\Support\Arrayable $key, mixed $value = null)
* @method static mixed getShared(string|null $key = null, mixed $default = null)
* @method static void flushShared()
* @method static void version(\Closure|string|null $version)
* @method static string getVersion()
* @method static \Inertia\LazyProp lazy(callable $callback)
* @method static \Inertia\Response render(string $component, array|\Illuminate\Contracts\Support\Arrayable $props = [])
* @method static \Symfony\Component\HttpFoundation\Response location(string|\Illuminate\Http\RedirectResponse $url)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Inertia\ResponseFactory
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(string $component, $props, string $rootView = 'app',

/**
* @param string|array $key
* @param mixed|null $value
* @param mixed $value
*
* @return $this
*/
Expand All @@ -55,7 +55,7 @@ public function with($key, $value = null): self

/**
* @param string|array $key
* @param mixed|null $value
* @param mixed $value
*
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions src/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setRootView(string $name): void

/**
* @param string|array|Arrayable $key
* @param mixed|null $value
* @param mixed $value
*/
public function share($key, $value = null): void
{
Expand All @@ -45,7 +45,7 @@ public function share($key, $value = null): void
}

/**
* @param mixed|null $default
* @param mixed $default
*
* @return mixed
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/Concerns/Has.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function hasAll($key): self
}

/**
* @param mixed|null $value
* @param mixed $value
*
* @return $this
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Stubs/ExampleMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class ExampleMiddleware extends Middleware
{
/**
* @var mixed|null
* @var mixed
*/
protected $version;

Expand Down

0 comments on commit a657a07

Please sign in to comment.