You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately this is not a problem that will go away any time soon as long as big frameworks such as Laravel & Symfony do not try to change, and worse continue even for new code, the practice of:
introducing new functions in the global scope
not using fully-qualified function names or import statement for functions, i.e. relying on the PHP function autoload fallback mechanism
An idea to tackle this problem would be to expose yet another setting, e.g. user-global-functions = list<string|regex> which would have the following effects:
it considers this function as registered and declared within the scope code. This means that it will be namespaced. For example:
<?php// vendor/symfony/deprecation-contracts/functions.phpnamespaceScoped;
if (!function_exists('trigger_deprecation')) { // <- this declaration is now incorrect, the new setting would help fix thatfunctiontrigger_deprecation() { ...}
}
the function name would not be registered as internal and would kick in if the call is not FQ, e.g. using trigger_deprecation() in the code (without the leading \ or use statement), would be resolved to Scoped\trigger_deprecation.
The text was updated successfully, but these errors were encountered:
Unfortunately this is not a problem that will go away any time soon as long as big frameworks such as Laravel & Symfony do not try to change, and worse continue even for new code, the practice of:
An idea to tackle this problem would be to expose yet another setting, e.g.
user-global-functions = list<string|regex>
which would have the following effects:Original code:
(currently) Scoped code:
trigger_deprecation()
in the code (without the leading\
or use statement), would be resolved toScoped\trigger_deprecation
.The text was updated successfully, but these errors were encountered: