Skip to content

Commit

Permalink
FRW-8773 Added PHPUnit 11 support. (#68)
Browse files Browse the repository at this point in the history
* FRW-8773 Upgraded PHPUnit version

* FRW-8773 Fixes after upgrading to a new major verion

* FRW-8773 Updated dependencies

* FRW-8773 Updated dependencies

* FRW-8773 CI Fixes
  • Loading branch information
olhalivitchuk authored Nov 4, 2024
1 parent cf79b5c commit fb6781c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"ext-json": "*",
"composer/semver": "^3.3",
"guzzlehttp/guzzle": "^7.5",
"nikic/php-parser": "^4.0",
"nikic/php-parser": "^5.1.0",
"spryker-sdk/security-checker": "^0.2.0",
"spryker-sdk/utils": "^0.2.1",
"symfony/console": "^6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected function isDevelopmentMethodCall(MethodCall $methodCall): bool
*/
protected function isClassExistsFuncCall(FuncCall $funcCall): bool
{
return $funcCall->name instanceof Name && $funcCall->name->parts[0] == 'class_exists';
return $funcCall->name instanceof Name && $funcCall->name->name == 'class_exists';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace SprykerSdk\Evaluator\Checker\PluginsRegistrationWithRestrictionsChecker;

use PhpParser\Comment\Doc;
use PhpParser\Node\ArrayItem;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Use_;
use SprykerSdk\Evaluator\Checker\AbstractChecker;
Expand Down Expand Up @@ -131,7 +131,7 @@ protected function checkDependencyProviderFile(SplFileInfo $dependencyProviderFi
}

/**
* @param \PhpParser\Node\Expr\ArrayItem $arrayItem
* @param \PhpParser\Node\ArrayItem $arrayItem
* @param string $fileName
* @param array<string> $filesClassUses
*
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/NodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function find($nodes, callable $filter): array

/**
* @param \PhpParser\Node|array<\PhpParser\Node> $nodes
* @param string $class
* @param class-string<\PhpParser\Node> $class
*
* @return array<\PhpParser\Node>
*/
Expand All @@ -52,7 +52,7 @@ public function findFirst($nodes, callable $filter): ?Node

/**
* @param \PhpParser\Node|array<\PhpParser\Node> $nodes
* @param string $class
* @param class-string<\PhpParser\Node> $class
*
* @return \PhpParser\Node|null
*/
Expand Down
3 changes: 2 additions & 1 deletion src/Parser/PhpParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PhpParser\NodeVisitor\NameResolver;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use PhpParser\PhpVersion;

class PhpParser implements PhpParserInterface
{
Expand All @@ -26,7 +27,7 @@ class PhpParser implements PhpParserInterface
*/
public function __construct(ParserFactory $parserFactory)
{
$this->parser = method_exists($parserFactory, 'createForNewestSupportedVersion') ? $parserFactory->createForNewestSupportedVersion() : $parserFactory->create(ParserFactory::PREFER_PHP7);
$this->parser = method_exists($parserFactory, 'createForNewestSupportedVersion') ? $parserFactory->createForNewestSupportedVersion() : $parserFactory->createForVersion(PhpVersion::getHostVersion());
}

/**
Expand Down

0 comments on commit fb6781c

Please sign in to comment.