Skip to content

Commit

Permalink
type deprecation fix for preg_match and preg_split for php 8.1 (#1265)
Browse files Browse the repository at this point in the history
Co-authored-by: Tanbin Siyam <tanisl@ito.lt>
  • Loading branch information
potasiyam and Tanbin Siyam committed Jun 18, 2022
1 parent 2ea32ca commit f144351
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function phpdocDescription()
*/
public function phpdocContent()
{
$comment = preg_split('/(\n|\r\n)/', $this->comment);
$comment = preg_split('/(\n|\r\n)/', (string) $this->comment);
$comment[0] = preg_replace('/[ \t]*\\/\*\*/', '', $comment[0]); // strip '/**'
$i = count($comment) -1;
$comment[$i] = preg_replace('/\*\/[ \t]*$/', '', $comment[$i]); // strip '*/'
Expand Down
2 changes: 1 addition & 1 deletion src/Processors/AugmentProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __invoke(Analysis $analysis)
$property->property = $context->property;
}

if (preg_match('/@var\s+(?<type>[^\s]+)([ \t])?(?<description>.+)?$/im', $context->comment, $varMatches)) {
if (preg_match('/@var\s+(?<type>[^\s]+)([ \t])?(?<description>.+)?$/im', (string) $context->comment, $varMatches)) {
if ($property->description === null && isset($varMatches['description'])) {
$property->description = trim($varMatches['description']);
}
Expand Down

0 comments on commit f144351

Please sign in to comment.