Created
September 21, 2018 15:15
-
-
Save Ocramius/5dea4bd9c2f5587c49169662d6eeb7c3 to your computer and use it in GitHub Desktop.
DQL inspections example/proposal for JetBrains PHPStorm EAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
private $bar = 'baz'; | |
/** @var Baz @ORM\ManyToOne(targetEntity=Baz::class) */ | |
private $baz; | |
} | |
class Baz { | |
private $tab = 'taz'; | |
} | |
$simpleDql = <<<'DQL' | |
SELECT f FROM Foo f | |
DQL; | |
// Currently, people write this for easy refactoring | |
$dqlWithClassReferenceAsWeCurrentlyDoIt = 'SELECT f FROM ' . Foo::class . ' f'; | |
$dqlWithFieldAccess = <<<'DQL' | |
SELECT f FROM Foo f WHERE f.bar = "example" | |
DQL; | |
$dqlWithAssociationJoin = <<<'DQL' | |
SELECT f, b FROM Foo f JOIN f.baz b WHERE b.tab = "example" | |
DQL; | |
// Highlight lexemes (or AST nodes) | |
// Hover on "Foo" - reference to Foo class | |
// Detect usage of "Foo" inside DQL | |
// Refactoring Foo? Renames? | |
// Refactor Foo.bar (detected as Foo#$bar) | |
// Refactor Foo.baz.tab ($dqlWithAssociationJoin) | |
// Detect usage of Foo.baz.tab | |
// Detect unknown associations? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment