Skip to content

Commit 37a3efb

Browse files
committed
Use "\n"
1 parent 387e69f commit 37a3efb

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

src/Parser/PhpDocParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function parseText(TokenIterator $tokens): Ast\PhpDoc\PhpDocTextNode
8989
}
9090

9191
// There's more text on a new line, ensure spacing.
92-
$text .= ' ';
92+
$text .= "\n";
9393
}
9494
$text = trim($text, " \t");
9595

tests/PHPStan/Parser/PhpDocParserTest.php

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,10 @@ public function provideDeprecatedTagsData(): \Iterator
10381038
new PhpDocNode([
10391039
new PhpDocTagNode(
10401040
'@deprecated',
1041-
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In Drupal 9 there will be no way to set the status and in Drupal 8 this ability has been removed because mb_*() functions are supplied using Symfony\'s polyfill.')
1041+
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In
1042+
Drupal 9 there will be no way to set the status and in Drupal 8 this
1043+
ability has been removed because mb_*() functions are supplied using
1044+
Symfony\'s polyfill.')
10421045
),
10431046
]),
10441047
];
@@ -1064,7 +1067,10 @@ public function provideDeprecatedTagsData(): \Iterator
10641067
new PhpDocTextNode(''),
10651068
new PhpDocTagNode(
10661069
'@deprecated',
1067-
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In Drupal 9 there will be no way to set the status and in Drupal 8 this ability has been removed because mb_*() functions are supplied using Symfony\'s polyfill.')
1070+
new DeprecatedTagValueNode('in Drupal 8.6.0 and will be removed before Drupal 9.0.0. In
1071+
Drupal 9 there will be no way to set the status and in Drupal 8 this
1072+
ability has been removed because mb_*() functions are supplied using
1073+
Symfony\'s polyfill.')
10681074
),
10691075
]),
10701076
];
@@ -1577,7 +1583,8 @@ public function provideMultiLinePhpDocData(): array
15771583
new IdentifierTypeNode('Foo'),
15781584
false,
15791585
'$foo',
1580-
'1st multi world description some text in the middle'
1586+
'1st multi world description
1587+
some text in the middle'
15811588
)
15821589
),
15831590
new PhpDocTagNode(
@@ -2301,7 +2308,11 @@ public function provideRealWorldExampleData(): \Iterator
23012308
'OK with two param and paragraph description',
23022309
$sample,
23032310
new PhpDocNode([
2304-
new PhpDocTextNode('Returns the schema for the field. This method is static because the field schema information is needed on creation of the field. FieldItemInterface objects instantiated at that time are not reliable as field settings might be missing. Computed fields having no schema should return an empty array.'),
2311+
new PhpDocTextNode('Returns the schema for the field.
2312+
This method is static because the field schema information is needed on
2313+
creation of the field. FieldItemInterface objects instantiated at that
2314+
time are not reliable as field settings might be missing.
2315+
Computed fields having no schema should return an empty array.'),
23052316
// @todo the commented out items should be correct.
23062317
//new PhpDocTextNode('Returns the schema for the field.'),
23072318
new PhpDocTextNode(''),
@@ -2317,7 +2328,6 @@ public function provideRealWorldExampleData(): \Iterator
23172328
''
23182329
)
23192330
),
2320-
// @todo this should be the param description, but new line param descriptions are not handled.
23212331
new PhpDocTextNode('The field definition.'),
23222332
new PhpDocTextNode(''),
23232333
new PhpDocTagNode(
@@ -2327,12 +2337,29 @@ public function provideRealWorldExampleData(): \Iterator
23272337
''
23282338
)
23292339
),
2330-
// @todo these are actually the @return description.
2331-
new PhpDocTextNode('An empty array if there is no schema, or an associative array with the following key/value pairs:'),
2332-
new PhpDocTextNode('- columns: An array of Schema API column specifications, keyed by column name. The columns need to be a subset of the properties defined in propertyDefinitions(). The \'not null\' property is ignored if present, as it is determined automatically by the storage controller depending on the table layout and the property definitions. It is recommended to avoid having the column definitions depend on field settings when possible. No assumptions should be made on how storage engines internally use the original column name to structure their storage.'),
2333-
new PhpDocTextNode('- unique keys: (optional) An array of Schema API unique key definitions. Only columns that appear in the \'columns\' array are allowed.'),
2334-
new PhpDocTextNode('- indexes: (optional) An array of Schema API index definitions. Only columns that appear in the \'columns\' array are allowed. Those indexes will be used as default indexes. Field definitions can specify additional indexes or, at their own risk, modify the default indexes specified by the field-type module. Some storage engines might not support indexes.'),
2335-
new PhpDocTextNode('- foreign keys: (optional) An array of Schema API foreign key definitions. Note, however, that the field data is not necessarily stored in SQL. Also, the possible usage is limited, as you cannot specify another field as related, only existing SQL tables, such as {taxonomy_term_data}.'),
2340+
new PhpDocTextNode('An empty array if there is no schema, or an associative array with the
2341+
following key/value pairs:'),
2342+
new PhpDocTextNode('- columns: An array of Schema API column specifications, keyed by column
2343+
name. The columns need to be a subset of the properties defined in
2344+
propertyDefinitions(). The \'not null\' property is ignored if present,
2345+
as it is determined automatically by the storage controller depending
2346+
on the table layout and the property definitions. It is recommended to
2347+
avoid having the column definitions depend on field settings when
2348+
possible. No assumptions should be made on how storage engines
2349+
internally use the original column name to structure their storage.'),
2350+
new PhpDocTextNode('- unique keys: (optional) An array of Schema API unique key definitions.
2351+
Only columns that appear in the \'columns\' array are allowed.'),
2352+
new PhpDocTextNode('- indexes: (optional) An array of Schema API index definitions. Only
2353+
columns that appear in the \'columns\' array are allowed. Those indexes
2354+
will be used as default indexes. Field definitions can specify
2355+
additional indexes or, at their own risk, modify the default indexes
2356+
specified by the field-type module. Some storage engines might not
2357+
support indexes.'),
2358+
new PhpDocTextNode('- foreign keys: (optional) An array of Schema API foreign key
2359+
definitions. Note, however, that the field data is not necessarily
2360+
stored in SQL. Also, the possible usage is limited, as you cannot
2361+
specify another field as related, only existing SQL tables,
2362+
such as {taxonomy_term_data}.'),
23362363
]),
23372364
];
23382365
}

0 commit comments

Comments
 (0)