Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 () {}; 

?>

Alternatives

  • Drop the extra static, and keep only one.
  • Drop all the static options.