for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\Php7to5;
use PhpParser\Node;
use PhpParser\Node\Param;
use PhpParser\NodeVisitorAbstract;
class ScalarTypeHintsRemover extends NodeVisitorAbstract
{
/**
* {@inheritdoc}
*/
public function leaveNode(Node $node)
if ($node instanceof Param) {
if ($this->isScalar($node->type)) {
$node->type = null;
}
* @param $type
*
* @return bool
protected function isScalar($type) : bool
return in_array($type, ['int', 'integer', 'float', 'string', 'bool', 'boolean']);