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

How to fix ... in Magento

The problem I had today was located in a helper ( [Namespace]\[Module]\Helper\FileSystem ) which I have created for some basic filesystem operations. The below message was the result of Magento’s EQP which I use before I commit any code.

The warning message basically means, I should find another way to get the creation and modification time of a file because of Magento’s coding standards. I have done that a couple of times already and would like to share my solution this time. First you have to pass \Magento\Framework\Filesystem\Driver\File in your existing constructor or create a new one.

Once you have re-compiled your code, you have access to the file stats as follows.

Beside ctime and mtime the array $fileData should have other file information like size, atime, uid and gid.