for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Adelarcubs\OFXParser;
use PHPUnit_Framework_TestCase;
use SimpleXMLElement;
/**
*
* @author Adelar Tiemann Junior <[email protected]>
*/
class OfxTest extends PHPUnit_Framework_TestCase
{
private $ofx;
protected function setUp()
// $this->ofx = new Ofx(new SimpleXMLElement('fixtures/data.ofx'));
$this->ofx = Ofx::loadFromFile(__DIR__ . '/fixtures/data.ofx');
__DIR__ . '/fixtures/data.ofx'
string
object<Adelarcubs\OFXParser\unknown>
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);
}
* @test
public function constructorShouldConfigureAttributes()
$this->assertInstanceOf(Ofx::class, $this->ofx);
* @expectedException InvalidArgumentException
public function invalidFile(){
$ofx = Ofx::loadFromFile('Anywhere');
'Anywhere'
$ofx
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
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: