Function __global->js_ensure_type

Definitions

sources/webstandards_js_lint.php

  • Do type checking for something specific.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$_allowed_types array No No required parameter N/A N/A List of allowed types
$actual_type string No No required parameter N/A N/A Actual type involved
$pos integer No No required parameter N/A N/A Current parse position
$alt_error ?string No No Null N/A N/A Specific error message to give (null: use default)

Returns

  • Whether it type-checks
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Do type checking for something specific.
 *
 * @param  array $_allowed_types List of allowed types
 * @param  string $actual_type Actual type involved
 * @param  integer $pos Current parse position
 * @param  ?string $alt_error Specific error message to give (null: use default)
 * @return boolean Whether it type-checks
 */

function js_ensure_type(array $_allowed_types, string $actual_type, int $pos, ?string $alt_error = null) : bool