PHP code example of carlos-granados / rector
1. Go to this page and download the library: Download carlos-granados/rector 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/ */
carlos-granados / rector example snippets
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
return RectorConfig::configure()
// register single rule
->withRules([
TypedPropertyFromStrictConstructorRector::class
])
// here we can define, what prepared sets of rules will be applied
->withPreparedSets(
deadCode: true,
codeQuality: true
);
use PhpParser\Node\Scalar\String_;
$node = new String_('hello world!');
// prints node to string, as PHP code displays it
print_node($node);