codeclimate / codeclimate-phpcodesniffer

Code Climate Engine for PHP Code Sniffer
MIT License
28 stars 23 forks source link

ReturnTypeWillChange attribute triggers error, false positive #99

Open dafeder opened 11 months ago

dafeder commented 11 months ago

#[\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() {