<commit_before>--TEST--
Ability to resolve types in PHP 7
--FILE--
<?php
require_once __DIR__ . '/../../vendor/autoload.php';

$source = <<<'EOF'
<?php

function myFunction(int $a, string $b = null): bool
{
}
EOF;

$sourceLocator = new Roave\BetterReflection\SourceLocator\Type\StringSourceLocator(
    $source,
    (new Roave\BetterReflection\BetterReflection())->astLocator()
);

$reflector = new \Roave\BetterReflection\Reflector\FunctionReflector(
    $sourceLocator,
    new \Roave\BetterReflection\Reflector\ClassReflector($sourceLocator)
);

$functionInfo = $reflector->reflect('myFunction');

$returnType = $functionInfo->getReturnType();

var_dump([
    'builtIn' => $returnType->isBuiltin(),
    'type' => $returnType->__toString(),
]);

array_map(function (\Roave\BetterReflection\Reflection\ReflectionParameter $param) {
    $type = $param->getType();

    var_dump([
        'builtIn' => $type->isBuiltin(),
        'type' => $type->__toString(),
    ]);
}, $functionInfo->getParameters());

?>
--EXPECTF--
array(2) {
  'builtIn' =>
  bool(true)
  'type' =>
  string(4) "bool"
}
array(2) {
  'builtIn' =>
  bool(true)
  'type' =>
  string(3) "int"
}
array(2) {
  'builtIn' =>
  bool(true)
  'type' =>
  string(6) "string"
}<commit_msg>Corrected expected dump string format<commit_after>--TEST--
Ability to resolve types in PHP 7
--FILE--
<?php
require_once __DIR__ . '/../../vendor/autoload.php';

$source = <<<'EOF'
<?php

function myFunction(int $a, string $b = null): bool
{
}
EOF;

$sourceLocator = new Roave\BetterReflection\SourceLocator\Type\StringSourceLocator(
    $source,
    (new Roave\BetterReflection\BetterReflection())->astLocator()
);

$reflector = new \Roave\BetterReflection\Reflector\FunctionReflector(
    $sourceLocator,
    new \Roave\BetterReflection\Reflector\ClassReflector($sourceLocator)
);

$functionInfo = $reflector->reflect('myFunction');

$returnType = $functionInfo->getReturnType();

var_dump([
    'builtIn' => $returnType->isBuiltin(),
    'type' => $returnType->__toString(),
]);

array_map(function (\Roave\BetterReflection\Reflection\ReflectionParameter $param) {
    $type = $param->getType();

    var_dump([
        'builtIn' => $type->isBuiltin(),
        'type' => $type->__toString(),
    ]);
}, $functionInfo->getParameters());

?>
--EXPECTF--
array(2) {
  ["builtIn"]=>
  bool(true)
  ["type"]=>
  string(4) "bool"
}
array(2) {
  ["builtIn"]=>
  bool(true)
  ["type"]=>
  string(3) "int"
}
array(2) {
  ["builtIn"]=>
  bool(true)
  ["type"]=>
  string(6) "string"
}
{'fraction_non_alphanumeric': 0.19319081551860648, 'fraction_numerical': 0.0055423594615993665, 'mean_word_length': 4.231884057971015, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 43, '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': '952837', 'n_tokens_mistral': 901, 'n_tokens_neox': 896, 'n_words': 154}