Skip to content

Displays Deprecation Warnings Inside the Code Editor #76

@danfoley

Description

@danfoley

Describe the bug
When there is a deprecation warning output from phpcs, sniffer will display it inside the editor

To Reproduce
Steps to reproduce the behavior:

  • Run on any set of sniffs where there is deprecation. (for example doctrine coding standard 10.0)

Expected behavior

  • Deprecation error should not be inserted into the code of the editor, it should be displayed in the console as a warning.

Environment

  • Mac OS (latest)
  • Latest versions of phpcs and sniffer

Additional context
Run phpcs in the cli and you get this:

/app $ phpcs
WARNING: The  standard uses 1 deprecated sniff
------------------------------------------------------------------------------------------------------------------
-  SlevomatCodingStandard.TypeHints.UnionTypeHintFormat
   This sniff has been deprecated since Slevomat Coding Standard 8.16.0 and will be removed in Slevomat Coding
   Standard 9.0.0. Use SlevomatCodingStandard.TypeHints.DNFTypeHintFormat instead.

Deprecated sniffs are still run, but will stop working at some point in the future.

php sniff will run and put the same warning on the top of your code in your editor window.

�[33mWARNING: The  standard uses 1 deprecated sniff�[0m
--------------------------------------------------------------------------------
-  �[36mSlevomatCodingStandard.TypeHints.UnionTypeHintFormat�[0m
   This sniff has been deprecated since Slevomat Coding Standard 8.16.0 and
   will be removed in Slevomat Coding Standard 9.0.0. Use
   SlevomatCodingStandard.TypeHints.DNFTypeHintFormat instead.

Deprecated sniffs are still run, but will stop working at some point in the
future.

<?php

declare(strict_types=1);
....

PHP Sniffer should be able to detect a warning error and put it in the right place rather then inserting it into the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions