1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-26 14:08:59 +02:00

Merge pull request #72 from peter-gribanov/remove_dead_code_cs

Correct CS in Remove dead code
This commit is contained in:
Tomáš Votruba
2017-09-05 18:16:35 +02:00
committed by GitHub

View File

@@ -873,34 +873,40 @@ function combine(int $val1, int $val2)
**[⬆ back to top](#table-of-contents)** **[⬆ back to top](#table-of-contents)**
### Remove dead code ### Remove dead code
Dead code is just as bad as duplicate code. There's no reason to keep it in Dead code is just as bad as duplicate code. There's no reason to keep it in
your codebase. If it's not being called, get rid of it! It will still be safe your codebase. If it's not being called, get rid of it! It will still be safe
in your version history if you still need it. in your version history if you still need it.
**Bad:** **Bad:**
```php ```php
function oldRequestModule($url) { function oldRequestModule($url)
{
// ... // ...
} }
function newRequestModule($url) { function newRequestModule($url)
{
// ... // ...
} }
$request = newRequestModule($requestUrl); $request = newRequestModule($requestUrl);
inventoryTracker('apples', $request, 'www.inventory-awesome.io'); inventoryTracker('apples', $request, 'www.inventory-awesome.io');
``` ```
**Good**: **Good:**
```php ```php
function requestModule($url) { function requestModule($url)
{
// ... // ...
} }
$request = requestModule($requestUrl); $request = requestModule($requestUrl);
inventoryTracker('apples', $request, 'www.inventory-awesome.io'); inventoryTracker('apples', $request, 'www.inventory-awesome.io');
``` ```
**[⬆ back to top](#table-of-contents)** **[⬆ back to top](#table-of-contents)**