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