Skip to content

Commit

Permalink
Merge pull request #47 from mkopinsky/isSubclassOf_CS
Browse files Browse the repository at this point in the history
Use correct case for calls to ReflectionClass::isSubclassOf
  • Loading branch information
j0k3r authored Mar 9, 2018
2 parents 5f8e0ae + 2320787 commit 19ed440
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function registerTaskClass($className)
protected function classIsTask($className)
{
$reflectionClass = new ReflectionClass($className);
return (bool) $reflectionClass->isSubClassOf(self::TASK_BASE_CLASS);
return (bool) $reflectionClass->isSubclassOf(self::TASK_BASE_CLASS);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ public static function isValidModelClass($class)
// Skip the following classes
// - abstract classes
// - not a subclass of Doctrine_Record
if ( ! $class->isAbstract() && $class->isSubClassOf('Doctrine_Record')) {
if ( ! $class->isAbstract() && $class->isSubclassOf('Doctrine_Record')) {

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function initDefinition()
}
$ref = new ReflectionClass($parent);

if ($ref->isAbstract() || ! $class->isSubClassOf($parent)) {
if ($ref->isAbstract() || ! $class->isSubclassOf($parent)) {
continue;
}
$parentTable = $this->_conn->getTable($parent);
Expand Down
40 changes: 20 additions & 20 deletions tests/Import/BuilderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,36 @@ public function testInheritanceGeneration()
$schemaTestInheritanceChild1Table = new ReflectionClass('SchemaTestInheritanceChild1Table');
$schemaTestInheritanceChild2Table = new ReflectionClass('SchemaTestInheritanceChild2Table');

$this->assertTrue($schemaTestInheritanceParent->isSubClassOf('Doctrine_Record'));
$this->assertTrue($schemaTestInheritanceParent->isSubClassOf('BaseSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceParent->isSubClassOf('PackageSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('BaseSchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceChild2'));
$this->assertTrue($schemaTestInheritanceParent->isSubclassOf('Doctrine_Record'));
$this->assertTrue($schemaTestInheritanceParent->isSubclassOf('BaseSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceParent->isSubclassOf('PackageSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('BaseSchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('BaseSchemaTestInheritanceChild2'));

$this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('SchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild1->isSubClassOf('BaseSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('SchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('BaseSchemaTestInheritanceParent'));

$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('SchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('SchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('BaseSchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubClassOf('PackageSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('SchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('BaseSchemaTestInheritanceParent'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('SchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('BaseSchemaTestInheritanceChild1'));
$this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('PackageSchemaTestInheritanceParent'));

$this->assertTrue($schemaTestInheritanceParentTable->isSubClassOf('Doctrine_Table'));
$this->assertTrue($schemaTestInheritanceChild1Table->isSubClassOf('SchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild1Table->isSubClassOf('PackageSchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceParentTable->isSubclassOf('Doctrine_Table'));
$this->assertTrue($schemaTestInheritanceChild1Table->isSubclassOf('SchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild1Table->isSubclassOf('PackageSchemaTestInheritanceParentTable'));

$this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('SchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('PackageSchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('SchemaTestInheritanceChild1Table'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubClassOf('PackageSchemaTestInheritanceChild1Table'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubclassOf('SchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubclassOf('PackageSchemaTestInheritanceParentTable'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubclassOf('SchemaTestInheritanceChild1Table'));
$this->assertTrue($schemaTestInheritanceChild2Table->isSubclassOf('PackageSchemaTestInheritanceChild1Table'));

# Simple Inheritance
$schemaTestSimpleInheritanceParent = new ReflectionClass('SchemaTestSimpleInheritanceParent');
$schemaTestSimpleInheritanceChild = new ReflectionClass('SchemaTestSimpleInheritanceChild');

$this->assertTrue($schemaTestSimpleInheritanceParent->hasMethod('setTableDefinition'));
$this->assertTrue($schemaTestSimpleInheritanceChild->isSubClassOf('SchemaTestSimpleInheritanceParent'));
$this->assertTrue($schemaTestSimpleInheritanceChild->isSubclassOf('SchemaTestSimpleInheritanceParent'));

# Class Table Inheritance
$schemaTestClassTableInheritanceParent = new ReflectionClass('SchemaTestClassTableInheritanceParent');
Expand Down

0 comments on commit 19ed440

Please sign in to comment.