Security update for Core, with self-updated composer
[yaffs-website] / vendor / phpspec / prophecy / src / Prophecy / Doubler / Generator / TypeHintReference.php
1 <?php
2
3 namespace Prophecy\Doubler\Generator;
4
5 /**
6  * Tells whether a keyword refers to a class or to a built-in type for the
7  * current version of php
8  */
9 final class TypeHintReference
10 {
11     public function isBuiltInParamTypeHint($type)
12     {
13         switch ($type) {
14             case 'self':
15             case 'array':
16                 return true;
17
18             case 'callable':
19                 return PHP_VERSION_ID >= 50400;
20
21             case 'bool':
22             case 'float':
23             case 'int':
24             case 'string':
25                 return PHP_VERSION_ID >= 70000;
26
27             case 'iterable':
28                 return PHP_VERSION_ID >= 70100;
29
30             case 'object':
31                 return PHP_VERSION_ID >= 70200;
32
33             default:
34                 return false;
35         }
36     }
37
38     public function isBuiltInReturnTypeHint($type)
39     {
40         if ($type === 'void') {
41             return PHP_VERSION_ID >= 70100;
42         }
43
44         return $this->isBuiltInParamTypeHint($type);
45     }
46 }