<p dir="auto"><strong>Description</strong><br>
For now, DotEnv component don't allow <code class="notranslate">null</code> as value and don't type values.<br>
We can type value when reading, with <code class="notranslate">%env(int:foo)%</code>. But if an env var is used more than one time, we have to duplicate type hint at each read.</p>
<p dir="auto">Can we take that problem (typing at reading) on the other side: typing at declaration, not at reading ?</p>
<p dir="auto">For null value, it's impossible for now, and that's a problem. Maybe we can have a syntax to allow null at declaration ?</p>
<p dir="auto"><strong>Example</strong><br>
<code class="notranslate">/.env</code><br>
VAR_INT=<code class="notranslate">!int:</code>12<br>
VAR_FLOAT=<code class="notranslate">!float:</code>12.2<br>
VAR_STRING=<code class="notranslate">!string:</code>foo<br>
VAR_STRING_2=foo<br>
VAR_ALLOW_NULL=<code class="notranslate">!?string:</code>null<br>
VAR_ARRAY=<code class="notranslate">!array:</code>[!int:12, !string:foo]</p>
<p dir="auto"><strong>Problems</strong></p>
<p dir="auto">As DotEnv is installed for dev env by default, how can we do to parse env var in prod env ?</p>
<p dir="auto">Right now, the only difference between the <code class="notranslate">UsernamePasswordFormAuthenticationListener</code> and the <code class="notranslate">SimpleFormAuthenticationListener</code> is the fact that the authentication provider can be injected. All other code inside is equal.<br>
I think it would be fairly easy to remove the <code class="notranslate">UsernamePasswordFormAuthenticationListener</code> altogether, and let the <code class="notranslate">form_login</code> factory insert the <code class="notranslate">SimpleFormAuthenticationListener</code> with a custom authentication provided that creates the UsernamePasswordToken.</p>
<p dir="auto">This way, we could get rid of the whole <code class="notranslate">UsernamePasswordFormAuthenticationListener</code> class, and the duplicated code.</p>