<?php
 
/**
 
 * @package genericarray
 
 */
 
 
/**
 
 * Array of GenericX.
 
 */
 
class ArrayOfGenericX extends ArrayObject {
 
    /**
 
     * Sets an item in the array.
 
     * @param int|string $offset The offset of the item.
 
     * @param GenericX $value The value of the item.
 
     */
 
    public function offsetSet($offset, $value) {
 
        $this->checkType($value);
 
        parent::offsetSet($offset, $value);
 
    }
 
    
 
    /**
 
     * Uses type hints to check the type of the value being inserted into the array.
 
     * @param GenericX $value The value being inserted into the array.
 
     */
 
    private function checkType(GenericX $value) { }
 
}
 
?>
 
 |