for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Loevgaard\AltaPay\Entity;
use Loevgaard\AltaPay\Hydrator\HydratableInterface;
class CreditCardExpiry implements HydratableInterface
{
/**
* @var int
*/
private $year;
private $month;
public function hydrateXml(\SimpleXMLElement $xml)
if (!isset($xml->CreditCardExpiry)) {
return;
}
$this->year = (string)$xml->CreditCardExpiry->Year;
$year
integer
(string) $xml->CreditCardExpiry->Year
string
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
$this->month = (string)$xml->CreditCardExpiry->Month;
$month
(string) $xml->CreditCardExpiry->Month
* @return int
public function getYear(): ?int
return $this->year;
public function getMonth(): ?int
return $this->month;
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.