src/SClient.php
Avoid using empty try-catch blocks in __construct. Open
Open
} catch (NuggetException $ex) {
}
- Read upRead up
- Exclude checks
EmptyCatchBlock
Since: 2.7.0
Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.
Example
class Foo {
public function bar()
{
try {
// ...
} catch (Exception $e) {} // empty catch block
}
}
Source https://phpmd.org/rules/design.html#emptycatchblock
Saw an @param annotation for secret,
but it was not found in the param list of function __construct($config)
Open
Open
* @param string $secret
- Exclude checks
Saw an @param annotation for key,
but it was not found in the param list of function __construct($config)
Open
Open
* @param string $key
- Exclude checks
Either remove or fill this block of code. Open
Open
} catch (NuggetException $ex) {
}
- Read upRead up
- Exclude checks
Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.
Noncompliant Code Example
for ($i = 0; $i < 42; $i++){} // Empty on purpose or missing piece of code ?
Exceptions
When a block contains a comment, this block is not considered to be empty.
Possibly zero references to use statement for classlike/namespace S3Client
(\Aws\S3\S3Client)
Open
Open
use Aws\S3\S3Client;
- Exclude checks
Reference to undeclared class \Aws\S3\S3Client
Open
Open
parent::__construct($config);
- Exclude checks
Class extends undeclared class \Aws\S3\S3Client
Open
Open
class SClient extends \Aws\S3\S3Client
- Exclude checks
Blank line found at start of control structure Open
Open
} catch (NuggetException $ex) {
- Exclude checks
Whitespace found at end of line Open
Open
*
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks