/** * @covers ::alert * @expectedException GanbaroDigital\Defensive\Exceptions\E5xx_UnreachableCodeReached */ public function testThrowsException() { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change throw UnreachableCode::alert(); }
/** * get a list of which subclasses a VersionNumber uses * * our requirement (for this check) is to ensure that programmers can * subclass version numbers, and their subclasses still pass this check * * for example, given this: * * class MyVersion extends SemanticVersion { ... } * * objects of type MyVersion should be compatible with: * * - other objects of type MyVersion * - any objects of type SemanticVersion * * but they cannot be compatible with objects of type VersionNumber * * @param VersionNumber $versionNumber * the object to study * @return array * a list of the subclasses that $versionNumber will be * compatible with */ private static function getCompatibleVersionSubclasses(VersionNumber $versionNumber) { $retval = []; $list = AllMatchingTypesList::from($versionNumber); foreach ($list as $type) { if ($type === VersionNumber::class) { return $retval; } $retval[$type] = $type; } // @codeCoverageIgnoreStart UnreachableCode::alert(); }