php/doc-en

Enhancement: Explicitly mentioned that the callback must not have any type of error handling

开放

#3,183 创建于 2024年2月16日

 (0 条评论) (0 个反应) (0 位负责人)XML (882 个派生)auto 404
Extension: splgood first issue

仓库指标

星标
 (596 个星标)
PR 合并指标
 (平均合并 99天 23小时) (30 天内合并 90 个 PR)

描述

From manual page: https://php.net/function.spl-autoload-register


It seems that I'm not the first one creating a silly sideeffect by adding a error handling into the autoloader when the class can't be loaded. see e.g. https://stackoverflow.com/questions/15054993/php-autoload-with-exception-handling-waste-of-time

So it is maybe a good enhancement especially for beginners to mention that the callback to register must not raise a throwable if the class could not be loaded because of missing file. Thus would prevent other programmers to repeat this since it is general best pratice to throw an exception if something doesn't is as expected, which would also be the case if the class to autoload does not exist.

贡献者指南