ACIL FM
Dark
Refresh
Current DIR:
/opt/cpanel/ea-wappspector/vendor/rector/rector/rules/Naming/Naming
/
opt
cpanel
ea-wappspector
vendor
rector
rector
rules
Naming
Naming
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
AliasNameResolver.php
1.23 MB
chmod
View
DL
Edit
Rename
Delete
ConflictingNameResolver.php
5.32 MB
chmod
View
DL
Edit
Rename
Delete
ExpectedNameResolver.php
7.71 MB
chmod
View
DL
Edit
Rename
Delete
OverridenExistingNamesResolver.php
3.73 MB
chmod
View
DL
Edit
Rename
Delete
PropertyNaming.php
9.6 MB
chmod
View
DL
Edit
Rename
Delete
UseImportsResolver.php
2.46 MB
chmod
View
DL
Edit
Rename
Delete
VariableNaming.php
4.86 MB
chmod
View
DL
Edit
Rename
Delete
Edit file: /opt/cpanel/ea-wappspector/vendor/rector/rector/rules/Naming/Naming/ConflictingNameResolver.php
<?php declare (strict_types=1); namespace Rector\Naming\Naming; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver; use Rector\Naming\PhpArray\ArrayFilter; use Rector\NodeManipulator\FunctionLikeManipulator; use Rector\PhpParser\Node\BetterNodeFinder; final class ConflictingNameResolver { /** * @readonly * @var \Rector\Naming\PhpArray\ArrayFilter */ private $arrayFilter; /** * @readonly * @var \Rector\PhpParser\Node\BetterNodeFinder */ private $betterNodeFinder; /** * @readonly * @var \Rector\Naming\Naming\ExpectedNameResolver */ private $expectedNameResolver; /** * @readonly * @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver */ private $matchParamTypeExpectedNameResolver; /** * @readonly * @var \Rector\NodeManipulator\FunctionLikeManipulator */ private $functionLikeManipulator; /** * @var array<int, string[]> */ private $conflictingVariableNamesByClassMethod = []; public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, FunctionLikeManipulator $functionLikeManipulator) { $this->arrayFilter = $arrayFilter; $this->betterNodeFinder = $betterNodeFinder; $this->expectedNameResolver = $expectedNameResolver; $this->matchParamTypeExpectedNameResolver = $matchParamTypeExpectedNameResolver; $this->functionLikeManipulator = $functionLikeManipulator; } /** * @return string[] * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $classMethod */ public function resolveConflictingVariableNamesForParam($classMethod) : array { $expectedNames = []; foreach ($classMethod->params as $param) { $expectedName = $this->matchParamTypeExpectedNameResolver->resolve($param); if ($expectedName === null) { continue; } $expectedNames[] = $expectedName; } return $this->arrayFilter->filterWithAtLeastTwoOccurences($expectedNames); } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike */ public function hasNameIsInFunctionLike(string $variableName, $functionLike) : bool { $conflictingVariableNames = $this->resolveConflictingVariableNamesForNew($functionLike); return \in_array($variableName, $conflictingVariableNames, \true); } /** * @return string[] * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike */ private function resolveConflictingVariableNamesForNew($functionLike) : array { // cache it! $classMethodId = \spl_object_id($functionLike); if (isset($this->conflictingVariableNamesByClassMethod[$classMethodId])) { return $this->conflictingVariableNamesByClassMethod[$classMethodId]; } $paramNames = $this->functionLikeManipulator->resolveParamNames($functionLike); $newAssignNames = $this->resolveForNewAssigns($functionLike); $nonNewAssignNames = $this->resolveForNonNewAssigns($functionLike); $protectedNames = \array_merge($paramNames, $newAssignNames, $nonNewAssignNames); $protectedNames = $this->arrayFilter->filterWithAtLeastTwoOccurences($protectedNames); $this->conflictingVariableNamesByClassMethod[$classMethodId] = $protectedNames; return $protectedNames; } /** * @return string[] * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike */ private function resolveForNewAssigns($functionLike) : array { $names = []; /** @var Assign[] $assigns */ $assigns = $this->betterNodeFinder->findInstanceOf((array) $functionLike->getStmts(), Assign::class); foreach ($assigns as $assign) { $name = $this->expectedNameResolver->resolveForAssignNew($assign); if ($name === null) { continue; } $names[] = $name; } return $names; } /** * @return string[] * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike */ private function resolveForNonNewAssigns($functionLike) : array { $names = []; /** @var Assign[] $assigns */ $assigns = $this->betterNodeFinder->findInstanceOf((array) $functionLike->getStmts(), Assign::class); foreach ($assigns as $assign) { $name = $this->expectedNameResolver->resolveForAssignNonNew($assign); if ($name === null) { continue; } $names[] = $name; } return $names; } }
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply