hasParentType() 공개 메소드

public hasParentType ( ) : boolean
리턴 boolean True if this class has a parent class
예제 #1
0
 /**
  * Check to see if the given Clazz is a duplicate
  *
  * @return null
  */
 public static function analyzeParentConstructorCalled(CodeBase $code_base, Clazz $clazz)
 {
     // Only look at classes configured to require a call
     // to its parent constructor
     if (!in_array($clazz->getName(), Config::get()->parent_constructor_required)) {
         return;
     }
     // Don't worry about internal classes
     if ($clazz->isInternal()) {
         return;
     }
     // Don't worry if there's no parent class
     if (!$clazz->hasParentType()) {
         return;
     }
     if (!$code_base->hasClassWithFQSEN($clazz->getParentClassFQSEN())) {
         // This is an error, but its caught elsewhere. We'll
         // just roll through looking for other errors
         return;
     }
     $parent_clazz = $code_base->getClassByFQSEN($clazz->getParentClassFQSEN());
     if (!$parent_clazz->isAbstract() && !$clazz->getIsParentConstructorCalled()) {
         Issue::maybeEmit($code_base, $clazz->getContext(), Issue::TypeParentConstructorCalled, $clazz->getFileRef()->getLineNumberStart(), (string) $clazz->getFQSEN(), (string) $parent_clazz->getFQSEN());
     }
 }
예제 #2
0
 /**
  * Check to see if the given Clazz is a duplicate
  *
  * @return null
  */
 public static function analyzeParentClassExists(CodeBase $code_base, Clazz $clazz)
 {
     // Don't worry about internal classes
     if ($clazz->isInternal()) {
         return;
     }
     if ($clazz->hasParentType()) {
         self::fqsenExistsForClass($clazz->getParentClassFQSEN(), $code_base, $clazz, Issue::UndeclaredExtendedClass);
     }
     foreach ($clazz->getInterfaceFQSENList() as $fqsen) {
         self::fqsenExistsForClass($fqsen, $code_base, $clazz, Issue::UndeclaredInterface);
     }
     foreach ($clazz->getTraitFQSENList() as $fqsen) {
         self::fqsenExistsForClass($fqsen, $code_base, $clazz, Issue::UndeclaredTrait);
     }
 }