Improve static analysis by adding type hints for $app in artisan and public/index.php (#6531)
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

* 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 <taylor@laravel.com>
This commit is contained in:
Anders Jenbo 2025-02-05 12:01:25 +01:00 committed by GitHub
parent 9edc9aad80
commit cf5aed8c2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true)); define('LARAVEL_START', microtime(true));
@ -9,7 +10,9 @@ define('LARAVEL_START', microtime(true));
require __DIR__.'/vendor/autoload.php'; require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command... // Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php') /** @var Application $app */
->handleCommand(new ArgvInput); $app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status); exit($status);

View File

@ -1,5 +1,6 @@
<?php <?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request; use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true)); define('LARAVEL_START', microtime(true));
@ -13,5 +14,7 @@ if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php'))
require __DIR__.'/../vendor/autoload.php'; require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request... // Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php') /** @var Application $app */
->handleRequest(Request::capture()); $app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());