Typehinting merge #50
							
								
								
									
										43
									
								
								tests/type_hinting.aer
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								tests/type_hinting.aer
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
class Program {
 | 
			
		||||
	private int $test = 7;
 | 
			
		||||
 | 
			
		||||
	void testChar(char $value) {
 | 
			
		||||
		var_dump($value);
 | 
			
		||||
		var_dump(is_char($value));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void testFloat(float $value) {
 | 
			
		||||
		var_dump($value);
 | 
			
		||||
		var_dump(is_float($value));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void testObject(object $value) {
 | 
			
		||||
		var_dump($value);
 | 
			
		||||
		var_dump(is_object($value));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void testString(string $value) {
 | 
			
		||||
		var_dump($value);
 | 
			
		||||
		var_dump(is_string($value));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void testVoid(void $value) {
 | 
			
		||||
		var_dump($value);
 | 
			
		||||
		var_dump(is_void($value));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void main() {
 | 
			
		||||
		object $objval;
 | 
			
		||||
		void $voidval;
 | 
			
		||||
		$this->testChar('c');
 | 
			
		||||
		$this->testChar(NULL);
 | 
			
		||||
		$this->testFloat(4);
 | 
			
		||||
		$this->testFloat(56.3);
 | 
			
		||||
		$this->testObject($objval);
 | 
			
		||||
		$this->testObject($this);
 | 
			
		||||
		$this->testString('sample text');
 | 
			
		||||
		$this->testString(NULL);
 | 
			
		||||
		$this->testVoid($voidval);
 | 
			
		||||
		$this->testVoid(NULL);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								tests/type_hinting.exp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								tests/type_hinting.exp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
char(c)
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
char()
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
float(4)
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
float(56.3)
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
object()
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
object(Program) {
 | 
			
		||||
 ['test'] =>
 | 
			
		||||
  int(7)
 | 
			
		||||
 }
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
string(11 'sample text')
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
string(0 '')
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
void(NULL)
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
void(NULL)
 | 
			
		||||
bool(TRUE)
 | 
			
		||||
		Reference in New Issue
	
	Block a user