I've just started learning phpspec with a view to replacing PHPUnit. Unfortunately, I've got rather hooked on using the PHPStorm editor's code completion feature, which makes even PHPUnit's verbose mock interface very quick to type.
No such luck with phpspec. Given a class like this:
<?php
namespace spec\MyVendor\MyClass;
use PhpSpec\ObjectBehavior;
class MyClassSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('MyVendor\MyClass');
}
function it_should_do_something()
{
$this->???
}
}
Firstly, shouldHaveType
is showing the 'method not found' highlight, and secondly, if I try to autocomplete at the ???
point, my options are limited to the few methods in ObjectBehaviour
. I would want to see things like shouldHaveType
, shouldImplement
, and many more.
I've found this phpspec-stubs repository on Github, but it seems to only have one method defined, and requires extending a wrapper class.
There's also a PHPStorm plugin but it's not clear to me if this should provide auto-complete, and the current version gives me a NullPointerException in PHPStorm immediately on entering any PHP file.
So, are all you phpspec users typing a lot, or is there another solution?
@mixin
annotation before. Thank you. Thank you. – Kerwon