Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Returning void on method makes the whole class unable to use plugins #33

Closed
@paales

Description

@paales

Important: use 2.3-develop as a target branch.

Steps to reproduce

  1. Create a class with a void return type:
class MyClass {
    public function myFunction(): void
    {
        // do something
    }
}
  1. Create a plugin for the class.

Expected result

  1. Plugin should work correctly.

Actual result

  1. It actually has a return statement in the plugin and it doesn't have the return type void.
Fatal error: A void function must not return a value in /data/web/magento2/dev/tests/integration/tmp/sandbox-0-77789c881f346521512f1309f07ad08b/generated/code/ReachDigital/ProophEventStore/Infrastructure/CommandBus/Interceptor.php on line 24

Call Stack:
    0.0002     352328   1. {main}() /data/web/magento2/vendor/phpunit/phpunit/phpunit:0
    0.0515    1523360   2. PHPUnit\TextUI\Command::main() /data/web/magento2/vendor/phpunit/phpunit/phpunit:53
    0.0515    1523472   3. PHPUnit\TextUI\Command->run() /data/web/magento2/vendor/phpunit/phpunit/src/TextUI/Command.php:141
   50.0469   48418624   4. PHPUnit\TextUI\TestRunner->doRun() /data/web/magento2/vendor/phpunit/phpunit/src/TextUI/Command.php:212
   50.0548   48644672   5. PHPUnit\Framework\TestSuite->run() /data/web/magento2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:537
   55.6931   70004224   6. PHPUnit\Framework\TestSuite->run() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestSuite.php:744
   55.6959   70004736   7. ReachDigital\ProophEventStore\Test\Integration\Command\RegisterUserTest->run() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestSuite.php:744
   55.6959   70004736   8. PHPUnit\Framework\TestResult->run() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php:883
   55.7131   67091784   9. ReachDigital\ProophEventStore\Test\Integration\Command\RegisterUserTest->runBare() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestResult.php:695
   55.7136   67108424  10. ReachDigital\ProophEventStore\Test\Integration\Command\RegisterUserTest->runTest() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php:928
   55.7136   67108720  11. ReflectionMethod->invokeArgs() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php:1069
   55.7136   67108728  12. ReachDigital\ProophEventStore\Test\Integration\Command\RegisterUserTest->command_and_event_bus_are_correctly_instantiated() /data/web/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php:1069
   55.7136   67108728  13. ReachDigital\ProophEventStore\Test\Integration\Command\RegisterUserTest->commandBusInstance() /data/web/magento2/app/code/ReachDigital/ProophEventStore/Test/Integration/Command/RegisterUserTest.php:53
   55.7222   67675464  14. Magento\TestFramework\ObjectManager->create() /data/web/magento2/app/code/ReachDigital/ProophEventStore/Test/Integration/Command/RegisterUserTest.php:42
   55.7222   67675464  15. Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() /data/web/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php:56
   55.7227   67692088  16. Magento\Framework\ObjectManager\Definition\Runtime->getParameters() /data/web/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:48
   55.7227   67692088  17. Magento\Framework\Code\Reader\ClassReader->getConstructor() /data/web/magento2/vendor/magento/framework/ObjectManager/Definition/Runtime.php:44
   55.7227   67692200  18. ReflectionClass->__construct() /data/web/magento2/vendor/magento/framework/Code/Reader/ClassReader.php:19
   55.7227   67692392  19. spl_autoload_call() /data/web/magento2/vendor/magento/framework/Code/Reader/ClassReader.php:19
   55.7227   67692488  20. Magento\Framework\Code\Generator\Autoloader->load() /data/web/magento2/vendor/magento/framework/Code/Reader/ClassReader.php:19
   55.7227   67692488  21. Magento\Framework\Code\Generator->generateClass() /data/web/magento2/vendor/magento/framework/Code/Generator/Autoloader.php:35
   55.7253   67709752  22. Magento\Framework\Code\Generator\Io->includeFile() /data/web/magento2/vendor/magento/framework/Code/Generator.php:118

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions