Re: Coding standards - inclusion
| From: | Christian Weiske | Date: | Tue, 13 Oct 2009 08:54:44 +0000 |
| Subject: | Re: Coding standards - inclusion | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52933@lists.php.net to get a copy of this message | ||
Hello Eric,
> From http://pear.php.net/manual/en/standards.including.php:
> "Anywhere you are unconditionally including a class file, use
> require_once. Anywhere you are conditionally including a class file
> (for example, factory methods), use include_once."
>
> Out of curiosity, why is this the case? What benefits does it offer?
A failed require leads to a fatal error which is not catchable by code.
In you library, you should include a file and throw an exception if
that failed - this is programmatically verifiable.
--
Mit freundlichen Grüßen
Christian Weiske
E-Mail: christian.weiske@netresearch.de
Netresearch GmbH & Co. KG
-----------------------------------------------
Nonnenstraße 11d - 04229 Leipzig
Telefon: (0341) 47 842 - 20
Telefax: (0341) 47 842 - 29
-----------------------------------------------
http://www.netresearch.de - info@netresearch.de
++++++++++++++
Netresearch - Spezialagentur für TYPO3 und Magento
++++++++++++++
TYPO3 Anwendertag - 02.11.2009 - http://www.typo3-anwendertag.de
Meet Magento 02/09 - 02.11.2009 - http://www.meet-magento.de
-----------------------------------------------
Registergericht:
Amtsgericht Leipzig HRA 15614
Komplementär:
Netresearch Beteiligungs GmbH, Amtsgericht Leipzig HRB 17018
Geschäftsführer:
Michael Ablass, Thomas Fleck