Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"require": {
"php": ">=7.2",
"ext-json": "*",
"symfony/yaml": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/finder": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"symfony/process": "^3.0 || ^4.0 || ^5.0 || ^6.0",
"nikic/php-parser": "^4.0",
"symfony/yaml": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/finder": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"symfony/process": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0",
"nikic/php-parser": "^4.0 || ^5.0",
"gitonomy/gitlib": "^1.3.0",
"sensiolabs/ansi-to-html": "~1.1",
"composer/composer": "^1.5 || ^2.0"
Expand Down
5 changes: 2 additions & 3 deletions src/Command/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Phpbb\Epv\Tests\Exception\TestException;
use Phpbb\Epv\Tests\TestStartup;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -23,7 +22,7 @@
class ValidateCommand extends Command
{

protected function configure()
protected function configure(): void
{
$this
->setName('run')
Expand All @@ -37,7 +36,7 @@ protected function configure()
->addOption('debug', null, InputOption::VALUE_NONE, "Run in debug");
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$dir = $input->getOption("dir");
$git = $input->getOption('git');
Expand Down
4 changes: 2 additions & 2 deletions src/Events/recursive_event_filter_iterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public function __construct(\RecursiveIterator $iterator, $root_path)
*
* @return recursive_event_filter_iterator
*/
public function getChildren()
public function getChildren(): recursive_event_filter_iterator
{
return new self($this->getInnerIterator()->getChildren(), $this->root_path);
}

/**
* {@inheritDoc}
*/
public function accept()
public function accept(): bool
{
$relative_path = str_replace(DIRECTORY_SEPARATOR, '/', $this->current());
$filename = $this->current()->getFilename();
Expand Down
2 changes: 1 addition & 1 deletion src/Files/Type/RoutingFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RoutingFile extends YmlFile implements RoutingFileInterface
* Get the file type for the specific file.
* @return int
*/
function getFileType()
function getFileType(): int
{
return Type::TYPE_YML | Type::TYPE_ROUTING;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files/Type/ServiceFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ServiceFile extends YmlFile implements ServiceFileInterface
* Get the file type for the specific file.
* @return int
*/
function getFileType()
function getFileType(): int
{
return Type::TYPE_YML | Type::TYPE_SERVICE;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Files/Type/YmlFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($debug, $filename, $rundir)
*
* @return array
*/
public function getYaml()
public function getYaml(): array
{
return $this->yamlFile;
}
Expand All @@ -86,7 +86,7 @@ public function getYaml()
* Get the file type for the specific file.
* @return int
*/
function getFileType()
function getFileType(): int
{
return Type::TYPE_YML;
}
Expand Down
5 changes: 4 additions & 1 deletion src/Tests/Tests/epv_test_validate_languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public function __construct($debug, OutputInterface $output, $basedir, $namespac
parent::__construct($debug, $output, $basedir, $namespace, $titania, $opendir);

$this->directory = true;
$this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
$factory = new ParserFactory();
$this->parser = method_exists($factory, 'createForNewestSupportedVersion')
? $factory->createForNewestSupportedVersion()
: $factory->create(ParserFactory::PREFER_PHP7);
$this->visitor = new ArrayKeyVisitor;
$this->traverser = new NodeTraverser;
$this->traverser->addVisitor($this->visitor);
Expand Down
11 changes: 7 additions & 4 deletions src/Tests/Tests/epv_test_validate_php_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ public function __construct($debug, OutputInterface $output, $basedir, $namespac
parent::__construct($debug, $output, $basedir, $namespace, $titania, $opendir);

$this->fileTypeFull = Type::TYPE_PHP;
$this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
$factory = new ParserFactory();
$this->parser = method_exists($factory, 'createForNewestSupportedVersion')
? $factory->createForNewestSupportedVersion()
: $factory->create(ParserFactory::PREFER_PHP7);
}

/**
Expand Down Expand Up @@ -335,7 +338,7 @@ private function checkInDefined(If_ $node)

if ($cond instanceof BooleanNot
&& $cond->expr instanceof FuncCall
&& $cond->expr->name->getFirst() === 'defined'
&& (method_exists($cond->expr->name, 'getFirst') ? $cond->expr->name->getFirst() : $cond->expr->name->toString()) === 'defined'
&& $cond->expr->args[0]->value->value === 'IN_PHPBB'
)
{
Expand Down Expand Up @@ -375,7 +378,7 @@ private function validateFunctionNames(Node $node)
}
else if (isset($node->expr) && $node->expr instanceof FuncCall && $node->expr->name instanceof Name)
{
$name = $node->expr->name->getFirst();
$name = method_exists($node->expr->name, 'getFirst') ? $node->expr->name->getFirst() : $node->expr->name->toString();
}

if ($name !== null)
Expand Down Expand Up @@ -475,7 +478,7 @@ private function getMethodName(Node $node)
}
else if ($node->name instanceof Node\Name)
{
return $node->name->getFirst();
return method_exists($node->name, 'getFirst') ? $node->name->getFirst() : $node->name->toString();
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion src/Tests/Tests/epv_test_validate_revert_schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public function __construct($debug, OutputInterface $output, $basedir, $namespac
parent::__construct($debug, $output, $basedir, $namespace, $titania, $opendir);

$this->fileTypeFull = Type::TYPE_MIGRATION;
$this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
$factory = new ParserFactory();
$this->parser = method_exists($factory, 'createForNewestSupportedVersion')
? $factory->createForNewestSupportedVersion()
: $factory->create(ParserFactory::PREFER_PHP7);
}

/**
Expand Down