Multiple static modifiers are not allowed

Description

Only one static option is necessary to make a property static. Two is overkill, and not needed, so PHP reports it.

There are similar messages for multiple readonly, or multiple static.

Multiple static on a closure or arrow function leads to a parse error.

Example

<?php

class X {
     private static static A $b;

     private static static function a() {}
}

static static function () {};

?>

Solutions

  • Drop the extra static, and keep only one.

  • Drop all the static options.