magento / magento/magento-coding-standard

The use of function filectime() / filemtime() is discouraged

Open
#172 0 comments 1 reaction 1 assignee Claimed by @diazwatson View on GitHub
proposal
Dominant language
PHP
Stars
375
Forks
165
PR merge metrics
No merged PRs in 30d

Description

### Rule

I saw a warning similar to this in my IDE the other day:
```
The use of function filectime() / filemtime() is discouraged.
```
It was not coming from Magento CS but from PHPCS which I am currently using WITH Magento 2 CS.

If this check / warning is already there, would not be helpful to provide developers with some guidance or alternatives on what they can use instead?

### Reason

TBC: I am still doing some research to understand WHY the use of this is discouraged. I will complete this section with my findings.

### Implementation

[This guy](http://blog.tobiasforkel.de/en/2019/01/04/the-use-of-function-filectime-filemtime-is-discouraged-in-magento2/) proposes to use `\Magento\Framework\Filesystem\Driver\File`, same we are already advising to use to replace these kind of PHP functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.