Skip to content

Commit cf5aed8

Browse files
AJenbotaylorotwell
andauthored
Improve static analysis by adding type hints for $app in artisan and public/index.php (laravel#6531)
* feat: add type hints for $app in artisan and public/index.php Added PHPDoc type hints for the $app variable to improve static analysis support in PHPStan and PHPStorm. This prevents tools from incorrectly flagging the variable and enhances developer experience. No functional changes; only improves code readability and IDE support. * Update artisan * Update index.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 9edc9aa commit cf5aed8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

artisan

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4+
use Illuminate\Foundation\Application;
45
use Symfony\Component\Console\Input\ArgvInput;
56

67
define('LARAVEL_START', microtime(true));
@@ -9,7 +10,9 @@ define('LARAVEL_START', microtime(true));
910
require __DIR__.'/vendor/autoload.php';
1011

1112
// Bootstrap Laravel and handle the command...
12-
$status = (require_once __DIR__.'/bootstrap/app.php')
13-
->handleCommand(new ArgvInput);
13+
/** @var Application $app */
14+
$app = require_once __DIR__.'/bootstrap/app.php';
15+
16+
$status = $app->handleCommand(new ArgvInput);
1417

1518
exit($status);

public/index.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Illuminate\Foundation\Application;
34
use Illuminate\Http\Request;
45

56
define('LARAVEL_START', microtime(true));
@@ -13,5 +14,7 @@
1314
require __DIR__.'/../vendor/autoload.php';
1415

1516
// Bootstrap Laravel and handle the request...
16-
(require_once __DIR__.'/../bootstrap/app.php')
17-
->handleRequest(Request::capture());
17+
/** @var Application $app */
18+
$app = require_once __DIR__.'/../bootstrap/app.php';
19+
20+
$app->handleRequest(Request::capture());

0 commit comments

Comments
 (0)