Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
final class TypeToVarTagFixer extends AbstractSymplifyFixer
{
/**
* @see https://regex101.com/r/8tFqJp/1
* Matches only "@type" at the start of a doc line, not inside a description
*/
private const string TYPE_TAG_REGEX = '#@type\b#';
private const string TYPE_TAG_REGEX = '#^(\s*(?:/\*{1,2}|\*)?\s*)@type\b#m';

/**
* @see https://regex101.com/r/cj95e6/1
Expand Down Expand Up @@ -67,7 +67,7 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void
continue;
}

$newDocContent = Regex::replace($docContent, self::TYPE_TAG_REGEX, '@var');
$newDocContent = Regex::replace($docContent, self::TYPE_TAG_REGEX, '$1@var');
$newDocContent = Regex::replace($newDocContent, self::SINGLE_ASTERISK_START_REGEX, '/**$1');

$tokens[$index] = new Token([T_DOC_COMMENT, $newDocContent]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* @psalm-type ConfigType = array{
* mercure?: bool|array{
* enabled?: bool, // Default: false
* include_type?: bool, // Always include @type in updates (including delete ones). // Default: false
* },
* }
*/
final class SomeConfig
{
}
Loading