Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blink/internal/fixer/rules/no_superfluous_phpdoc_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (f NoSuperfluousPhpdocTags) Fix(s *tokens.Stream) bool {
continue
}
d, ok := parseDoc(t.Value)
if !ok || d.single {
if !ok {
continue
}
docChanged := false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ func TestNoSuperfluousPhpdocTagsConfig(t *testing.T) {
if want := "<?php\nclass A {\n /**\n */\n public function f() {}\n}\n"; !changed || got != want {
t.Fatalf("remove_inheritdoc: changed=%v got=%q want=%q", changed, got, want)
}

// a single-line docblock is processed too: remove_inheritdoc drops the tag,
// leaving "/** */" for NoEmptyPhpdoc to clear (php-cs-fixer behavior)
single := "<?php\nclass A {\n /** @inheritDoc */\n public function f() {}\n}\n"
got, changed = apply(t, rm.(fixerRule), single)
if want := "<?php\nclass A {\n /** */\n public function f() {}\n}\n"; !changed || got != want {
t.Fatalf("single-line remove_inheritdoc: changed=%v got=%q want=%q", changed, got, want)
}
// a single-line superfluous @param is removed with allow_mixed=false
singleParam := "<?php\nclass A {\n /** @param int $x */\n public function f(int $x) {}\n}\n"
got, changed = apply(t, noMixed.(fixerRule), singleParam)
if want := "<?php\nclass A {\n /** */\n public function f(int $x) {}\n}\n"; !changed || got != want {
t.Fatalf("single-line superfluous @param: changed=%v got=%q want=%q", changed, got, want)
}
}

func TestNoSuperfluousPhpdocTagsInheritDocWithDescription(t *testing.T) {
Expand Down
Loading