Skip to content

Commit

Permalink
- Fixed spelling mistake, changed function isClassLoadableFromDisc to…
Browse files Browse the repository at this point in the history
… isClassLoadabkelFromDisk

- Fowarded old function to the new function so that it's fully backward compatible.
- Deprecated old function with spelling mistake
  • Loading branch information
dverkade committed Aug 30, 2017
1 parent b9d696e commit 827f052
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Code/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected function shouldSkipGeneration($resultEntityType, $sourceClassName, $re
{
if (!$resultEntityType || !$sourceClassName) {
return self::GENERATION_ERROR;
} elseif ($this->definedClasses->isClassLoadableFromDisc($resultClass)) {
} elseif ($this->definedClasses->isClassLoadableFromDisk($resultClass)) {
$generatedFileName = $this->_ioObject->generateResultFileName($resultClass);
/**
* Must handle two edge cases: a competing process has generated the class and written it to disc already,
Expand Down
16 changes: 14 additions & 2 deletions lib/internal/Magento/Framework/Code/Generator/DefinedClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DefinedClasses
*/
public function isClassLoadable($className)
{
return $this->isClassLoadableFromMemory($className) || $this->isClassLoadableFromDisc($className);
return $this->isClassLoadableFromMemory($className) || $this->isClassLoadableFromDisk($className);
}

/**
Expand All @@ -36,12 +36,24 @@ public function isClassLoadableFromMemory($className)
}

/**
* Determine if a class exists on disc
* Determine if a class exists on disk
*
* @param string $className
* @return bool
* @deprecated
*/
public function isClassLoadableFromDisc($className)
{
return $this->isClassLoadableFromDisk($className);
}

/**
* Determine if a class exists on disk
*
* @param string $className
* @return bool
*/
public function isClassLoadableFromDisk($className)
{
try {
return (bool)AutoloaderRegistry::getAutoloader()->findFile($className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected function _prepareMocksForValidateData(
->willReturn($sourceClassExists);
if ($resultClassExists) {
$definedClassesMock->expects($this->once())
->method('isClassLoadableFromDisc')
->method('isClassLoadableFromDisk')
->with($this->resultClass)
->willReturn($resultClassExists);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testGenerateClassWithError()
public function testGenerateClassWithExistName($fileExists)
{
$this->definedClassesMock->expects($this->any())
->method('isClassLoadableFromDisc')
->method('isClassLoadableFromDisk')
->willReturn(true);

$resultClassFileName = '/Magento/Path/To/Class.php';
Expand Down

0 comments on commit 827f052

Please sign in to comment.