12
12
use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocNode ;
13
13
use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocTagNode ;
14
14
use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocTagValueNode ;
15
- use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocTextNode ;
16
15
use PHPStan \PhpDocParser \Ast \PhpDoc \PropertyTagValueNode ;
17
16
use PHPStan \PhpDocParser \Ast \PhpDoc \ReturnTagValueNode ;
18
17
use PHPStan \PhpDocParser \Ast \PhpDoc \TemplateTagValueNode ;
@@ -154,16 +153,6 @@ public function getReturnType(): Type
154
153
return $ this ->getTypeOrMixed ($ this ->getReturnTagValue ());
155
154
}
156
155
157
- /**
158
- * @template TNode as \PHPStan\PhpDocParser\Ast\Node
159
- * @param class-string<TNode> $type
160
- * @return TNode[]
161
- */
162
- public function getByType (string $ type ): array
163
- {
164
- return $ this ->phpDocNodeByTypeFinder ->findByType ($ this ->phpDocNode , $ type );
165
- }
166
-
167
156
/**
168
157
* @param class-string<Node> $type
169
158
*/
@@ -223,6 +212,9 @@ public function getByAnnotationClasses(array $classes): ?DoctrineAnnotationTagVa
223
212
return $ doctrineAnnotationTagValueNodes [0 ] ?? null ;
224
213
}
225
214
215
+ /**
216
+ * @api doctrine/symfony
217
+ */
226
218
public function getByAnnotationClass (string $ class ): ?DoctrineAnnotationTagValueNode
227
219
{
228
220
$ doctrineAnnotationTagValueNodes = $ this ->phpDocNodeByTypeFinder ->findDoctrineAnnotationsByClass (
@@ -268,15 +260,6 @@ public function findOneByAnnotationClass(string $desiredClass): ?DoctrineAnnotat
268
260
return $ foundTagValueNodes [0 ] ?? null ;
269
261
}
270
262
271
- /**
272
- * @param class-string $desiredClass
273
- * @return DoctrineAnnotationTagValueNode[]
274
- */
275
- public function findByAnnotationClass (string $ desiredClass ): array
276
- {
277
- return $ this ->phpDocNodeByTypeFinder ->findDoctrineAnnotationsByClass ($ this ->phpDocNode , $ desiredClass );
278
- }
279
-
280
263
/**
281
264
* @template T of \PHPStan\PhpDocParser\Ast\Node
282
265
* @param class-string<T> $typeToRemove
@@ -310,25 +293,6 @@ public function removeByType(string $typeToRemove): void
310
293
});
311
294
}
312
295
313
- /**
314
- * @return array<string, Type>
315
- */
316
- public function getParamTypesByName (): array
317
- {
318
- $ paramTypesByName = [];
319
-
320
- foreach ($ this ->phpDocNode ->getParamTagValues () as $ paramTagValueNode ) {
321
- $ parameterType = $ this ->staticTypeMapper ->mapPHPStanPhpDocTypeToPHPStanType (
322
- $ paramTagValueNode ,
323
- $ this ->node
324
- );
325
-
326
- $ paramTypesByName [$ paramTagValueNode ->parameterName ] = $ parameterType ;
327
- }
328
-
329
- return $ paramTypesByName ;
330
- }
331
-
332
296
public function addTagValueNode (PhpDocTagValueNode $ phpDocTagValueNode ): void
333
297
{
334
298
if ($ phpDocTagValueNode instanceof DoctrineAnnotationTagValueNode) {
@@ -422,25 +386,6 @@ public function getTemplateTagValueNodes(): array
422
386
return $ this ->phpDocNode ->getTemplateTagValues ();
423
387
}
424
388
425
- public function hasInheritDoc (): bool
426
- {
427
- if ($ this ->hasByNames (['inheritdoc ' , 'inheritDoc ' ])) {
428
- return true ;
429
- }
430
-
431
- foreach ($ this ->phpDocNode ->children as $ children ) {
432
- if (! $ children instanceof PhpDocTextNode) {
433
- continue ;
434
- }
435
-
436
- if (in_array ($ children ->text , ['{@inheritdoc} ' , '{@inheritDoc} ' ], true )) {
437
- return true ;
438
- }
439
- }
440
-
441
- return false ;
442
- }
443
-
444
389
/**
445
390
* @deprecated
446
391
* Should be handled by attributes of phpdoc node - if stard_and_end is missing in one of nodes, it has been changed
@@ -475,19 +420,6 @@ public function hasChanged(): bool
475
420
return $ changedPhpDocNodeVisitor ->hasChanged ();
476
421
}
477
422
478
- /**
479
- * @return string[]
480
- */
481
- public function getMethodTagNames (): array
482
- {
483
- $ methodTagNames = [];
484
- foreach ($ this ->phpDocNode ->getMethodTagValues () as $ methodTagValueNode ) {
485
- $ methodTagNames [] = $ methodTagValueNode ->methodName ;
486
- }
487
-
488
- return $ methodTagNames ;
489
- }
490
-
491
423
public function makeMultiLined (): void
492
424
{
493
425
$ this ->isSingleLine = false ;
@@ -498,7 +430,7 @@ public function getNode(): \PhpParser\Node
498
430
return $ this ->node ;
499
431
}
500
432
501
- public function resolveNameForPhpDocTagValueNode (PhpDocTagValueNode $ phpDocTagValueNode ): ?string
433
+ private function resolveNameForPhpDocTagValueNode (PhpDocTagValueNode $ phpDocTagValueNode ): ?string
502
434
{
503
435
foreach (self ::TAGS_TYPES_TO_NAMES as $ tagValueNodeType => $ name ) {
504
436
/** @var class-string<PhpDocTagNode> $tagValueNodeType */
@@ -510,6 +442,15 @@ public function resolveNameForPhpDocTagValueNode(PhpDocTagValueNode $phpDocTagVa
510
442
return null ;
511
443
}
512
444
445
+ /**
446
+ * @param class-string $desiredClass
447
+ * @return DoctrineAnnotationTagValueNode[]
448
+ */
449
+ private function findByAnnotationClass (string $ desiredClass ): array
450
+ {
451
+ return $ this ->phpDocNodeByTypeFinder ->findDoctrineAnnotationsByClass ($ this ->phpDocNode , $ desiredClass );
452
+ }
453
+
513
454
private function getTypeOrMixed (?PhpDocTagValueNode $ phpDocTagValueNode ): MixedType | Type
514
455
{
515
456
if ($ phpDocTagValueNode === null ) {
0 commit comments