src/Plugin/migrate/process/ImageDimensionSkip.php
Remove error control operator '@' on line 123. Open
Open
protected function getImageSize(string $url): bool|array {
try {
return @getimagesize($url);
}
catch (\Exception $e) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Avoid assigning values to variables in if clauses and the like (line '102', column '9'). Open
Open
protected function isImageBigger($value) {
if (!is_string($value)) {
return FALSE;
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
syntax error, unexpected '|', expecting ';' or '{'
Open
Open
protected function getImageSize(string $url): bool|array {
- Exclude checks
Variable $width is undefined. Invalid
Invalid
$valid_width = empty($this->configuration['width']) ? TRUE : $this->configuration['width'] <= $width;
- Exclude checks
Variable $height is undefined. Invalid
Invalid
$valid_height = empty($this->configuration['height']) ? TRUE : $this->configuration['height'] <= $height;
- Exclude checks
Expected 1 space after "|"; 0 found Open
Open
protected function getImageSize(string $url): bool|array {
- Exclude checks
Variable $height is undefined. Open
Open
[$width, $height] = $size;
- Exclude checks
Expected 1 space before "|"; 0 found Open
Open
protected function getImageSize(string $url): bool|array {
- Exclude checks
Variable $width is undefined. Open
Open
[$width, $height] = $size;
- Exclude checks