*/
protected function validateClassStatement(Class_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::CLASS_TYPE);
if (isset($stmt->extends)) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->extends), $stmt);
}
*/
protected function validateInterfaceStatement(Interface_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::INTERFACE_TYPE);
$this->ensureInterfacesExist($stmt->extends, $stmt);
}
*/
protected function validateTraitStatement(Trait_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::TRAIT_TYPE);
}
/**
*
* @throws FatalErrorException
*
- * @param Stmt $stmt
+ * @param Stmt $stmt
+ * @param string $scopeType
*/
- protected function ensureCanDefine(Stmt $stmt)
+ protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE)
{
$name = $this->getFullyQualifiedName($stmt->name);
// Store creation for the rest of this code snippet so we can find local
// issue too
- $this->currentScope[strtolower($name)] = $this->getScopeType($stmt);
+ $this->currentScope[strtolower($name)] = $scopeType;
}
/**
/**
* Get a symbol type key for storing in the scope name cache.
*
+ * @deprecated No longer used. Scope type should be passed into ensureCanDefine directly.
+ * @codeCoverageIgnore
+ *
* @param Stmt $stmt
*
* @return string