diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index 2037167aa7..f0ec5be702 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -55,12 +55,14 @@ public function getBoolCode(Variable $variable, CompilationContext $context, $us return $output; } + /** + * {@inheritdoc} + */ public function getStringsManager() { return new StringsManager(); } - public function getFcallManager() { if (!$this->fcallManager) { diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backends/ZendEngine3/Backend.php index 4b13378991..6b3e312835 100644 --- a/Library/Backends/ZendEngine3/Backend.php +++ b/Library/Backends/ZendEngine3/Backend.php @@ -56,6 +56,9 @@ public function getBoolCode(Variable $variable, CompilationContext $context, $us return $code; } + /** + * {@inheritdoc} + */ public function getStringsManager() { return new StringsManager(); @@ -421,7 +424,7 @@ public function addArrayEntry(Variable $variable, $key, $value, CompilationConte break; } - if (!$type) { + if ($type === null) { throw new CompilerException("Unknown type mapping: " . $value->getType()); } @@ -495,7 +498,8 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo $context->codePrinter->output('zephir_array_unset_string(' . $variableCode . ', SL("' . $exprIndex->getCode() . '"), ' . $flags . ');'); return; } - return parent::arrayUnset($variable, $exprIndex, $flags, $context); + + parent::arrayUnset($variable, $exprIndex, $flags, $context); } public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) @@ -552,6 +556,7 @@ public function fetchProperty(Variable $symbolVariable, Variable $variableVariab */ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context) { + // TODO: maybe optimizations as well as above $context->codePrinter->output( sprintf( 'zephir_read_static_property_ce(%s%s, %s, SL("%s"), PH_NOISY_CC%s);', @@ -565,7 +570,11 @@ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, } /** - * @return Variable + * @param $value + * @param CompilationContext $context + * @param bool $usePointer + * @return bool|string|Variable + * @throws CompilerException */ public function resolveValue($value, CompilationContext $context, $usePointer = false) { @@ -581,7 +590,9 @@ public function resolveValue($value, CompilationContext $context, $usePointer = $value = 'false'; break; default: - throw new CompilerException('ZE3: Unknown constant '.$value->getName()); + throw new CompilerException( + $this->name . ': Unknown constant ' . $value->getName() + ); } } diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php index d6514f6787..680468f599 100644 --- a/Library/BaseBackend.php +++ b/Library/BaseBackend.php @@ -19,6 +19,8 @@ namespace Zephir; +use Zephir\StringsManager; + abstract class BaseBackend { /** @@ -68,6 +70,8 @@ public function getInternalTemplatePath() /** * Resolves the path to the source template file of the backend + * + * @param string $filename * @return string Absolute path to template file */ public function getTemplateFileContents($filename) @@ -79,7 +83,11 @@ public function getTemplateFileContents($filename) return file_get_contents($filepath); } + /** + * @return StringsManager + */ abstract public function getStringsManager(); + abstract public function getTypeDefinition($type); abstract public function getTypeofCondition(Variable $variableVariable, $operator, $value, CompilationContext $context); abstract public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable); diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 5323f3b993..9dceadaced 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -19,7 +19,6 @@ namespace Zephir; -use Zephir\HeadersManager; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; @@ -101,7 +100,7 @@ class ClassDefinition protected $methods = array(); /** - * @var array + * @var string */ protected $docBlock; @@ -492,7 +491,7 @@ public function getDependencyRank() /** * Sets the class/interface docBlock * - * @param array $docBlock + * @param string $docBlock */ public function setDocBlock($docBlock) { @@ -502,7 +501,7 @@ public function setDocBlock($docBlock) /** * Returns the class/interface docBlock * - * @return array + * @return string */ public function getDocBlock() { @@ -512,18 +511,19 @@ public function getDocBlock() /** * Returns the parsed docBlock * - * @return DocBlock + * @return DocBlock|null */ public function getParsedDocBlock() { if (!$this->parsedDocblock) { if (strlen($this->docBlock) > 0) { - $parser = new DocblockParser("/" . $this->docBlock ."/"); + $parser = new DocblockParser("/" . $this->docBlock . "/"); $this->parsedDocblock = $parser->parse(); } else { return null; } } + return $this->parsedDocblock; } diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/Library/Statements/Let/ObjectPropertyArrayIndex.php index ee79c93c90..2526372041 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndex.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndex.php @@ -302,6 +302,8 @@ protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $ * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext, * @param array $statement + * + * @throws CompilerException */ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) { diff --git a/kernels/ZendEngine2/debug.c b/kernels/ZendEngine2/debug.c index 55a007ee50..186f0ded81 100644 --- a/kernels/ZendEngine2/debug.c +++ b/kernels/ZendEngine2/debug.c @@ -39,11 +39,6 @@ static zephir_debug_entry *active = NULL; */ int zephir_start_debug(){ if(!zephir_log){ - /*//zephir_log = fopen("/home/gutierrezandresfelipe/phalcon-debug.a", "w"); - zephir_log = fopen("/tmp/phalcon-debug.a", "w"); - if(!zephir_log){ - fprintf(stderr, "Can't open debug log\n"); - }*/ zephir_log = stderr; } return SUCCESS; @@ -60,7 +55,7 @@ int zephir_stop_debug(){ ptr = ptr->prev; efree(this_entry); } - //fclose(zephir_log); + zephir_log = NULL; return SUCCESS; } diff --git a/kernels/ZendEngine2/main.h b/kernels/ZendEngine2/main.h index 0dcf3221fe..686def5510 100644 --- a/kernels/ZendEngine2/main.h +++ b/kernels/ZendEngine2/main.h @@ -383,7 +383,7 @@ int zephir_fetch_parameters(int num_args TSRMLS_DC, int required_args, int optio } /** Get current hash key copying the iterator if needed */ - +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 #define ZEPHIR_GET_IMKEY(var, it) \ diff --git a/kernels/ZendEngine3/main.c b/kernels/ZendEngine3/main.c index 144acc784e..af431773b3 100644 --- a/kernels/ZendEngine3/main.c +++ b/kernels/ZendEngine3/main.c @@ -256,7 +256,7 @@ int zephir_fast_count_int(zval *value) /** * Check if a function exists using explicit function length * - * @todo Deprecated. Will be removed in future + * TODO: Deprecated. Will be removed in future */ int zephir_function_quick_exists_ex(const char *function_name, size_t function_len) { @@ -285,7 +285,7 @@ int zephir_function_exists(const zval *function_name) /** * Check if a function exists using explicit function length * - * @todo Deprecated. Will be removed in future + * TODO: Deprecated. Will be removed in future * @param function_name * @param function_len strlen(function_name) + 1 */ diff --git a/templates/ZendEngine2/project.c b/templates/ZendEngine2/project.c index 40f6904636..0f755aa401 100644 --- a/templates/ZendEngine2/project.c +++ b/templates/ZendEngine2/project.c @@ -7,6 +7,7 @@ #include +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 #include #endif @@ -37,6 +38,7 @@ PHP_INI_END() static PHP_MINIT_FUNCTION(%PROJECT_LOWER%) { +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 char* old_lc_all = setlocale(LC_ALL, NULL); if (old_lc_all) { @@ -55,6 +57,7 @@ static PHP_MINIT_FUNCTION(%PROJECT_LOWER%) REGISTER_INI_ENTRIES(); %CLASS_INITS% +// TODO: Deprecated. Will be removed in future #if PHP_VERSION_ID < 50500 setlocale(LC_ALL, old_lc_all); free(old_lc_all);