for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MediaMonks\RestApi\Response;
use Symfony\Component\HttpFoundation\Response as BaseResponse;
class Response extends BaseResponse implements
ExtendedResponseInterface
{
protected mixed $customContent;
/**
* @param mixed $data The response data
* @param int $status The response status code
* @param array $headers An array of response headers
* @param bool $json If the data is already a JSON string
*/
public function __construct($data = null, int $status = 200, array $headers = [], bool $json = false)
$json
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function __construct($data = null, int $status = 200, array $headers = [], /** @scrutinizer ignore-unused */ bool $json = false)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
parent::__construct('', $status, $headers);
if (null === $data) {
$data = new \ArrayObject();
}
$this->setCustomContent($data);
* Sets the response content.
*
* We need to allow all sorts of content, not just the ones the regular Response setContent() allows
* @param mixed $content
* @return Response
* @api
public function setCustomContent(mixed $content): static
$this->customContent = $content;
return $this;
public function getCustomContent(): mixed
return $this->customContent;
public function setContent(?string $content): static
return parent::setContent($content);
return parent::setContent($content)
Symfony\Component\HttpFoundation\Response
MediaMonks\RestApi\Response\Response
public function getContent(): string|false
return serialize($this->customContent);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.