Announcement

Collapse
No announcement yet.

It's Now Easier To Try PHP 7 On Fedora & RHEL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • It's Now Easier To Try PHP 7 On Fedora & RHEL

    Phoronix: It's Now Easier To Try PHP 7 On Fedora & RHEL

    For those interested in PHP 7, it's now easier to try out the development version of the next-generation PHP on Fedora and Red Hat Enterprise Linux based operating systems...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Decorators

    PHP 7 still lacks for decorators. Like class and method decorators.

    Here I use an decorator called "Authorize" in various languages.

    C#
    Code:
    [Authorize]
    public ActionResult Foo()
    {
        return View();
    }
    Java
    Code:
    @Authorize
    public void Foo()
    {
        // something
    }
    Python
    Code:
    @authorize
    def foo()
        # something

    Comment


    • #3
      Originally posted by uid313 View Post
      PHP 7 still lacks for decorators. Like class and method decorators.

      Here I use an decorator called "Authorize" in various languages.

      C#
      Code:
      [Authorize]
      public ActionResult Foo()
      {
          return View();
      }
      Java
      Code:
      @Authorize
      public void Foo()
      {
          // something
      }
      Python
      Code:
      @authorize
      def foo()
          # something
      Note: Java calls them annotations, C# calls them attributes, and they originated in functional and aspect-oriented programming under the name advice.
      They're not to be confused with the decorator pattern.

      Comment


      • #4
        Originally posted by ssokolow View Post
        Note: Java calls them annotations, C# calls them attributes, and they originated in functional and aspect-oriented programming under the name advice.
        They're not to be confused with the decorator pattern.
        I see. Thanks for the clarification.
        In Python they called decorators.

        Comment


        • #5
          Originally posted by uid313 View Post
          PHP 7 still lacks for decorators. Like class and method decorators.
          Let me put this this way
          Code:
              /**
               * @var string
               *
               * @Assert\NotBlank()
               * @Assert\Type(type="string")
               * @MongoDB\String
               */
              private $title;
          I use annotations on daily basic since I switched to symfony 2 (2012). There are no official specification for these, but it's commonly used.

          Comment


          • #6
            Originally posted by uid313 View Post
            I see. Thanks for the clarification.
            In Python they called decorators.

            https://en.wikipedia.org/wiki/Python...ics#Decorators
            *nod* I'm primarily a Python programmer and I use them heavily. I didn't feel it was necessary to mention that because you obviously know that and I know that I know it too.

            Comment


            • #7
              Originally posted by michal View Post
              Let me put this this way
              Code:
                  /**
                   * @var string
                   *
                   * @Assert\NotBlank()
                   * @Assert\Type(type="string")
                   * @MongoDB\String
                   */
                  private $title;
              I use annotations on daily basic since I switched to symfony 2 (2012). There are no official specification for these, but it's commonly used.
              But that is no real native support in the language.
              That is a ugly hack using reflection on comments.

              Comment

              Working...
              X