8000
Skip to content

Changed return type to static - #124

Closed
dcsg wants to merge 1 commit into
briannesbitt:masterfrom
dcsg:return-type-to-static
Closed

Changed return type to static#124
dcsg wants to merge 1 commit into
briannesbitt:masterfrom
dcsg:return-type-to-static

Conversation

@dcsg
@dcsg dcsg commented May 15, 2014
Copy link
Copy Markdown

This change will allow people that extends Carbon to have correct typehint in the IDE.

@jan-j
jan-j commented May 22, 2014
Copy link
Copy Markdown
Contributor

I'd really like to see this merged as soon as possible.

@eduardosoliv
Copy link
Copy Markdown

me as well

@eduardosoliv
Copy link
Copy Markdown

@briannesbitt this is a small change that avoid the use of vdoc's to get the right typehint, will be merged?

@dcsg
dcsg commented Jun 20, 2014
Copy link
Copy Markdown
Author

@briannesbitt ping

@briannesbitt
Copy link
Copy Markdown
Owner

Which IDE's do you guys use to make this work better?

@eduardosoliv
Copy link
Copy Markdown

phpstorm

@dcsg
dcsg commented Jun 20, 2014
Copy link
Copy Markdown
Author

@briannesbitt phpstorm

@eduardosoliv
Copy link
Copy Markdown

@briannesbitt sorry but why a simple phpdoc change that will help anyone using a quite good IDE takes a month and half to merge?

Right now all the code have to have

    /** @var Carbon $date*/

in order to have the correct typehint when extending Carbon

@dcsg
dcsg commented Jul 17, 2014
Copy link
Copy Markdown
Author

@briannesbitt any news on this?

@briannesbitt
Copy link
Copy Markdown
Owner

Merged.

@dcsg
dcsg deleted the return-type-to-static branch July 18, 2014 08:53
@dcsg
dcsg commented Jul 18, 2014
Copy link
Copy Markdown
Author

thanks :)

@nicholasnet
Copy link
Copy Markdown

This merge fixes the extension issue but breaks other one. Consider this example.

class Foo
{
    /**
     * @var \Carbon\Carbon
     */
    protected $foo;

    public function __construct()
    {
        $this->foo = \Carbon\Carbon::now();
    }
}

class Bar extends Foo
{
    public function test()
    {
        $this->foo->format('Y-m-d'); // This won't resolve now because of static phpdoc comment.
    }
}

In my opinion we should think about this merge again.

kylekatarnls added a commit that referenced this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

0