xsolve-pl /
xsolve-associate
| 1 | #!/usr/bin/php |
||
| 2 | <?php |
||
| 3 | |||
| 4 | use Xsolve\Associate\DoctrineOrm\Association\Path\Builder\DivergingAssociationPathBuilder; |
||
| 5 | |||
| 6 | require_once __DIR__ . '/vendor/autoload.php'; |
||
| 7 | |||
| 8 | $doctrineOrmAssociationPathBuilder = new DivergingAssociationPathBuilder(); |
||
| 9 | |||
| 10 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 11 | ->associate('bar') |
||
| 12 | ->aliasAs('bars') |
||
| 13 | ->loadFull() |
||
| 14 | ->associate('baz') |
||
| 15 | ->associate('qux') |
||
| 16 | ->aliasAs('qux') |
||
| 17 | ->loadProxy() |
||
| 18 | ->create(); |
||
| 19 | |||
| 20 | dump($doctrineOrmAssociationPath); |
||
|
0 ignored issues
–
show
|
|||
| 21 | |||
| 22 | $doctrineOrmAssociationPathBuilder = new DivergingAssociationPathBuilder(); |
||
| 23 | |||
| 24 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 25 | ->associate('bar') |
||
| 26 | ->associate('baz') |
||
| 27 | ->associate('qux') |
||
| 28 | ->loadFull() |
||
| 29 | ->create(); |
||
| 30 | |||
| 31 | dump($doctrineOrmAssociationPath); |
||
| 32 | |||
| 33 | // .foo.bar |
||
| 34 | // .baz.qux |
||
| 35 | // .qux |
||
| 36 | // |
||
| 37 | $doctrineOrmAssociationPathBuilder = new DivergingAssociationPathBuilder(); |
||
| 38 | |||
| 39 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 40 | ->diverge() |
||
| 41 | ->associate('foo') |
||
| 42 | ->diverge() |
||
| 43 | ->associate('bar') |
||
| 44 | ->endDiverge() |
||
| 45 | ->diverge() |
||
| 46 | ->associate('baz') |
||
| 47 | ->aliasAs('.foo.baz') |
||
| 48 | ->loadProxy() |
||
| 49 | ->associate('qux') |
||
| 50 | ->endDiverge() |
||
| 51 | ->endDiverge() |
||
| 52 | ->diverge() |
||
| 53 | ->associate('qux') |
||
| 54 | ->endDiverge() |
||
| 55 | ->create(); |
||
| 56 | |||
| 57 | dump($doctrineOrmAssociationPath); |
||
| 58 | |||
| 59 | // .foo.bar.baz.qux |
||
| 60 | // .qux |
||
| 61 | // |
||
| 62 | $doctrineOrmAssociationPathBuilder = new DivergingAssociationPathBuilder(); |
||
| 63 | |||
| 64 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 65 | ->associate('foo') |
||
| 66 | ->associate('bar') |
||
| 67 | ->diverge() |
||
| 68 | ->associate('baz') |
||
| 69 | ->associate('qux') |
||
| 70 | ->endDiverge() |
||
| 71 | ->diverge() |
||
| 72 | ->associate('qux') |
||
| 73 | ->endDiverge(); |
||
| 74 | |||
| 75 | dump($doctrineOrmAssociationPath); |
||
| 76 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.