PHP code example of wata727 / pahout

1. Go to this page and download the library: Download wata727/pahout library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wata727 / pahout example snippets




// Do something...

$response = get_awesome_response();
$error = isset($response['error']) ? $response['error'] : null;

// Do something...




// Do something...

$response = get_awesome_response();
$error = $response['error'] ?? null; # Great!

// Do something...




/** @rebel NullCoalescingOperator */
$error = isset($response['error']) ? $response['error'] : null;



/**
* @rebel NullCoalescingOperator
*/
$error = isset($response['error']) ? $response['error'] : null;

$error = isset($response['error']) ? $response['error'] : null; # @rebel NullCoalescingOperator

$ pahout --php-version 7.1.8 test.php
test.php:8
    NullCoalescingOperator: Use the null coalecing operator instead of the ternary operator. [https://github.com/wata727/pahout/blob/master/docs/NullCoalescingOperator.md]

1 files checked, 1 hints detected.

$ pahout --php-version 7.1.8 test.php test2.php ...

$ pahout --php-version 7.1.8 src
yaml
php_version: 7.0.0
ignore_tools:
    - ShortArraySyntax
ignore_paths:
    - tests
    - bin
extensions:
    - php
    - module
    - inc
vendor: true