I am trying to play with php7. I installed https://github.com/rlerdorf/php7dev and connected via phpstorm. I am trying to use a new function like this:
<?php
namespace Kata;
class StringCalculator
{
public function add(string $parameters): int {
return 0;
}
}
then I try to check it like this:
<?php
namespace Kata;
class StringCalculatorTest extends \PHPUnit_Framework_TestCase
{
public function testAddEmptyString()
{
$calc = new StringCalculator();
$this->assertSame(0, $calc->add(''));
}
}
and I run with phpunit, unfortunately I have
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{'
I may not have installed php7 correctly, but everything seems to be fine when I php -v
PHP 7.0.0-dev (cli) (Build: May 25, 2015 16:34:33) (DEBUG) Copyright (c) 1997-2015 PHP Group Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, Zend Technologies
UPDATE
/ php7 ( ), , cli, :
<?php
$calc = new Kata\StringCalculator();
var_dump($calc->add(''));
int(0)
.
phpunit?