<commit_before><?php declare(strict_types = 1);

namespace Mikulas\Transpiler;

use Mikulas\Transpiler\Modifiers\ExpandMultiCatchHandler;
use Mikulas\Transpiler\Modifiers\RemoveClassConstantVisibility;
use Mikulas\Transpiler\Modifiers\RemoveIterableParameterType;
use Mikulas\Transpiler\Modifiers\RemoveIterableReturnType;
use Mikulas\Transpiler\Modifiers\RemoveNullableReturnValues;
use Mikulas\Transpiler\Modifiers\RemoveVoidReturnType;
use Mikulas\Transpiler\Modifiers\ExpandNamedAssignment;
use Mikulas\Transpiler\Modifiers\RewriteClosureFromCallable;
use Mikulas\Transpiler\Modifiers\RewriteNullableParameterType;
use PhpParser\Node;
use PhpParser\NodeTraverser;


class Transpiler
{

	/** @var NodeTraverser */
	private $traverser;


	public function __construct()
	{
		$variableFactory = new VariableFactory();

		$this->traverser = new NodeTraverser(TRUE);
		$this->traverser->addVisitor(new RemoveClassConstantVisibility());
		$this->traverser->addVisitor(new RemoveVoidReturnType());
		$this->traverser->addVisitor(new ExpandNamedAssignment($variableFactory));
		$this->traverser->addVisitor(new RemoveNullableReturnValues());
		$this->traverser->addVisitor(new RewriteNullableParameterType());
		$this->traverser->addVisitor(new RemoveIterableReturnType());
		$this->traverser->addVisitor(new RemoveIterableParameterType());
		$this->traverser->addVisitor(new RewriteClosureFromCallable());
		$this->traverser->addVisitor(new ExpandMultiCatchHandler());
	}


	/**
	 * @param Node[] $nodes
	 * @return Node[]
	 */
	public function transpile(array $nodes): array<commit_msg>add Transpiler::VERSION<commit_after><?php declare(strict_types = 1);

namespace Mikulas\Transpiler;

use Mikulas\Transpiler\Modifiers\ExpandMultiCatchHandler;
use Mikulas\Transpiler\Modifiers\RemoveClassConstantVisibility;
use Mikulas\Transpiler\Modifiers\RemoveIterableParameterType;
use Mikulas\Transpiler\Modifiers\RemoveIterableReturnType;
use Mikulas\Transpiler\Modifiers\RemoveNullableReturnValues;
use Mikulas\Transpiler\Modifiers\RemoveVoidReturnType;
use Mikulas\Transpiler\Modifiers\ExpandNamedAssignment;
use Mikulas\Transpiler\Modifiers\RewriteClosureFromCallable;
use Mikulas\Transpiler\Modifiers\RewriteNullableParameterType;
use PhpParser\Node;
use PhpParser\NodeTraverser;


class Transpiler
{

	const VERSION = '1.0.0';

	/** @var NodeTraverser */
	private $traverser;


	public function __construct()
	{
		$variableFactory = new VariableFactory();

		$this->traverser = new NodeTraverser(TRUE);
		$this->traverser->addVisitor(new RemoveClassConstantVisibility());
		$this->traverser->addVisitor(new RemoveVoidReturnType());
		$this->traverser->addVisitor(new ExpandNamedAssignment($variableFactory));
		$this->traverser->addVisitor(new RemoveNullableReturnValues());
		$this->traverser->addVisitor(new RewriteNullableParameterType());
		$this->traverser->addVisitor(new RemoveIterableReturnType());
		$this->traverser->addVisitor(new RemoveIterableParameterType());
		$this->traverser->addVisitor(new RewriteClosureFromCallable());
		$this->traverser->addVisitor(new ExpandMultiCatchHandler());
	}


	/**
	 * @param Node[] $nodes
	 * @return Node[]
	 */
	public function transpile(array $nodes): array
{'fraction_non_alphanumeric': 0.11801436153605994, 'fraction_numerical': 0.0015610365282547611, 'mean_word_length': 7.706521739130435, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3208392', 'n_tokens_mistral': 1036, 'n_tokens_neox': 977, 'n_words': 143}