skqr/hateoas

View on GitHub
JsonApi/ResourceCollection.php

Summary

Maintainability
A
0 mins
Test Coverage

Remove error control operator '@' on line 54.
Open

    public static function buildFromArray(array $resources)
    {
        $resource = @$resources[0];

        if (!$resource instanceof EntityResource) {
Severity: Minor
Found in JsonApi/ResourceCollection.php by phpmd

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

The implements keyword must be on the same line as the class name
Open

    implements ResourceCollectionInterface

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL"
Open

        ResourceMetadata $metadata = NULL

The extends keyword must be on the same line as the class name
Open

    extends ArrayCollection

There are no issues that match your filters.

Category
Status