note 126780 rejected from filesystemiterator.construct by cmb

From: Date: Wed, 19 Jan 2022 17:24:03 +0000
Subject: note 126780 rejected from filesystemiterator.construct by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217519@lists.php.net to get a copy of this message
Note Submitter: rick at belniakmedia dot com ---- I'm not sure why $fileInfo in the following code sample is return type of DirectoryIterator | Mixed and not just DirectoryIterator: <?php foreach(new DirectoryIterator('.') as $fileinfo) { ... } ?> However, this causes my IDE not flag syntax errors (ie $fileInfo->getCime() (miss spelled method name)) via built in inspections due to the fact that mixed is a possible type of $fileInfo. In what scenario would $fileInfo be mixed and not DirectoryIterator?

« previous php.notes (#217519) next »