Skip to content

#21: Impelement rule #77

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

Merged
merged 9 commits into from
Aug 16, 2019
Merged

#21: Impelement rule #77

merged 9 commits into from
Aug 16, 2019

Conversation

larsroettig
Copy link
Member

see #21

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 see my comments.

@lenaorobei lenaorobei requested a review from paliarush April 8, 2019 21:33
@lenaorobei lenaorobei added the need to discuss Rule requires discussion label Apr 8, 2019
@lenaorobei
Copy link
Contributor

Have concerns regarding Technical Guidelines that says:

5.16. If a method uses system resources (such as files, sockets, streams, etc.), the code MUST be wrapped with a try block and the corresponding finally block. In the finally sections, all resources SHOULD be properly released.

  1. Native PHP functions that work with resources (stream_*, socket_*) do not throw Exceptions or Errors, they mostly return false in case of failure and can produce E_WARNING. https://www.php.net/manual/en/sockets.errors.php
    https://www.php.net/manual/en/stream.errors.php
  2. Magento app will transform E_WARNING to the Exception in Magento\Framework\App\ErrorHandler.
  3. Magento Framework wrappers that work with resources solve E_WARNING by adding @, and do not have try catch blocks. Examples:
    https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/Filesystem/Driver/Http.php#L199
    https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/Backup/Filesystem/Rollback/Ftp.php#L93

My question is what is the right way to deal with such cases?
@akaplya @buskamuza @paliarush @melnikovi @kandy need your input here.

@lenaorobei lenaorobei added the waiting for feedback Additional explanation needed label Apr 9, 2019
@lenaorobei lenaorobei removed the waiting for feedback Additional explanation needed label Apr 17, 2019
@lenaorobei
Copy link
Contributor

@larsroettig this rule was approved on architects discussion magento/architecture#140

I'm going to test it and will provide you feedback.

@lenaorobei lenaorobei removed the need to discuss Rule requires discussion label Apr 18, 2019
@lenaorobei
Copy link
Contributor

@larsroettig could you please remove curl_ from this sniff to make sure it's in line with Magento Technical Guidelines.

This is an adding new rule, so it will be the part of next major release.
I need to suspend the processing of current PR since the versioning strategy is not clear yet magento/architecture#136

Sorry about that and thanks for understanding.

@lenaorobei lenaorobei added the on hold The issue or PR is on hold. label Apr 24, 2019
@lenaorobei lenaorobei added accepted New rule is accepted and removed on hold The issue or PR is on hold. labels Aug 16, 2019
@lenaorobei lenaorobei merged commit f14d045 into develop Aug 16, 2019
@lenaorobei lenaorobei deleted the 21-system-resources branch September 16, 2019 19:28
magento-devops-reposync-svc pushed a commit that referenced this pull request Sep 28, 2021
…oding-standard-289

[Imported] AC-1339: Detect comment for typed class properties
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.

4 participants