Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

engine/classes/Elgg/Http/HttpProtocolTransport.php (1 issue)

Checks if the types of returned expressions are compatible with the documented types.

Best Practice Bug Major
1
<?php
2
3
namespace Elgg\Http;
4
5
use Elgg\Http\ResponseTransport;
6
use Symfony\Component\HttpFoundation\Response;
7
8
/**
9
 * Transport for sending responses to HTTP clients via HTTP protocol
10
 *
11
 * @since 2.3
12
 * @access private
13
 */
14
class HttpProtocolTransport implements ResponseTransport {
15
	
16
	/**
17
	 * {@inheritdoc}
18
	 */
19
	public function send(Response $response) {
20
		return $response->send();
0 ignored issues
show
Bug Best Practice introduced by Ismayil Khayredinov
The expression return $response->send() returns the type Symfony\Component\HttpFoundation\Response which is incompatible with the return type mandated by Elgg\Http\ResponseTransport::send() of boolean.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
21
	}
22
23
}
24