1<?php 2 3namespace dokuwiki\Remote\OpenApiDoc; 4 5class DocBlockProperty extends DocBlock 6{ 7 /** @var Type */ 8 protected $type; 9 10 /** 11 * Parse the given docblock 12 * 13 * The docblock can be of a method, class or property. 14 * 15 * @param \ReflectionProperty $reflector 16 */ 17 public function __construct(\ReflectionProperty $reflector) 18 { 19 parent::__construct($reflector); 20 $this->refineVar(); 21 } 22 23 /** 24 * The Type of this property 25 * 26 * @return Type 27 */ 28 public function getType() 29 { 30 return $this->type; 31 } 32 33 /** 34 * Parse the var tag into its components 35 * 36 * @return void 37 */ 38 protected function refineVar() 39 { 40 $refType = $this->reflector->getType(); 41 $this->type = new Type($refType ? $refType->getName() : 'string', $this->getContext()); 42 43 44 if (!isset($this->tags['var'])) return; 45 46 [$type, $description] = array_map('trim', sexplode(' ', $this->tags['var'][0], 2, '')); 47 $this->type = new Type($type, $this->getContext()); 48 $this->summary = $description; 49 } 50} 51