Hello everyone! This is my first mail to the internals, my apologies if I made a mistake somewhere.
I would like to propose a new type of php "file" called "phph", short for "php-header". This file could receive an optional open-tag: `<?phph` or perhaps a `declare(header=1)`, not sure what's more feasible, or if there are better solutions. This open tag could be optional for forward compatibility towards omitting the tag. Php-header files would be allowed to only contain declaring code. This means that any code that would run "while loading", would not be allowed and cause a syntax error in the same fashion as trying to add a function call in the middle of a class declaration. ```php <?php // forward compatible? change default in a major version? // any other ideas? declare(header=1); // syntax errors: echo 'foo'; $a = 'b'; // valid class Foo {} interface Bar {} function baz() {} // etc ``` By restricting it to declaration only, it would make it possible to add extra features to classes, such as annotations as there are a lot less edge cases to think about: ```php <?php @trigger_error('Foo is deprecated as of 2.0, use Bar instead', E_USER_DEPRECATED); class Foo {} ``` New scenario could be: ```php <?php declare(header=1); use Php\Debugging\Annotations\Deprecated; @Deprecated('Foo is deprecated as of 2.0, use Bar instead'); class Foo {} ``` This is a pretty rough sketch, and I'm not exactly sure if this is doable. I'm really eager to have native support for annotations and perhaps this idea could inspire someone with a solution to make this feasible. Regards, Lynn van der Berg