X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fnikic%2Fphp-parser%2Flib%2FPhpParser%2FBuilder%2FParam.php;fp=vendor%2Fnikic%2Fphp-parser%2Flib%2FPhpParser%2FBuilder%2FParam.php;h=3e6e0f772e8c28a100127cd519446e577db7abe1;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php new file mode 100644 index 000000000..3e6e0f772 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php @@ -0,0 +1,78 @@ +name = $name; + } + + /** + * Sets default value for the parameter. + * + * @param mixed $value Default value to use + * + * @return $this The builder instance (for fluid interface) + */ + public function setDefault($value) { + $this->default = $this->normalizeValue($value); + + return $this; + } + + /** + * Sets type hint for the parameter. + * + * @param string|Node\Name|Node\NullableType $type Type hint to use + * + * @return $this The builder instance (for fluid interface) + */ + public function setTypeHint($type) { + $this->type = $this->normalizeType($type); + if ($this->type === 'void') { + throw new \LogicException('Parameter type cannot be void'); + } + + return $this; + } + + /** + * Make the parameter accept the value by reference. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeByRef() { + $this->byRef = true; + + return $this; + } + + /** + * Returns the built parameter node. + * + * @return Node\Param The built parameter node + */ + public function getNode() { + return new Node\Param( + $this->name, $this->default, $this->type, $this->byRef + ); + } +}