How to remove the purple "duplicated code fragment" highlighting in PhpStorm?

  • Simply hit the ESC key to remove that highlighting.

  • If the IDE is finding "Duplicate code fragments" between your source code and a copy of it in an output directory (like Python setup.py creates in a build/ directory; I don't know how this goes in PHP), then mark the output directory as excluded from source directories.

    Right-click the output directory in the Project View, then Mark Directory As > Excluded.

BTW, this works in PyCharm and IntelliJ as well, and presumably in all the JetBrains IDEs.


Just re-open the file/project - it will remove the highlighting. If you don't like the "Duplicate code fragment" violation to be reported for your code fragment, try suppressing inspection for statement by adding // noinspection DuplicatedCode before it.

There is a request for making the duplicates highlighting less aggressive, IDEA-210614, please feel fre to vote for it