name = $reflectionObject->name; $this->value = $reflectionObject->getValue(); if ($reflectionObject->isPrivate()) { $this->visibility = 'private'; } elseif ($reflectionObject->isProtected()) { $this->visibility = 'protected'; } else { $this->visibility = 'public'; } return $this; } /** * @param Const_ $node * @return static */ public function readObjectFromStubNode($node) { $this->name = $this->getConstantFQN($node, $node->name->name); $this->value = $this->getConstValue($node); $this->collectTags($node); $parentNode = $node->getAttribute('parent'); if (property_exists($parentNode, 'attrGroups')) { $this->availableVersionsRangeFromAttribute = self::findAvailableVersionsRangeFromAttribute($parentNode->attrGroups); } if ($parentNode instanceof ClassConst) { if ($parentNode->isPrivate()) { $this->visibility = 'private'; } elseif ($parentNode->isProtected()) { $this->visibility = 'protected'; } else { $this->visibility = 'public'; } $this->parentName = self::getFQN($parentNode->getAttribute('parent')); } return $this; } /** * @param $node * @return int|string|bool|float|null */ protected function getConstValue($node) { if (in_array('value', $node->value->getSubNodeNames(), true)) { return $node->value->value; } if (in_array('expr', $node->value->getSubNodeNames(), true)) { if ($node->value instanceof UnaryMinus) { return -$node->value->expr->value; } elseif ($node->value instanceof Cast && $node->value->expr instanceof ConstFetch) { return $node->value->expr->name->parts[0]; } return $node->value->expr->value; } if (in_array('name', $node->value->getSubNodeNames(), true)) { $value = isset($node->value->name->parts[0]) ? $node->value->name->parts[0] : $node->value->name->name; return $value === 'null' ? null : $value; } return null; } /** * @param NodeAbstract $node * @param string $nodeName * @return string */ protected function getConstantFQN(NodeAbstract $node, $nodeName) { $namespace = ''; $parentParentNode = $node->getAttribute('parent')->getAttribute('parent'); if ($parentParentNode instanceof Namespace_ && !empty($parentParentNode->name)) { $namespace = '\\' . implode('\\', $parentParentNode->name->parts) . '\\'; } return $namespace . $nodeName; } /** * @param stdClass|array $jsonData * @throws Exception */ public function readMutedProblems($jsonData) { foreach ($jsonData as $constant) { if ($constant->name === $this->name && !empty($constant->problems)) { foreach ($constant->problems as $problem) { switch ($problem->description) { case 'wrong value': $this->mutedProblems[StubProblemType::WRONG_CONSTANT_VALUE] = $problem->versions; break; case 'missing constant': $this->mutedProblems[StubProblemType::STUB_IS_MISSED] = $problem->versions; break; default: throw new Exception("Unexpected value $problem->description"); } } } } } } __halt_compiler();----SIGNATURE:----QGLm4iGJ9KMZ3tEjKpCsEvJ8RUGT0Y/ov8iRK9T3SuyMgmFQrbeCUFrYxRoL7CSkBZKpW57mK2AinM9cBgH7l0Nck4DqXNbmBaygJuVg6015P+0r+uk8rCo5kcvtIEn+kB+22cpynWnjmiWC1qvR/k4+y0VDZFq5Co1ZyXZdQZgDfJH0krgrN07W7bpBglLFE2sZ7fglDBPqWLAWNzAENKDpDIk6AhBvGF+rhgrIXppE7QAivxeDjDdqBYPeXY50/a0+nqpvftCq+3DpTpkVP8PRgdvta2aMFxf6Xz7eJAXeyo6uJT2t9Gi+V+y1qbEG7hhHDdYSPtovMoF/jjPcke8ht+45NcgooBzYUPOlg58sA2HUIunTBpe7Kbtz1SdBzUNngzsV/tFPagTSXAecfAkuD7rUUlZ00wx3uDFZ2RUE+J7hs5y0T8uHXKgfBs5CDvSAysnlkkcSHyXzc/sDMFjoFpDLCFdBASqcau3aeSv/h+cgaG50K/OANMUR0GEe8Hee+jjvmmavvd9JwZDecRGhbwlQY/NxwF+nusHGuXaMcLQHJ1KG9VarOysj/lBHgM1/WqyHAd2zQNhCiQT1zbdE57OM1MIdT+s6uOFY6DMVL2N7ReslSZR9rsahqO7ecCr346DxWXHhvBNXPN43w480beBQ2PR/6/9E50eges0=----ATTACHMENT:----ODE4OTk3OTUzODM5NTQ1OCAzNDE0NDYxMDUyMTQyMzg2IDIwMzI4ODc3MzU3MTcxNjE=