コード例 #1
0
ファイル: Implementation.php プロジェクト: jasny/meta
 /**
  * Get type cast object
  * 
  * @return Jasny\TypeCast
  */
 protected function typeCast($value)
 {
     $typecast = TypeCast::value($value);
     $typecast->alias('self', get_class($this));
     $typecast->alias('static', get_class($this));
     return $typecast;
 }
コード例 #2
0
ファイル: TypeCastTest.php プロジェクト: jasny/typecast
 /**
  * Test type casting presenting multiple array types with no matching type
  * 
  * @expectedException         PHPUnit_Framework_Error_Notice
  * @expectedExceptionMessage  Unable to cast string "rock" to integer|boolean
  */
 public function testToMultipleTypedArrayNoMatch()
 {
     TypeCast::value([1, 'on', false, 'rock'])->toMultiple(['int[]', 'boolean[]']);
 }