Ratchet icon indicating copy to clipboard operation
Ratchet copied to clipboard

User Deprecated: Method "IteratorAggregate::getIterator()" might add "Traversable" as a native return type

Open SergeC opened this issue 3 years ago • 1 comments

I'm using Pawl in my Symfony 5.4 command started with -vvv flag. I'm getting deprecation notices: 1.

/usr/local/bin/php bin/console my:pawl -vvv
18:30:47 INFO      [php] User Deprecated: Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Ratchet\RFC6455\Messaging\Message" now to avoid errors or add an explicit @return annotation to suppress this message.
[
  "exception" => ErrorException {
    #message: "User Deprecated: Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Ratchet\RFC6455\Messaging\Message" now to avoid errors or add an explicit @return annotation to suppress this message."
    #code: 0
    #file: "vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 325
    #severity: E_USER_DEPRECATED
    trace: {
      vendor/symfony/error-handler/DebugClassLoader.php:325 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:362 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:206 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:194 { …}
      vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123 { …}
      vendor/react/stream/src/Util.php:71 { …}
      vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123 { …}
      vendor/react/stream/src/DuplexResourceStream.php:196 { …}
      vendor/react/event-loop/src/StreamSelectLoop.php:245 { …}
      vendor/react/event-loop/src/StreamSelectLoop.php:212 { …}
      src/Command/MyCommand.php:75 {
        App\Command\MyCommand->execute(InputInterface $input, OutputInterface $output): int
        › 
        › $loop->run();
        › 
      }
      vendor/symfony/console/Command/Command.php:298 { …}
      vendor/symfony/console/Application.php:1023 { …}
      vendor/symfony/framework-bundle/Console/Application.php:96 { …}
      vendor/symfony/console/Application.php:299 { …}
      vendor/symfony/framework-bundle/Console/Application.php:82 { …}
      vendor/symfony/console/Application.php:171 { …}
      vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …}
      vendor/autoload_runtime.php:35 { …}
      bin/console:11 { …}
    }
  }
]
18:30:47 INFO      [php] User Deprecated: Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Ratchet\RFC6455\Messaging\Message" now to avoid errors or add an explicit @return annotation to suppress this message.
[
  "exception" => ErrorException {
    #message: "User Deprecated: Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Ratchet\RFC6455\Messaging\Message" now to avoid errors or add an explicit @return annotation to suppress this message."
    #code: 0
    #file: "vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 325
    #severity: E_USER_DEPRECATED
    trace: {
      vendor/symfony/error-handler/DebugClassLoader.php:325 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:362 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:206 { …}
      vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php:194 { …}
      vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123 { …}
      vendor/react/stream/src/Util.php:71 { …}
      vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123 { …}
      vendor/react/stream/src/DuplexResourceStream.php:196 { …}
      vendor/react/event-loop/src/StreamSelectLoop.php:245 { …}
      vendor/react/event-loop/src/StreamSelectLoop.php:212 { …}
      src/Command/MyCommand.php:75 {
        App\Command\MyCommand->execute(InputInterface $input, OutputInterface $output): int
        › 
        › $loop->run();
        › 
      }
      vendor/symfony/console/Command/Command.php:298 { …}
      vendor/symfony/console/Application.php:1023 { …}
      vendor/symfony/framework-bundle/Console/Application.php:96 { …}
      vendor/symfony/console/Application.php:299 { …}
      vendor/symfony/framework-bundle/Console/Application.php:82 { …}
      vendor/symfony/console/Application.php:171 { …}
      vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …}
      vendor/autoload_runtime.php:35 { …}
      bin/console:11 { …}
    }
  }
]

PHP 7.4.12 "ratchet/pawl": "^0.4.1"

SergeC avatar Jan 26 '22 20:01 SergeC

This should be reported on the https://github.com/ratchetphp/RFC6455 repo as it'll have to be fixed there (for this specific case at least).

The TL;DR is that all the places that the #[ReturnTypeWillChange] attribute was added only silences the PHP deprecations. Symfony's debug loader will emit a deprecation if either there is no native return type or if there isn't an appropriate @return annotation in the method's doc block (and @inheritdoc is ignored in the debug loader).

mbabker avatar Jan 27 '22 15:01 mbabker