diff --git a/phpdoc.php b/phpdoc.php index e5f5270902..7136f00e08 100644 --- a/phpdoc.php +++ b/phpdoc.php @@ -23,6 +23,7 @@ $carbon = __DIR__.'/src/Carbon/Carbon.php'; $immutable = __DIR__.'/src/Carbon/CarbonImmutable.php'; $interface = __DIR__.'/src/Carbon/CarbonInterface.php'; +$phpLevel = 7.1; file_put_contents($interface, preg_replace('/(\/\/ )([\s\S]+)(<\/methods>)/mU', "$1\n\n // $3", file_get_contents($interface), 1)); require_once __DIR__.'/vendor/autoload.php'; $trait = __DIR__.'/src/Carbon/Traits/Date.php'; @@ -582,6 +583,10 @@ function compileDoc($autoDocLines, $file) ' */'; } + if (strpos($return, 'self') !== false && $phpLevel < 7.4) { + $return = ''; + } + $methods .= "\n$methodDocBlock\n public$static function $method($parameters)$return;"; } } diff --git a/src/Carbon/CarbonInterface.php b/src/Carbon/CarbonInterface.php index e36c6bc0ae..7aa1df4c88 100644 --- a/src/Carbon/CarbonInterface.php +++ b/src/Carbon/CarbonInterface.php @@ -1243,7 +1243,7 @@ public static function createSafe($year = null, $month = null, $day = null, $hou * * @return static */ - public static function createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null): self; + public static function createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null); /** * Get/set the day of year.