Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[New Rule] No try block detected when processing system resources #21

Copy link
Copy link
Closed
@lenaorobei

Description

@lenaorobei
Issue body actions

Rule

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.

Reason

Source: Magento Technical Guidelines.

Implementation

  • Subscribe to T_STRING token.
  • Prepare the list of build in PHP functions that use resources or alternatively functions prefixes (stream_, socket_, etc)
  • Check if token content is in_array of system functions.
  • Raise a warning if no outer try statement detected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedNew rule is acceptedNew rule is acceptednew ruleNew feature implementationNew feature implementationon holdThe issue or PR is on hold.The issue or PR is on hold.technical guidelinesThe rule is based on Magento Technical GuidelinesThe rule is based on Magento Technical Guidelines

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.