comparison core/core.api.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1219 * assertion is ever FALSE it indicates an error in the code or in module or 1219 * assertion is ever FALSE it indicates an error in the code or in module or
1220 * theme configuration files. User-provided configuration files should be 1220 * theme configuration files. User-provided configuration files should be
1221 * verified with standard control structures at all times, not just checked in 1221 * verified with standard control structures at all times, not just checked in
1222 * development environments with assert() statements on. 1222 * development environments with assert() statements on.
1223 * 1223 *
1224 * When runtime assertions fail in PHP 7 an \AssertionError is thrown.
1225 * Drupal uses an assertion callback to do the same in PHP 5.x so that unit
1226 * tests involving runtime assertions will work uniformly across both versions.
1227 *
1228 * The Drupal project primarily uses runtime assertions to enforce the 1224 * The Drupal project primarily uses runtime assertions to enforce the
1229 * expectations of the API by failing when incorrect calls are made by code 1225 * expectations of the API by failing when incorrect calls are made by code
1230 * under development. While PHP type hinting does this for objects and arrays, 1226 * under development. While PHP type hinting does this for objects and arrays,
1231 * runtime assertions do this for scalars (strings, integers, floats, etc.) and 1227 * runtime assertions do this for scalars (strings, integers, floats, etc.) and
1232 * complex data structures such as cache and render arrays. They ensure that 1228 * complex data structures such as cache and render arrays. They ensure that
1233 * methods' return values are the documented datatypes. They also verify that 1229 * methods' return values are the documented datatypes. They also verify that
1234 * objects have been properly configured and set up by the service container. 1230 * objects have been properly configured and set up by the service container.
1235 * Runtime assertions are checked throughout development. They supplement unit 1231 * They supplement unit tests by checking scenarios that do not have unit tests
1236 * tests by checking scenarios that do not have unit tests written for them, 1232 * written for them.
1237 * and by testing the API calls made by all the code in the system. 1233 *
1238 * 1234 * There are two php settings which affect runtime assertions. The first,
1239 * When using assert() keep the following in mind: 1235 * assert.exception, should always be set to 1. The second is zend.assertions.
1240 * - Runtime assertions are disabled by default in production and enabled in 1236 * Set this to -1 in production and 1 in development.
1241 * development, so they can't be used as control structures. Use exceptions
1242 * for errors that can occur in production no matter how unlikely they are.
1243 * - Assert() functions in a buggy manner prior to PHP 7. If you do not use a
1244 * string for the first argument of the statement but instead use a function
1245 * call or expression then that code will be evaluated even when runtime
1246 * assertions are turned off. To avoid this you must use a string as the
1247 * first argument, and assert will pass this string to the eval() statement.
1248 * - Since runtime assertion strings are parsed by eval() use caution when
1249 * using them to work with data that may be unsanitized.
1250 * 1237 *
1251 * See https://www.drupal.org/node/2492225 for more information on runtime 1238 * See https://www.drupal.org/node/2492225 for more information on runtime
1252 * assertions. 1239 * assertions.
1253 * @} 1240 * @}
1254 */ 1241 */
1582 * @defgroup listing_page_namespace Page header for Namespaces page 1569 * @defgroup listing_page_namespace Page header for Namespaces page
1583 * @{ 1570 * @{
1584 * Introduction to namespaces 1571 * Introduction to namespaces
1585 * 1572 *
1586 * PHP classes, interfaces, and traits in Drupal are 1573 * PHP classes, interfaces, and traits in Drupal are
1587 * @link http://php.net/manual/en/language.namespaces.rationale.php namespaced. @endlink 1574 * @link http://php.net/manual/language.namespaces.rationale.php namespaced. @endlink
1588 * See the 1575 * See the
1589 * @link oo_conventions Objected-oriented programming conventions @endlink 1576 * @link oo_conventions Objected-oriented programming conventions @endlink
1590 * for more information. 1577 * for more information.
1591 * 1578 *
1592 * @see oo_conventions 1579 * @see oo_conventions