Skip to content
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

#102 Add alternative for php pathinfo function is discouraged #123

Merged
merged 8 commits into from
Aug 12, 2019

Conversation

diazwatson
Copy link
Contributor

ihor-sviziev
ihor-sviziev previously approved these changes Aug 3, 2019
Copy link
Collaborator

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add also all functions from https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/Filesystem/Io/File.php?

For instance mkdir, rmdir, unlink, etc.

Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
@diazwatson
Copy link
Contributor Author

@ihor-sviziev all requested changes are now done.
I have also added some functions from \Magento\Framework\Filesystem\Driver\File

@lenaorobei
Copy link
Contributor

@buskamuza could you please have a look at these recommendations? It looks like we need to suggest something different from Magento\Framework\Filesystem\Io because it goes against this proposal magento/architecture#219.

Copy link

@buskamuza buskamuza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest referencing \Magento\Framework\Filesystem\DriverInterface interface instead of concrete driver. But I don't insist.

Io should only be used as a last resort. Looks like there is only one method that exists in Io and doesn't exist in Filesystem: pathinfo.

Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
@buskamuza
Copy link

Thanks, @lenaorobei . The proposal is not ready yet, but at least we should avoid recommending Io library.

@diazwatson
Copy link
Contributor Author

Thanks @buskamuza @lenaorobei I'll update this PR today

@diazwatson
Copy link
Contributor Author

@buskamuza requested changes are done, please have a look when you get a chance

@@ -39,11 +39,11 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff
'^call_user_func_array$' => null,
'^chdir$' => null,
'^chgrp$' => null,
'^chmod$' => null,
'^chmod$' => '\Magento\Framework\Filesystem\DriverInterface::changePermissions() or \Magento\Framework\Filesystem\DriverInterface::changePermissionsRecursively()',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix Line exceeds maximum limit of 120 characters; contains 171 characters here.

ihor-sviziev
ihor-sviziev previously approved these changes Aug 9, 2019
Copy link
Contributor

@lenaorobei lenaorobei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use interface recommendation instead of specific class.

Sorry, I missed this at the first glance.

Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php Outdated Show resolved Hide resolved
@lenaorobei lenaorobei merged commit 3391964 into magento:develop Aug 12, 2019
magento-devops-reposync-svc pushed a commit that referenced this pull request Nov 18, 2021
…magento-coding-standard-334

[Imported] Fix unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants