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

%s function %s::%s() cannot be declared private

Description

A method may be private, as in only available to current class, or abstract, as in always redefined in a child class, but not both at the same time.

These two properties are mutually exclusive.

Example

<?php

class X {
	private abstract function foo() ;
}

?>

Literal Examples

  • abstract function X::foo() cannot be declared private

Alternatives

  • Make the method protected or public.
  • Remove the abstract keyword.