Skip to content

Commit

Permalink
Merge pull request #379 from alies-dev/application-stub
Browse files Browse the repository at this point in the history
Application stub
  • Loading branch information
alies-dev authored Mar 17, 2024
2 parents 4320620 + 5f1d4b0 commit f3107d9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stubs/Foundation/Application.stubphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Illuminate\Foundation;

class Application
{
/**
* Get or check the current application environment.
* @param string|list<string> ...$environments
* @return string|bool
* @psalm-return ($environments is null ? string : bool)
*/
public function environment(...$environments) {}

/**
* Get the registered service provider instances if any exist.
* @param \Illuminate\Support\ServiceProvider|string $provider
* @psalm-return array{int?, \Illuminate\Support\ServiceProvider}
*/
public function getProviders($provider) {}
}
22 changes: 22 additions & 0 deletions tests/Type/tests/Foundation/ApplicationTest.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--FILE--
<?php declare(strict_types=1);

use \Illuminate\Foundation\Application;

function returns_bool_for_string_arg(Application $application, string $env): bool
{
return $application->environment($env);
}

/** @param non-empty-list<string> $envs */
function returns_bool_for_array_arg(Application $application, array $envs): bool
{
return $application->environment($envs);
}

function returns_string(Application $application): string
{
return $application->environment();
}
?>
--EXPECTF--

0 comments on commit f3107d9

Please sign in to comment.