Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nilportugues/php_backslasher
Browse files Browse the repository at this point in the history
  • Loading branch information
Nil Portugués committed Nov 3, 2015
2 parents e68ffd8 + cc38f84 commit 8564b7f
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 387 deletions.
40 changes: 8 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,30 @@ Function resolution without the backslash forces the PHP internals to verify for
**Idea from Nikita Popov talk**:
- [PHP 7 – What changed internally? (PHP Barcelona 2015)](http://www.slideshare.net/nikita_ppv/php-7-what-changed-internally-php-barcelona-2015) (slide [72](http://image.slidesharecdn.com/php7internals-151101105627-lva1-app6891/95/php-7-what-changed-internally-php-barcelona-2015-72-638.jpg?cb=1446375542))

## Usage

```
$ php bin/php_backslasher fix <path/to/directory>
```


## Installation

### As a dependency using Composer
Use [Composer](https://getcomposer.org) to install the package:

```
$ composer require nilportugues/php_backslasher
```

### As a PHAR file

You can also use already last built `.phar`.
## Usage

``` bash
$ git clone [email protected]:nilportugues/php_backslasher.git
$ cd php_backslasher
$ php build/php_backslasher.phar
```

You can copy the `.phar` file as a global script

``` bash
$ cp build/php_backslasher.phar /usr/local/bin/php_backslasher
$ php bin/php_backslasher fix <path/to/directory>
```

###Output

## Building the PHAR:
Works for function in conditional statements, negative conditionals, placed in an array as key or value and any other normal use.

While the PHAR file is included under `bin/php_backslasher`, but can be built using the following command:
```php
echo strlen('Hello World');

// becomes:
echo \strlen('Hello World');
```
$ php -d phar.readonly=false box.phar build
```

You may also like to make it runnable by just giving it permissions to be used as an executable file and hide its extension.

```
$ chmod 755 bin/php_backslasher.phar
$ mv bin/php_backslasher.phar bin/php_backslasher
```



## Contribute
Expand Down
18 changes: 0 additions & 18 deletions bin/compile

This file was deleted.

24 changes: 2 additions & 22 deletions bin/php_backslasher
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../src/bootstrap.php';

/**
* This file is part of the php_backslasher package
*
* Copyright (c) 2014 Marc Morera
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Feel free to edit as you please, and have fun.
*
* @author Marc Morera <[email protected]>
*/

require __DIR__ . '/../src/bootstrap.php';

use NilPortugues\BackslashFixer\Console\Application;

error_reporting(-1);
ini_set('display_errors', 1);

// run the command application
$application = new Application();
$application = new \NilPortugues\BackslashFixer\Console\Application();
$application->run();
Empty file removed build/.gitkeep
Empty file.
4 changes: 0 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
"fabpot/php-cs-fixer": "1.4.2",
"phpunit/phpunit": "4.5.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0",
"fabpot/php-cs-fixer": "^2.0@dev"
},
"autoload": {
"psr-4": {
"NilPortugues\\BackslashFixer\\": "src/BackslashFixer/"
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
</filter>

<logging>
<log type="junit" target="build_test/junit.xml"/>
<log type="coverage-clover" target="build_test/logs/clover.xml"/>
<log type="coverage-html" target="build_test/coverage"/>
<log type="junit" target="build/junit.xml"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-html" target="build/coverage"/>
</logging>
</phpunit>
Loading

0 comments on commit 8564b7f

Please sign in to comment.