Skip to content

v0.7.0 - enforce nullable type declaration for default null values

Compare
Choose a tag to compare
@krzysztofrewak krzysztofrewak released this 29 Nov 09:22
· 47 commits to main since this release
0b24f70

Before:

<?php

class NullableTypeForDefaultNull
{
    public function getNameLabel(string $name, string $title = null): string
    {
        $label = $name;
        if ($title !== null) {
            $label .= " " . $title;
        }

        return $label;
    }
}

After:

<?php

declare(strict_types=1);

class NullableTypeForDefaultNull
{
    public function getNameLabel(string $name, ?string $title = null): string
    {
        $label = $name;
        if ($title !== null) {
            $label .= " " . $title;
        }

        return $label;
    }
}