codeclimate-phpcodesniffer icon indicating copy to clipboard operation
codeclimate-phpcodesniffer copied to clipboard

ReturnTypeWillChange attribute triggers error, false positive

Open dafeder opened this issue 1 year ago • 0 comments

#[\ReturnTypeWillChange] is an attribute added in PHP 8.1, which "signals that a mismatching tentative return type should not emit a deprecation notice". In my local environment, this is not throwing any errors in PHPCS, but CodeClimate reports it as an error:

image

The actual attribute can't be seen there, but the code being checked looks like this:

  /**
   * {@inheritDoc}
   */
  #[\ReturnTypeWillChange]
  public function jsonSerialize() {

dafeder avatar Nov 03 '23 21:11 dafeder