Another debug help

Discussion in 'PHP' started by plussy, Aug 13, 2012.

  1. #1
    I have a the following class

    
    abstract class Discount {
        public static abstract function getId();
    }
    
    PHP:
    The error I am getting is the following

    Now I found this
    here: http://uk.php.net/manual/en/migration52.incompatible.php (sorry can''t paste links at the moment)

    What is the best way to fix it? can I just remove the static from the function declaration? If so will it have any effect on the way the function works etc?
     
    plussy, Aug 13, 2012 IP
  2. Soulstone

    Soulstone Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Is there any specific reason you're using an abstract class instead of an interface in the situation you're describing?
     
    Soulstone, Aug 13, 2012 IP
  3. plussy

    plussy Peon

    Messages:
    152
    Likes Received:
    5
    Best Answers:
    9
    Trophy Points:
    0
    #3
    don't know. I am just trying to fix some errors. code is not mine.
     
    plussy, Aug 13, 2012 IP
  4. Soulstone

    Soulstone Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Okay. An abstract and static function doesn't really make much sense. I'd say to fix the error, remove the "abstract" declaration and just do like this:
    
    [COLOR=#111111][FONT=monospace]abstract [/FONT][/COLOR][COLOR=#000000][FONT=monospace][B]class[/B][/FONT][/COLOR][COLOR=#111111][FONT=monospace] Discount [/FONT][/COLOR][COLOR=#009900][FONT=monospace]{[/FONT][/COLOR]
    [COLOR=#111111][FONT=monospace]    [/FONT][/COLOR][COLOR=#000000][FONT=monospace][B]public[/B][/FONT][/COLOR][COLOR=#111111][FONT=monospace] static [/FONT][/COLOR][COLOR=#000000][FONT=monospace][B]function[/B][/FONT][/COLOR][COLOR=#111111][FONT=monospace] getId[/FONT][/COLOR][COLOR=#009900][FONT=monospace]([/FONT][/COLOR][COLOR=#009900][FONT=monospace])[/FONT][/COLOR][FONT=monospace][COLOR=#339933]{}[/COLOR][/FONT]
    [COLOR=#009900][FONT=monospace]}[/FONT][/COLOR]
    
    Code (markup):
     
    Soulstone, Aug 13, 2012 IP
  5. plussy

    plussy Peon

    Messages:
    152
    Likes Received:
    5
    Best Answers:
    9
    Trophy Points:
    0
    #5
    thanks will give it a go.
     
    plussy, Aug 14, 2012 IP