-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump to Rector 0.9.20 #1961
Bump to Rector 0.9.20 #1961
Changes from 9 commits
108e2bd
70b546e
edeaccd
b99de56
ff26fa7
741ecbc
c48ad6a
7136488
c14d704
a31bf56
439c1df
2ec1985
01d0147
a38bcec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,22 +11,19 @@ | |
use TYPO3\CMS\Core\Database\ConnectionPool; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
trait ConnectionCallTrait | ||
final class ConnectionCallFactory | ||
{ | ||
/** | ||
* @var NodeFactory | ||
*/ | ||
protected $nodeFactory; | ||
private $nodeFactory; | ||
|
||
/** | ||
* @required | ||
*/ | ||
public function autowireNodeFactoryTrait(NodeFactory $nodeFactory): void | ||
public function __construct(NodeFactory $nodeFactory) | ||
{ | ||
$this->nodeFactory = $nodeFactory; | ||
} | ||
Comment on lines
-14
to
24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Traits depend on magical presence of other properties, e.g. here is "hope" for $nodeFactory. I know this was used in Rector a lot, so it's only natural to use it in the code that build on Rector. But we're moving away from this in Rector, so code is cleaner and easier to maintain. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TomasVotruba Yes, i am not a big fan of traits either. So cool, Rector is moving away from it. |
||
|
||
private function createConnectionCall(Arg $firstArgument): Assign | ||
public function createConnectionCall(Arg $firstArgument): Assign | ||
{ | ||
$connection = $this->nodeFactory->createMethodCall( | ||
$this->nodeFactory->createStaticCall(GeneralUtility::class, 'makeInstance', [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ssch\TYPO3Rector\NodeAnalyzer; | ||
|
||
use PhpParser\Node\Expr; | ||
use PhpParser\Node\Expr\ClassConstFetch; | ||
use Rector\NodeNameResolver\NodeNameResolver; | ||
|
||
final class ClassConstAnalyzer | ||
{ | ||
/** | ||
* @var NodeNameResolver | ||
*/ | ||
private $nodeNameResolver; | ||
|
||
public function __construct(NodeNameResolver $nodeNameResolver) | ||
{ | ||
$this->nodeNameResolver = $nodeNameResolver; | ||
} | ||
|
||
/** | ||
* Detects "SomeClass::class" | ||
*/ | ||
public function isClassConstReference(Expr $expr, string $className): bool | ||
{ | ||
if (! $expr instanceof ClassConstFetch) { | ||
return false; | ||
} | ||
|
||
if (! $this->nodeNameResolver->isName($expr->name, 'class')) { | ||
return false; | ||
} | ||
|
||
return $this->nodeNameResolver->isName($expr->class, $className); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPUnit 9 is supporting PHP 7.3+, so PHPUnit 8 can be dropped here