php/doc-en

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

Aberta

#3.183 aberto em 16 de fev. de 2024

 (0 comentário) (0 reação) (0 responsável)XML (882 forks)auto 404
Extension: splgood first issue

Métricas do repositório

Stars
 (596 estrelas)
Métricas de merge de PR
 (Mesclagem média 99d 23h) (90 fundiu PRs em 30d)

Description

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.

Guia do colaborador