PHP code example of suralc / pvra

1. Go to this page and download the library: Download suralc/pvra 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/ */

    

suralc / pvra example snippets




trait Gamma
{
    public function test(callable $abc, ...$vars) {
        return $this->test()['abc'];
    }
}



// autoloading and namespace import is assumed

$analyser = new \Pvra\StringAnalyser(' trait abc{}');

$analyser->attachRequirementVisitor(new Php54Features);
$analyser->attachRequirementVisitor(new Php55Features);
$analyser->attachRequirementVisitor(new Php56Features);
$analyser->attachRequirementVisitor(new LibraryChanges);

$result = $analyser->run();

echo $result->getRequiredVersion(), PHP_EOL; // 5.4.0

foreach($result as $r) {
    echo $r['msg'], PHP_EOL; // Outputs: Usage of the trait keyword 

Running analysis for "./tests/readme_example.php"
Required version: 5.6.0
+---------+-----------------------------------------------+------+
| Version | Message                                       | Line |
+---------+-----------------------------------------------+------+
| 5.6.0   | Variadic arguments