-
Notifications
You must be signed in to change notification settings - Fork 9.4k
#1727: Introduce internal class wrapping SplFileInfo #29461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1727: Introduce internal class wrapping SplFileInfo #29461
Conversation
…ng SplFileInfo - implement class wrapping SplFileInfo and modified the files to use the newly added classes
Hi @joweecaquicla. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
…ntroduce-internal-class-wrapping-splfileinfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @joweecaquicla ! Please see my comments
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFileInfo($class_name = null): \SplFileInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the functions that are not currently needed (additional functions can be added to this class later if they will be required). Also please remove the \SplFileInfo
references from this class
app/code/Magento/MediaGallerySynchronization/Model/Filesystem/GetFileInfo.php
Show resolved
Hide resolved
…ng SplFileInfo - fix static and mftf fails, added integration tets
@magento run all tests |
…ng SplFileInfo - fix static test
@magento run all tests |
* | ||
* @SuppressWarnings(PHPMD.TooManyFields) | ||
*/ | ||
class FileInfo extends \SplFileInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use ccomposition instead of inheritance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class does not need to extend \SplFileInfo
please remove the inheritance
/** | ||
* @inheritDoc | ||
*/ | ||
public function getRealPath() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strict type is missing
int $mTime, | ||
int $cTime, | ||
string $type, | ||
$realPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict type is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for update @joweecaquicla ! Please see review comments
* | ||
* @SuppressWarnings(PHPMD.TooManyFields) | ||
*/ | ||
class FileInfo extends \SplFileInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class does not need to extend \SplFileInfo
please remove the inheritance
/** | ||
* @inheritDoc | ||
*/ | ||
public function getInode(): int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Inode
method is used, please keep only properties/methods that are required
$path = $this->getImageFilePath($file); | ||
|
||
$fileInfo = $this->getFileInfo->execute($path); | ||
$this->assertNotEmpty($fileInfo->getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more strict verification $this->assertEquals($path, $fileInfo->getPath());
, $this->assertEquals($mtime, $fileInfo-> getMTime());
The expected data can be retrieved from new \SplFileInfo($path)
…ng SplFileInfo - apply requested changes
@magento run all tests |
Hi @sivaschenko, thank you for the review.
|
@magento run all tests |
Hi @joweecaquicla, thank you for your contribution! |
Description (*)
This PR will introduce an internal class wrapping SplFileInfo.
Related Pull Requests
N/A
Fixed Issues (if relevant)
Manual testing scenarios (*)
Verify Image details in the media gallery after:
media_gallery_asset
table in database and runningbin/magento media-gallery:sync
commandQuestions or comments
Contribution checklist (*)