for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ups\Entity;
use DOMDocument;
/**
* @author Eduard Sukharev <[email protected]>
*/
class BillShipper
{
* @var string
private $accountNumber;
* @var CreditCard
private $creditCard;
* @param \stdClass|null $attributes
public function __construct(\stdClass $attributes = null)
if (isset($attributes->AccountNumber)) {
$this->setAccountNumber($attributes->AccountNumber);
}
if (isset($attributes->CreditCard)) {
$this->setAccountNumber(new CreditCard($attributes->CreditCard));
new \Ups\Entity\CreditCa...attributes->CreditCard)
object<Ups\Entity\CreditCard>
string
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
* @param null|DOMDocument $document
*
* @return DOMElement
public function toNode(DOMDocument $document = null)
if (is_null($document)) {
$document = new DOMDocument();
$node = $document->createElement('BillShipper');
if ($this->getAccountNumber()) {
$node->appendChild($document->createElement('AccountNumber', $this->getAccountNumber()));
return $node;
* @return string
public function getAccountNumber()
return $this->accountNumber;
* @param string $accountNumber
* @return BillShipper
public function setAccountNumber($accountNumber)
$this->accountNumber = $accountNumber;
return $this;
* @return CreditCard
public function getCreditCard()
return $this->creditCard;
* @param CreditCard $creditCard
public function setCreditCard(CreditCard $creditCard)
$this->creditCard = $creditCard;
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: