PHP code example of stolt / coding-standard-migrator
1. Go to this page and download the library: Download stolt/coding-standard-migrator 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/ */
stolt / coding-standard-migrator example snippets
php
use Stolt\CodingStandardMigrator\Migration\MigrationEngine;
use Stolt\CodingStandardMigrator\Migration\MigrationRequest;
use Stolt\CodingStandardMigrator\Standard\Standard;
$engine = new MigrationEngine();
$request = new MigrationRequest(
from: Standard::PhpCsFixer,
to: Standard::Mago,
sourceFile: $engine->locateSourceConfiguration(Standard::PhpCsFixer, \getcwd()),
phpVersion: '8.3',
);
echo $engine->analyze($request)->confidence() . '%' . \PHP_EOL;
$result = $engine->migrate($request);
foreach ($result->report as $mapping) {
echo $mapping->sourceRule . ': ' . $mapping->outcome->label() . \PHP_EOL;
}
if ($result->isComplete()) {
\file_put_contents($result->targetFileName, $result->configuration);
}