wintercms / laravel-config-writer

Utility to create and update Laravel config and .env files
MIT License
12 stars 7 forks source link

Add support for using strict types in configs #4

Closed austinkregel closed 1 month ago

austinkregel commented 1 month ago

Greetings!

This PR aims to add support for config files that have declare(strict_types=true); at the top of the file like so

<?php

declare (strict_types=1);

use Illuminate\Support\Facades\Facade;

return [

    'aliases' => Facade::defaultAliases()->merge([
        // 'Example' => App\Facades\Example::class,
        'Operator' => App\Operations\Operator::class,
    ])->toArray(),

];

At present any project that tries to use this package, while also having strict types in the config will not work. The ArrayFile will throw an exception that there is no return even if there is.

I'm not sure how wide of a practice it is to use strict types, but it's quite frequent at my work and my personal projects.