Skip to content

A suggestion for improvement of annotations #371

Open
@jaimz22

Description

I've been working on modifying the Restler-Framework for my own special project needs. and I've got a few suggestions.

Don't reinvent the wheel! someone else has already made a wheel... and it's more round than yours!
No offense to anyone what so ever, I personally love writing all my own code, even if someone else has done it before. But recently with Composer and Packagist.com my view of that has changed. You should take advantage of it. Restler is a AWESOME package to have. In my opinion it's the best way to do REST for PHP, quick and easy. Using just a few packages can help you speed past some technical issues and get to the core functionality of what Restler is. My suggestions for this:

  • Drop the Scope class, it's really not a dependency injection container. It can't handle class inheritance, it doesn't understand the automatic resolution of constructor parameters. Use something else! lluminate/Container for instance, which is really nice and super easy to use.
  • Don't create your own annotation driver! Hey, Annotations are hard, luckily someone has already figured it out and made it easy. Use Doctrine/Annotations. I simply can't stress how powerful doctrine annotations are. each annotation is a class, the annotations can be cached. it's simply smooth sailing with Doctrine/Annotations!
  • Autoloader.php... really come on now, just use the composer autoloader, it's pretty much the best at what it does.

One thing that really kind of bugs me is PSR-2's 80 char line limit... it makes reading the Restler code kind of hard. I can only assume that you write your code, then run it through a formatter. I know I couldn't site and write my code that way! This is a bit nit-picky but honestly it's hard to read stuff. for instance, in Explorer.php there is this code:

$this->setType(
            $r,
            new ValidationInfo(Util::nestedValue($m, 'return') ? : array())
        );

why not just let it be:

$this->setType($r, new ValidationInfo(Util::nestedValue($m, 'return') ? : array()));

One last thing, organize the interfaces some how, you've got about 10 - 12 interfaces just kind of sitting the in the root source directory, create a directory(namespace) called Contracts, and put the interfaces in it just to help organize, Luracast\Restler\Contracts\iFilter() isn't so bad!

I just want to say again, I really enjoy working with Restler. I hope i'm not coming off as being rude. I greatly appreciate the work you put into Restler, as i'm sure many people do. And I always have great respect for people who comment their code (bravo!) I just know that you're putting a lot of effort into doing things that other people have already done, and I'd like to see you be able to focus on the core of what Restler is, instead of focusing your efforts on supporting classes like dependency inject containers

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions