Skip to content

Commit

Permalink
[CLEANUP] Some php code cleanups (#3)
Browse files Browse the repository at this point in the history
* [CLEANUP] Some php code cleanups

* [CLEANUP] New line removed

* [TASK] Readme code cleanups and ajustments
  • Loading branch information
Cyb10101 authored and Kanti committed Oct 18, 2017
1 parent 9784b3a commit 8f30377
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/vendor/
composer.lock

18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
[![Travis](https://img.shields.io/travis/Kanti/LJSON.svg?style=flat-square)](https://travis-ci.org/Pluswerk/grumphp-bom-task)
[![Code Climate](https://img.shields.io/codeclimate/github/pluswerk/grumphp-bom-task.svg?style=flat-square)](https://codeclimate.com/github/pluswerk/grumphp-bom-task)
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/69cf4b58-b856-4f79-a3da-a89291eae102.svg?style=flat-square)](https://insight.sensiolabs.com/projects/69cf4b58-b856-4f79-a3da-a89291eae102)

# grumphp-bom-task

Force files to have no BOM via GrumPHP

### grumphp.yml:

````yml
parameters:
tasks:
Expand All @@ -14,8 +18,13 @@ parameters:
extensions:
- PLUS\GrumPHPBomTask\ExtensionLoader
````
### upgrade from andersundsehr/grumphp-bom-task

### Upgrade from andersundsehr/grumphp-bom-task

If you come from [andersundsehr/grumphp-bom-task](https://github.com/andersundsehr/grumphp-bom-task), change the extensions Loader path in the grumphp.yml file.

from:

````yml
parameters:
tasks:
Expand All @@ -24,8 +33,9 @@ parameters:
extensions:
- AUS\GrumPHPBomTask\ExtensionLoader
````
from:

to:

````yml
parameters:
tasks:
Expand All @@ -34,5 +44,7 @@ parameters:
extensions:
- PLUS\GrumPHPBomTask\ExtensionLoader
````
### composer:

### Composer

``composer require --dev pluswerk/grumphp-bom-task``
11 changes: 5 additions & 6 deletions src/BomFixerTask.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace PLUS\GrumPHPBomTask;

use GrumPHP\Runner\TaskResult;
Expand Down Expand Up @@ -86,18 +85,18 @@ public function run(ContextInterface $context)
foreach ($files as $file) {
$execFile = $file->getPathname();
if ($this->isFileWithBOM($execFile)) {
$shouldGetFixedLog[] = $execFile . " has BOM and should be fixed";
$fixCommand .= " '" . $execFile . "'";
$shouldGetFixedLog[] = $execFile . ' has BOM and should be fixed';
$fixCommand .= ' \'' . $execFile . '\'';
}
}

if (count($shouldGetFixedLog) > 0) {
return TaskResult::createFailed(
$this,
$context,
implode(PHP_EOL, $shouldGetFixedLog) . PHP_EOL
. "you can use this to fix them:" . PHP_EOL .
$fixCommand
implode(PHP_EOL, $shouldGetFixedLog) . PHP_EOL .
'you can use this to fix them:' . PHP_EOL .
$fixCommand
);
}
return TaskResult::createPassed($this, $context);
Expand Down
1 change: 0 additions & 1 deletion src/ExtensionLoader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace PLUS\GrumPHPBomTask;

use GrumPHP\Extension\ExtensionInterface;
Expand Down

0 comments on commit 8f30377

Please sign in to comment.