Skip to content

#29: [New Rule] Exceptions must not be handled in the same function #43

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 5 commits into from
Mar 4, 2019

Conversation

larsroettig
Copy link
Member

see #29

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.

Could you please move sniff under Exceptions folder. It looks like more appropriate place for this check.

@larsroettig
Copy link
Member Author

@lenaorobei fixes for review done

@danmooney2
Copy link
Member

Exceptions that throw with only one catch block pass.
This one fails correctly:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento;

/**
 * Doer
 */
class Doer
{
    /**
     * Do Something
     */
    public function doSomething()
    {
        try {
            $result = 2;
        } catch (\DummyException $e) {
            throw $e;
        } catch (\NewException $e) {
            throw $e;
        }

        return $result;
    }
}

But this passes:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento;

/**
 * Doer
 */
class Doer
{
    /**
     * Do Something
     */
    public function doSomething()
    {
        try {
            $result = 2;
        } catch (\DummyException $e) {
            throw $e;
        }

        return $result;
    }
}

Am I missing something?

@larsroettig
Copy link
Member Author

@danmooney2 Can you open a bug report than I take a look.
king regards,

Lars

@danmooney2
Copy link
Member

@larsroettig #93

@larsroettig
Copy link
Member Author

Thanks, I will take a look this week

magento-devops-reposync-svc pushed a commit that referenced this pull request Sep 1, 2021
…-coding-standard-247

[Imported] AC-953: Create unit test for Magento2\Less\TypeSelectorConcatenationSniff check
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