[php-src] Issue #15920: Make $_ENV usable in attributes
| From: | Valentinfe | Date: | Mon, 16 Sep 2024 14:26:11 +0000 |
| Subject: | [php-src] Issue #15920: Make $_ENV usable in attributes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247804@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15920
Author: Valentinfe
### Description
In my opinion, attributes usage is expanding and adding variables handling or at least $_ENV
handling could prove very useful.
```php
#[AsCronTask(expression: '0 */1 * * *', schedule: 'status_updater')]
public class Task{}
```
As you can see in this exemple, I would love to put this expression in an env var but I think
it's not doable right now.
```php
#[AsCronTask(expression: $_ENV['TASK_FREQUENCE'], schedule: 'status_updater')]
public class Task{}
```
Can you maybe give an explanation on why this is not doable. And if it is doable could it be added ?