Codeception/AspectMock

return void - php7.1 feature broken

zuozp8 opened this issue · 6 comments

when i declare method like
public function foo() : void { $foo = 3; }
then as soon as that method was parsed (with extra code was injected there by aspectmock/goaop) i get the exception PHP Fatal error: A void function must not return a value in …

i tried upgrading to aspectmock dev-master and goaop 2.1, but it didn't help

I have same problem on php:7.1.1

I'm writing unit tests using Codeception and Codeception/Stub for mocking void method and getting same error (php 7.1).

Any suggestion guys?

i'll prepare pull request

I'm using

PHP 7.1.17-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 5 2018 04:55:21) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.17-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

for Symfony 4.1, and getting the same error as 'must be an instance of void, none returned'.

must be an instance of void, none returned is different then A void function must not return a value in

are you sure you use php 7.1 when you running tests? see https://3v4l.org/grjtQ