Preconditions
Steps to reproduce
- Run phpcs with --standard=Magento2 against file containing multiple catch blocks (it fails as it should):
<?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;
}
}
Run phpcs with --standard=Magento2 against file containing one catch block (it passes when it should not):
<?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;
}
}
Expected result
- Both files should fail Magento.Exceptions.ThrowCatch rule
Actual result
- Only file with two catch blocks fails Magento.Exceptions.ThrowCatch rule
Preconditions
Steps to reproduce
Run phpcs with --standard=Magento2 against file containing one catch block (it passes when it should not):
Expected result
Actual result