Giter Site home page Giter Site logo

anhnhan / anh-php-src Goto Github PK

View Code? Open in Web Editor NEW

This project forked from php/php-src

0.0 0.0 0.0 206.53 MB

The PHP Interpreter - planned modifications for my needs

Home Page: http://www.php.net

License: Other

JavaScript 0.12% C 62.33% Makefile 0.07% Shell 0.41% PHP 32.20% D 0.01% C++ 4.59% Awk 0.02% Perl 0.01% GAP 0.01% Objective-C 0.01% XSLT 0.01% DTrace 0.01% Yacc 0.07% Lex 0.09% Batchfile 0.01% HTML 0.02% Groff 0.03% GLSL 0.01%

anh-php-src's People

Contributors

arnaud-lb avatar bjori avatar bwoebi avatar cataphract avatar cjbj avatar dstogov avatar edinkad avatar faizshukri avatar felipensp avatar fmk avatar helly25 avatar johannes avatar kallez avatar krakjoe avatar laruence avatar m6w6 avatar nikic avatar nunoplopes avatar pierrejoye avatar remicollet avatar rlerdorf avatar sebastianbergmann avatar sgolemon avatar smalyshev avatar stigsb avatar tony2001 avatar tyrael avatar weltling avatar wez avatar zsuraski avatar

Watchers

 avatar  avatar

anh-php-src's Issues

Add null-safe member operator

Example

$val = $obj?>member($param1)?>property;

Short-circuit behavior

The above code would be equivalent with

$val = null;
if ($obj != null)
{
    $val = $obj->member($param1);
    if ($val != null)
    // ...
}

so parameters to skipped operations would be skipped.

Add pull operator for methods, properties and dictionaries

Currently I use the *pull functions from the libphutil library.

$val = mpull($objs, 'method_name');

Well, this can be done better:

$val = $objs*>method_name;

That looks especially good with Fantasque Sans Mono, where its asterisk lies in the middle of the line (and is considerably bigger).

Extension methods?

Two Three options for implementing them:

Method #1 - Fallback before MethodNotFound

Instead of instantly failing when no method could be resolved, search in the available function space first before deciding to fail.

To consider: Add this behavior to scalars and arrays, too?

Method #2 - Default __call implementation

Implement a default __call on the base object type (does such one exist?) that falls back to calling the extension method.

Disadvantage: Not possible for scalars / array.

Method #3 - Add new operator beside -> for invoking extension methods

:> would look pretty sexy.

Add annotations

Well, we can't do it too native. Scan all symbols on startup, and register them with a global annotations (or even metamodel?) manager (for now, registry).

class Foo
{
    [someAnnotation("bar")]
    public function baz() {}
}

$annotations = annotations("Foo::baz");
var_dump($annotations);
// [ someAnnotation("bar") ] as var_dump output

This has time, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.