From 85c9b6bb442039c773120059ae35a31f8ef9d488 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Fri, 9 Aug 2019 11:40:46 -0400 Subject: [PATCH] Add documentation for automatically removing UnusedVariable --- docs/manipulating_code/fixing.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/manipulating_code/fixing.md b/docs/manipulating_code/fixing.md index 4397a761e..2d1927eb7 100644 --- a/docs/manipulating_code/fixing.md +++ b/docs/manipulating_code/fixing.md @@ -426,3 +426,28 @@ class A { new A(); ``` + +### UnusedVariable + +This removes unused variables. + +Running `vendor/bin/psalter --issues=UnusedVariable` on + +```php +function foo() : void { + $a = 5; + $b = 6; + $c = $d = $a + $b; + echo "foo"; +} +``` + +gives + +```php +function foo() : void { + $a = 5; + $b = 6; + echo "foo"; +} +```