Skip to content

Anonymous Classes - #1118

Closed
philsturgeon wants to merge 24 commits into
php:masterfrom
krakjoe:anon
Closed

philsturgeon wants to merge 24 commits into
php:masterfrom
krakjoe:anon

Conversation

@philsturgeon

Copy link
Copy Markdown

RFC: https://wiki.php.net/rfc/anonymous_classes

This is a work in progress right now and the RFC is being worked on, as are the tests.

Please keep feature discussions to the mailing list.

@HallofFamer

Copy link
Copy Markdown

This is excellent, I've been trying to integrate the old Anonymous class RFC into a custom build PHP, but this will make things a lot easier since it's designed for PHP 7. I wonder though, is it possible to make this into a .diff patch so I can play with its functionality on a linux server?

@philsturgeon

Copy link
Copy Markdown
Author

Why not just grab the branch and build it? It’s slightly older than master, but changes are going to be pulled in shortly. Either way it runs just fine.

-- 
Phil

From: HallofFamer [email protected]
Reply: php/php-src [email protected]>
Date: February 24, 2015 at 12:57:16 PM
To: php/php-src [email protected]>
Cc: Phil Sturgeon [email protected]>
Subject:  Re: [php-src] [WIP] Anonymous Classes (#1118)

This is excellent, I've been trying to integrate the old Anonymous class RFC into a custom build PHP, but this will make things a lot easier since it's designed for PHP 7. I wonder though, is it possible to make this into a .diff patch so I can play with its functionality on a linux server?

—
Reply to this email directly or view it on GitHub.

@suralc

suralc commented Feb 24, 2015

Copy link
Copy Markdown

@HallofFamer If you really need to download the diff in text form (instead of checking out the branch using git). you can add .patch (or .diff) to this pages url:
https://github.com/php/php-src/pull/1118.diff

@HallofFamer

Copy link
Copy Markdown

@suralc: Oh thats excellent, thanks. I really love Anonymous and Nested class features, they make PHP's OO more complete. Good luck to this RFC!

@Majkl578

Majkl578 commented Mar 7, 2015

Copy link
Copy Markdown
Contributor

In the RFC, you mention Class$$1 format, but here you use Class@1, which one is correct?

@Majkl578

Majkl578 commented Mar 9, 2015

Copy link
Copy Markdown
Contributor

Looks like get_class() is broken anyway, it returns (probably) pointer address: http://3v4l.org/BQhJM/rfc#rfc-anonymous_classes (but maybe 3v4l is using just outdated commit)

How would be nested anonymous clases named? Imagine:

$foo = new class {
    function bar() {
        return new class {};
    }
};
var_dump(get_class($foo->bar()));

@philsturgeon

Copy link
Copy Markdown
Author

@Majkl578 nothing broken about it. Check the RFC for more on naming things. Ignore Class$$ its Class@

@philsturgeon

Copy link
Copy Markdown
Author

Oh, yep, the names were off. The code just does class@foo instead of trying to give it a fancy human readable name.

That doesn't matter much, as relying on the class name or type hinting against it would be useless and wildly irresponsible. The RFC is now up to date with code output.

@philsturgeon philsturgeon changed the title [WIP] Anonymous Classes Anonymous Classes Mar 11, 2015

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file seem unrelated.

@nikic

nikic commented Apr 27, 2015

Copy link
Copy Markdown
Member

Superseded by #1249.

@nikic nikic closed this Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants