Skip to content

Commit

Permalink
PhpDocNode: Swap array_column() and array_filter()
Browse files Browse the repository at this point in the history
  • Loading branch information
jlherren authored and ondrejmirtes committed Jan 29, 2022
1 parent b63ce39 commit 4bf544b
Showing 1 changed file with 81 additions and 81 deletions.
162 changes: 81 additions & 81 deletions src/Ast/PhpDoc/PhpDocNode.php
Expand Up @@ -50,11 +50,11 @@ public function getTagsByName(string $tagName): array
*/
public function getVarTagValues(string $tagName = '@var'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof VarTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof VarTagValueNode;
}
);
}

Expand All @@ -64,11 +64,11 @@ public function getVarTagValues(string $tagName = '@var'): array
*/
public function getParamTagValues(string $tagName = '@param'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof ParamTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof ParamTagValueNode;
}
);
}

Expand All @@ -78,11 +78,11 @@ public function getParamTagValues(string $tagName = '@param'): array
*/
public function getTemplateTagValues(string $tagName = '@template'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof TemplateTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof TemplateTagValueNode;
}
);
}

Expand All @@ -92,11 +92,11 @@ public function getTemplateTagValues(string $tagName = '@template'): array
*/
public function getExtendsTagValues(string $tagName = '@extends'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof ExtendsTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof ExtendsTagValueNode;
}
);
}

Expand All @@ -106,11 +106,11 @@ public function getExtendsTagValues(string $tagName = '@extends'): array
*/
public function getImplementsTagValues(string $tagName = '@implements'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof ImplementsTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof ImplementsTagValueNode;
}
);
}

Expand All @@ -120,11 +120,11 @@ public function getImplementsTagValues(string $tagName = '@implements'): array
*/
public function getUsesTagValues(string $tagName = '@use'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof UsesTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof UsesTagValueNode;
}
);
}

Expand All @@ -134,11 +134,11 @@ public function getUsesTagValues(string $tagName = '@use'): array
*/
public function getReturnTagValues(string $tagName = '@return'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof ReturnTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof ReturnTagValueNode;
}
);
}

Expand All @@ -148,11 +148,11 @@ public function getReturnTagValues(string $tagName = '@return'): array
*/
public function getThrowsTagValues(string $tagName = '@throws'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof ThrowsTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof ThrowsTagValueNode;
}
);
}

Expand All @@ -162,25 +162,25 @@ public function getThrowsTagValues(string $tagName = '@throws'): array
*/
public function getMixinTagValues(string $tagName = '@mixin'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof MixinTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof MixinTagValueNode;
}
);
}


/**
* @return \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode[]
* @return DeprecatedTagValueNode[]
*/
public function getDeprecatedTagValues(): array
{
return array_column(
array_filter($this->getTagsByName('@deprecated'), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof DeprecatedTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName('@deprecated'), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof DeprecatedTagValueNode;
}
);
}

Expand All @@ -190,11 +190,11 @@ public function getDeprecatedTagValues(): array
*/
public function getPropertyTagValues(string $tagName = '@property'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof PropertyTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof PropertyTagValueNode;
}
);
}

Expand All @@ -204,11 +204,11 @@ public function getPropertyTagValues(string $tagName = '@property'): array
*/
public function getPropertyReadTagValues(string $tagName = '@property-read'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof PropertyTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof PropertyTagValueNode;
}
);
}

Expand All @@ -218,11 +218,11 @@ public function getPropertyReadTagValues(string $tagName = '@property-read'): ar
*/
public function getPropertyWriteTagValues(string $tagName = '@property-write'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof PropertyTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof PropertyTagValueNode;
}
);
}

Expand All @@ -232,11 +232,11 @@ public function getPropertyWriteTagValues(string $tagName = '@property-write'):
*/
public function getMethodTagValues(string $tagName = '@method'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof MethodTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof MethodTagValueNode;
}
);
}

Expand All @@ -246,11 +246,11 @@ public function getMethodTagValues(string $tagName = '@method'): array
*/
public function getTypeAliasTagValues(string $tagName = '@phpstan-type'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof TypeAliasTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof TypeAliasTagValueNode;
}
);
}

Expand All @@ -260,11 +260,11 @@ public function getTypeAliasTagValues(string $tagName = '@phpstan-type'): array
*/
public function getTypeAliasImportTagValues(string $tagName = '@phpstan-import-type'): array
{
return array_column(
array_filter($this->getTagsByName($tagName), static function (PhpDocTagNode $tag): bool {
return $tag->value instanceof TypeAliasImportTagValueNode;
}),
'value'
return array_filter(
array_column($this->getTagsByName($tagName), 'value'),
static function (PhpDocTagValueNode $value): bool {
return $value instanceof TypeAliasImportTagValueNode;
}
);
}

Expand Down

0 comments on commit 4bf544b

Please sign in to comment.