Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class deprecation via class loader #3

Open
beberlei opened this issue Jul 11, 2020 · 2 comments
Open

Class deprecation via class loader #3

beberlei opened this issue Jul 11, 2020 · 2 comments

Comments

@beberlei
Copy link
Member

Instead of complicated in file approaches, we could provide a deprecation class loader that just checks and triggers deprecations and then delegates autoloading further to Composer.

This could hook into Composer as a plugin and generate a map of deprecated classes from all installed packages, and then in your code you would only prepend the autoloader:

if ($isDevMode) {
    spl_autoload_register(['DeprecationLoader', 'loadClass'], true, true);
}
@nicolas-grekas
Copy link
Member

Please don't do this in this lib, that'd be past its domain to me.
This concern is better delegated to frameworks.

@beberlei
Copy link
Member Author

@nicolas-grekas the reason is that the if (false) or so approach for deprecating classes breaks for some of our users with preloading and we are looking to deprecate old classes a different way.

See doctrine/persistence#97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants