extract ConfigType phpstan-type

This commit is contained in:
KHOUBZA Younes
2022-05-28 17:06:02 +01:00
parent 84372b3816
commit 86d4cd5973
2 changed files with 27 additions and 17 deletions
+25 -2
View File
@@ -7,15 +7,38 @@
namespace Flasher\Prime\Config;
/**
* @phpstan-type ConfigType array{
* default: string,
* root_script: string,
* themes: array<string, array{
* view: string,
* styles: string[],
* scripts: string[],
* options: array<string, mixed>,
* }>,
* auto_translate: bool,
* flash_bag?: array{
* enabled: bool,
* mapping: array<string, string>,
* },
* presets: array<string, array{
* type: string,
* title: string,
* message: string,
* options: array<string, mixed>,
* }>,
* }
*/
final class Config implements ConfigInterface
{
/**
* @var array<string, mixed>
* @phpstan-var ConfigType
*/
private $config;
/**
* @param array<string, mixed> $config
* @phpstan-param ConfigType $config
*/
public function __construct(array $config = array())
{
@@ -7,6 +7,7 @@
namespace Flasher\Symfony\DependencyInjection;
use Flasher\Prime\Config\Config;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -14,21 +15,7 @@ use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* @phpstan-type ConfigType array{
* default: string,
* root_script: string,
* themes: array<string, array{
* view: string,
* styles: string[],
* scripts: string[],
* options: array<string, mixed>,
* }>,
* translate_by_default: bool,
* flash_bag?: array{
* enabled: bool,
* mapping: array<string, string>,
* },
* }
* @phpstan-import-type ConfigType from Config
*/
final class FlasherExtension extends Extension implements CompilerPassInterface
{