On 13/08/2019 18:45, Mark Randall wrote:
I thought about this as my first consideration, however it effectively requires that the PHP code within the package class is fully parsed and executed in order for it to retrieve the data.

Consider pre-loading where the code is compiled, but not run, it would not be possible to use namespace level defines to add compile-level optimizations or checks (at least without some AST hackery).


Ah, that makes sense. Does that necessarily mean we need a dummy class, though? The autoloading logic in the engine knows that it called the autoload callback expecting a package definition, so can count as success that the package is now defined.

In other words, the file the autoloader included would look like this (again, sticking to the notion that "package" is separate from "namespace"):


#
# File: /lib/company/project1.php
#

<?php

packagedef company/project1 {
    strict_types=1;
    strict_operators=1;
    upgrade_errors_to_exceptions=E_ALL;
}


Regards,

--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to