Skip to content

Commit

Permalink
Removed deprecated UnusedPrivateElementsSniff
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Nov 27, 2020
1 parent 4837c51 commit bcbf756
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 1,529 deletions.
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,21 +290,6 @@ Requires using combined assignment operators, eg `+=`, `.=` etc.

### Cleaning - detecting dead code

#### SlevomatCodingStandard.Classes.UnusedPrivateElements 🚧

**DEPRECATED**
See https://phpstan.org/blog/detecting-unused-private-properties-methods-constants

Although PHP_CodeSniffer is not suitable for static analysis because it is limited to analysing one file at a time, it is possible to use it to perform certain checks. `UnusedPrivateElementsSniff` checks for unused methods, unused or write-only properties in a class and unused private constants. Reported unused elements are safe to remove.

This is very useful during refactoring to clean up dead code and injected dependencies.

Sniff provides the following settings:

* `alwaysUsedPropertiesAnnotations`: mark certain properties as always used, for example the ones with `@ORM\Column`
* `alwaysUsedPropertiesSuffixes`: mark properties with name ending with a certain string to be always marked as used
* `alwaysUsedMethodsAnnotations`: mark certain methods as always used, for example the ones with `@Serializer\PostDeserialize`

#### SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure 🔧

Looks for unused inherited variables passed to closure via `use`.
Expand Down
Loading

0 comments on commit bcbf756

Please sign in to comment.