Skip to content

Commit

Permalink
Update dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Apr 9, 2019
1 parent d11caba commit 59255f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
"kylekatarnls/multi-tester": "^0.1",
"kylekatarnls/multi-tester": "^1.1",
"phpmd/phpmd": "^2.6",
"phpstan/phpstan": "^0.10.8",
"phpstan/phpstan": "^0.11",
"phpunit/phpunit": "^7.5 || ^8.0",
"squizlabs/php_codesniffer": "^3.4"
},
Expand Down
7 changes: 7 additions & 0 deletions phpdoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,18 @@ function compileDoc($autoDocLines)
return dumpParameter($method, $parameter);
}, $function->getParameters()));
$methodDocBlock = $function->getDocComment() ?: '';

if (substr($method, 0, 2) !== '__' && $function->isStatic()) {
$doc = preg_replace('/^\/\*+\n([\s\S]+)\s*\*\//', '$1', $methodDocBlock);
$doc = preg_replace('/^\s*\*\s?/m', '', $doc);
$doc = explode("\n@", $doc, 2);
$doc = preg_split('/(\r\n|\r|\n)/', trim($doc[0]));
$returnType = $function->getReturnType();

if (!$returnType && preg_match('/\*\s*@returns?\s+(\S+)/', $methodDocBlock, $match)) {
$returnType = $match[1];
}

$returnType = str_replace('static|CarbonInterface', 'static', $returnType ?: 'static');
$staticMethods[] = [
'@method',
Expand All @@ -494,12 +497,15 @@ function compileDoc($autoDocLines)
"$method($parameters)",
$doc[0],
];

for ($i = 1; $i < count($doc); $i++) {
$staticMethods[] = ['', '', '', $doc[$i]];
$staticImmutableMethods[] = ['', '', '', $doc[$i]];
}
}

$return = $function->getReturnType() ? ': '.$function->getReturnType()->getName() : '';

if (!empty($methodDocBlock)) {
$methodDocBlock = "\n $methodDocBlock";
} elseif (isset($nativeMethods[$method])) {
Expand All @@ -510,6 +516,7 @@ function compileDoc($autoDocLines)
" * @see https://php.net/manual/en/datetime.$link.php\n".
' */';
}

$methods .= "\n$methodDocBlock\n public$static function $method($parameters)$return;";
}
}
Expand Down

0 comments on commit 59255f7

Please sign in to comment.