igorw / yolo

The microframework with swag.
yolophp.computer
MIT License
200 stars 27 forks source link

Lack of Symfony encapsulation, bro #6

Closed hikari-no-yume closed 10 years ago

hikari-no-yume commented 10 years ago
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Ew, man. Why?

yolo\yolo(function (yolo\Request $request) {
    return new yolo\Response('YOLO');
});

Now that's what I'm talking about.

Implementation:

class Request extends Symfony\Component\HttpFoundation\Request {};
class Response extends Symfony\Component\HttpFoundation\Responds {};
igorw commented 10 years ago

I saw that laravel uses class_alias. I read somewhere on the internet that class_alias is faster than extends. Thoughts? /cc @taylorotwell

hikari-no-yume commented 10 years ago

@igorw I had no idea class aliases existed, though they're what I wanted. Just use class_alias.

hikari-no-yume commented 10 years ago

This should work: class_alias('Symfony\Component\HttpFoundation\Request', 'yolo\Request', true)

hikari-no-yume commented 10 years ago

Implemented here: https://github.com/igorw/yolo/pull/7

igorw commented 10 years ago

ist gefixed

hikari-no-yume commented 10 years ago

sehr gut