REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.20 KB
Close
/opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\PHPUnit\NodeFactory; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; use Rector\Exception\ShouldNotHappenException; use Rector\PhpParser\Node\NodeFactory; use Rector\PHPUnit\PhpDoc\PhpDocValueToNodeMapper; final class ExpectExceptionMethodCallFactory { /** * @readonly * @var \Rector\PhpParser\Node\NodeFactory */ private $nodeFactory; /** * @readonly * @var \Rector\PHPUnit\PhpDoc\PhpDocValueToNodeMapper */ private $phpDocValueToNodeMapper; public function __construct(NodeFactory $nodeFactory, PhpDocValueToNodeMapper $phpDocValueToNodeMapper) { $this->nodeFactory = $nodeFactory; $this->phpDocValueToNodeMapper = $phpDocValueToNodeMapper; } /** * @param PhpDocTagNode[] $phpDocTagNodes * @return Expression[] */ public function createFromTagValueNodes(array $phpDocTagNodes, string $methodName) : array { $methodCallExpressions = []; foreach ($phpDocTagNodes as $phpDocTagNode) { $methodCall = $this->createMethodCall($phpDocTagNode, $methodName); $methodCallExpressions[] = new Expression($methodCall); } return $methodCallExpressions; } private function createMethodCall(PhpDocTagNode $phpDocTagNode, string $methodName) : MethodCall { if (!$phpDocTagNode->value instanceof GenericTagValueNode) { throw new ShouldNotHappenException(); } $expr = $this->createExpectedExpr($phpDocTagNode, $phpDocTagNode->value); return $this->nodeFactory->createMethodCall('this', $methodName, [new Arg($expr)]); } private function createExpectedExpr(PhpDocTagNode $phpDocTagNode, GenericTagValueNode $genericTagValueNode) : Expr { if ($phpDocTagNode->name === '@expectedExceptionMessage') { return new String_($genericTagValueNode->value); } return $this->phpDocValueToNodeMapper->mapGenericTagValueNode($genericTagValueNode); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AssertCallFactory.php
588 B
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ConsecutiveIfsFactory.php
5.26 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ExpectExceptionMethodCallFactory.php
2.20 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MatcherInvocationCountMethodCallNodeFactory.php
1.35 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
UsedVariablesResolver.php
1.95 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).