1.2.653. Magic Method Returntype Is Restricted

Some PHP magic method have compulsory return types. This means that the type is compulsory, and it is applied by default, even if it is explicitely omitted. On the other hand, any other type is forbidden, and reported as such by PHP.

The others magic methods may use mixed, or a more restrictive type.

See also Magic Methods.

1.2.653.2. Connex PHP features

1.2.653.2.1. Suggestions

  • Use the right return type for the magic method

  • Do not use any return type

1.2.653.2.2. Specs