Skip to content

Instantly share code, notes, and snippets.

@lloc
Last active March 23, 2018 11:32
Show Gist options
  • Save lloc/4ec6e60e04d5519ecc030d3bb01becc1 to your computer and use it in GitHub Desktop.
Save lloc/4ec6e60e04d5519ecc030d3bb01becc1 to your computer and use it in GitHub Desktop.

Revisions

  1. lloc revised this gist Mar 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion abstract-method-overriding.php
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,6 @@ abstract function get( int $id );
    abstract class Transient extends Option {

    // expected type of $id is still int
    abstract function baz( $id ) : Transient;
    abstract function get( $id ) : Transient;

    }
  2. lloc created this gist Mar 23, 2018.
    16 changes: 16 additions & 0 deletions abstract-method-overriding.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    <?php

    namespace wctrn\realloc;

    abstract class Option {

    abstract function get( int $id );

    }

    abstract class Transient extends Option {

    // expected type of $id is still int
    abstract function baz( $id ) : Transient;

    }