Типы для php-lint v2

This commit is contained in:
origami11 2021-02-22 14:07:51 +03:00
parent f570da257d
commit 6173eb4892
31 changed files with 83 additions and 76 deletions

View file

@ -39,7 +39,7 @@ class Collection implements ArrayAccess
* *
* @return void * @return void
*/ */
public function set(/*.string.*/$key, /*.any.*/$value) public function set($key/*: string*/, $value/*: any*/)
{ {
$this->data[$key] = $value; $this->data[$key] = $value;
} }
@ -58,7 +58,7 @@ class Collection implements ArrayAccess
public function getInt($key, $default = 0) public function getInt($key, $default = 0)
{ {
return intval($this->get($key, $default)); return (int)$this->get($key, $default);
} }
public function getString($key, $default = '') public function getString($key, $default = '')
@ -68,7 +68,7 @@ class Collection implements ArrayAccess
public function getNat($key, $default = 1) public function getNat($key, $default = 1)
{ {
$result = intval($this->get($key, $default)); $result = (int)$this->get($key, $default);
return (($result > 0) ? $result : $default); return (($result > 0) ? $result : $default);
} }

View file

@ -36,12 +36,12 @@ class Connection_HttpResponse
if (isset($this->param['Transfer-Encoding']) && $this->param['Transfer-Encoding'] == 'chunked') { if (isset($this->param['Transfer-Encoding']) && $this->param['Transfer-Encoding'] == 'chunked') {
//$this->data = substr($this->response, $this->offset); //$this->data = substr($this->response, $this->offset);
$line = hexdec($this->getLine()); $nline = hexdec($this->getLine());
$chunk = array(); $chunk = array();
while ($line > 0) { while ($nline > 0) {
$chunk [] = substr($this->response, $this->offset, $line); $chunk [] = substr($this->response, $this->offset, $nline);
$this->offset += $line; $this->offset += $nline;
$line = hexdec($this->getLine()); $nline = hexdec($this->getLine());
} }
$this->data = implode("", $chunk); $this->data = implode("", $chunk);

View file

@ -40,7 +40,7 @@ class Controller_Action
private $helpers = array(); // Помошники для действий private $helpers = array(); // Помошники для действий
public $param = array(); // Параметры для ссылки public $param = array(); // Параметры для ссылки
public /*.Registry.*/$_registry; // Ссылка на реестр public $_registry/*: Registry*/; // Ссылка на реестр
public $_shortcut; public $_shortcut;
public $modulePrefix = ''; public $modulePrefix = '';
public $iconPath = ''; public $iconPath = '';
@ -114,7 +114,7 @@ class Controller_Action
if(file_exists($template)) { break; } if(file_exists($template)) { break; }
} }
/*.View_Composite.*/$tpl = new $viewClass($template); $tpl/*: View_Composite*/ = new $viewClass($template);
$assets = Path::join(enableHttps(WWW_PATH), "assets", "css"); $assets = Path::join(enableHttps(WWW_PATH), "assets", "css");
$tpl->set('icons', $this->iconPath); // Путь к файлам текущей темы $tpl->set('icons', $this->iconPath); // Путь к файлам текущей темы
@ -207,7 +207,7 @@ class Controller_Action
*/ */
public function nUrl($name, array $param = array()) public function nUrl($name, array $param = array())
{ {
/*.Filter_ActionAccess.*/$access = $this->access; $access/*: Filter_ActionAccess*/ = $this->access;
if ($access == null || $access->checkAction($name)) { if ($access == null || $access->checkAction($name)) {
return Functions::lcurry(array($this, 'postUrl'), $name, $param); return Functions::lcurry(array($this, 'postUrl'), $name, $param);
@ -331,7 +331,7 @@ class Controller_Action
if ($this->view instanceof View_View) { if ($this->view instanceof View_View) {
$this->view->assignValues($this->ctrlValues); $this->view->assignValues($this->ctrlValues);
/*.Widgets_Widget.*/$node = null; $node/*: Widgets_Widget*/ = null;
foreach ($this->childNodes as $name => $node) { foreach ($this->childNodes as $name => $node) {
$node->make($this); $node->make($this);
$this->view->setView($name, $node->view); $this->view->setView($name, $node->view);

View file

@ -54,9 +54,9 @@ class Controller_Component
public $component_title; public $component_title;
public $COMPONENTS_WEB; public $COMPONENTS_WEB;
public /*.Settings.*/$registry; public $registry/*: Settings*/;
public /*.Database.*/$db; public $db/*: Database*/;
public /*.Collection.*/$parameter; public $parameter/*: Collection*/;
public $module; public $module;
public $item_module; public $item_module;
@ -88,7 +88,7 @@ class Controller_Component
public function getView($name) public function getView($name)
{ {
// //
/*.Settings.*/$registry = $this->registry; $registry/*: Settings*/ = $this->registry;
$template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template')); $template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template'));
$selected = null; $selected = null;
@ -128,7 +128,7 @@ class Controller_Component
} }
public function getTemplatePath($name) { public function getTemplatePath($name) {
/*.Settings.*/$registry = $this->registry; $registry/*: Settings*/ = $this->registry;
$template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template')); $template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template'));
foreach ($this->viewPath as $index => $viewPath) { foreach ($this->viewPath as $index => $viewPath) {
if(is_dir(Path::join($this->viewPath[$index], 'templates', $template))) { if(is_dir(Path::join($this->viewPath[$index], 'templates', $template))) {
@ -157,7 +157,7 @@ class Controller_Component
return $model; return $model;
} }
public function options($key, $val, /*.Database_PDOStatement.*/$res) { public function options($key, $val, $res/*: Database_PDOStatement*/) {
$result = array(); $result = array();
while($res->next()) { while($res->next()) {
$result[] = array('value' => $res->getString($key), 'name' => $res->getString($val)); $result[] = array('value' => $res->getString($key), 'name' => $res->getString($val));
@ -185,7 +185,7 @@ class Controller_Component
/** /**
* Генерация интерфейса для выбора галлереи фотографии * Генерация интерфейса для выбора галлереи фотографии
*/ */
public function setParameters(/*.View_Composite.*/$view) public function setParameters($view/*: View_Composite*/)
{ {
$form = new Form_Form(); $form = new Form_Form();
$options = new Form_OptionFactory($this->db, $this->registry); $options = new Form_OptionFactory($this->db, $this->registry);
@ -198,7 +198,7 @@ class Controller_Component
$view->component_title = $settings['title']; $view->component_title = $settings['title'];
} }
static function loadComponent($expression, Database $db, /*.Registry.*/ $registry) static function loadComponent($expression, Database $db, $registry/*: Registry*/)
{ {
$expression = htmlspecialchars_decode($expression); $expression = htmlspecialchars_decode($expression);
@ -218,7 +218,7 @@ class Controller_Component
$path = Path::join (BASE_PATH, 'components', $name, $name . '.php'); $path = Path::join (BASE_PATH, 'components', $name, $name . '.php');
$className = 'Component_' . $name; $className = 'Component_' . $name;
/*.Controller_Component.*/$component = null; $component/*: Controller_Component*/ = null;
if (file_exists($path)) { if (file_exists($path)) {
require_once ($path); require_once ($path);
@ -293,12 +293,12 @@ class Controller_Component
return null; return null;
} }
function raw_query(/*.ComponentRequest.*/ $request) function raw_query($request/*: ComponentRequest*/)
{ {
$arr = $request->r->export('get'); $arr = $request->r->export('get');
$param = array(); $param = array();
/*.Collection.*/$parameter = $this->parameter; $parameter/*: Collection*/ = $this->parameter;
foreach($parameter->export() as $key => $value) { foreach($parameter->export() as $key => $value) {
$param[$key] = $value; $param[$key] = $value;
} }
@ -316,7 +316,7 @@ class Controller_Component
} }
function query(/*.ComponentRequest.*/ $request, $list) function query($request/*: ComponentRequest*/, $list)
{ {
$arr = $request->r->export('get'); $arr = $request->r->export('get');
@ -336,7 +336,7 @@ class Controller_Component
Controller_Site::addRequireJsPath($name, $path, $shim); Controller_Site::addRequireJsPath($name, $path, $shim);
} }
function actionIndex(/*.ComponentRequest.*/ $request) { function actionIndex($request/*: ComponentRequest*/) {
} }
} }

View file

@ -94,7 +94,7 @@ class Controller_Front extends Controller_Action
$this->default = $name; $this->default = $name;
} }
public function execute(HTTPRequest $request) public function execute(HttpRequest $request)
{ {
$name = explode("_", $request->get($this->_param, $this->default)); $name = explode("_", $request->get($this->_param, $this->default));
if (count($name) >= 2) { if (count($name) >= 2) {

View file

@ -1,13 +1,17 @@
<?php <?php
class Controller_Request { class Controller_Request {
public $r;
public $id;
function __construct($request, $id) { function __construct($request, $id) {
$this->r = $request; $this->r = $request;
$this->id = $id; $this->id = $id;
} }
function get($name) { function get($name, $def = null) {
$v = $this->r->get($name); $v = $this->r->get($name);
$id = $this->id;
if ($id && is_array($v)) { if ($id && is_array($v)) {
return isset($v[$id]) ? $v[$id] : $def; return isset($v[$id]) ? $v[$id] : $def;
} }

View file

@ -5,7 +5,7 @@ require_once "Database/PDOStatement.php";
/** /**
* Класс оболочка для PDO для замены Creole * Класс оболочка для PDO для замены Creole
*/ */
class Database extends PDO class Database/*<Database_PDOStatement>*/ extends PDO
{ {
public $dsn; public $dsn;
@ -37,7 +37,7 @@ class Database extends PDO
if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') { if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') {
$port = (isset($dsn['port'])) ? "port={$dsn['port']};" : ""; $port = (isset($dsn['port'])) ? "port={$dsn['port']};" : "";
/*.Database.*/$connection = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']); $connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
if ($dsn['phptype'] == 'pgsql') { if ($dsn['phptype'] == 'pgsql') {
$connection->query('SET client_encoding="UTF-8"'); $connection->query('SET client_encoding="UTF-8"');
} }
@ -47,7 +47,7 @@ class Database extends PDO
} }
} }
if ($dsn['phptype'] == 'sqlite') { if ($dsn['phptype'] == 'sqlite') {
/*.Database.*/$connection = new static("{$dsn['phptype']}:{$dsn['database']}"); $connection/*: Database*/ = new static("{$dsn['phptype']}:{$dsn['database']}");
$connection->setAttribute(PDO::ATTR_TIMEOUT, 5); $connection->setAttribute(PDO::ATTR_TIMEOUT, 5);
$mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL'; $mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL';
$connection->query("PRAGMA journal_mode=$mode"); $connection->query("PRAGMA journal_mode=$mode");
@ -65,7 +65,7 @@ class Database extends PDO
public function executeQuery($query, $values=null) public function executeQuery($query, $values=null)
{ {
/*.Database_PDOStatement.*/$stmt = $this->prepare($query); $stmt/*: Database_PDOStatement*/ = $this->prepare($query);
$stmt->execute($values); $stmt->execute($values);
$stmt->cache = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->cache = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -83,7 +83,7 @@ class Database extends PDO
*/ */
public function fetchAllArray($query, $values = null) public function fetchAllArray($query, $values = null)
{ {
/*.Database_PDOStatement.*/$sth = $this->prepare($query); $sth/*: Database_PDOStatement*/ = $this->prepare($query);
$prep = $this->prepareValues($values); $prep = $this->prepareValues($values);
$sth->execute($prep); $sth->execute($prep);
return $sth->fetchAll(PDO::FETCH_ASSOC); return $sth->fetchAll(PDO::FETCH_ASSOC);
@ -94,7 +94,7 @@ class Database extends PDO
*/ */
public function fetchOneArray($query, $values = null) public function fetchOneArray($query, $values = null)
{ {
/*.Database_PDOStatement.*/$sth = $this->prepare($query); $sth/*: Database_PDOStatement*/ = $this->prepare($query);
$prep = $this->prepareValues($values); $prep = $this->prepareValues($values);
$sth->execute($prep); $sth->execute($prep);
return $sth->fetch(PDO::FETCH_ASSOC); return $sth->fetch(PDO::FETCH_ASSOC);

View file

@ -40,7 +40,7 @@ class Database_JsonInstall {
} }
//Создать таблицы //Создать таблицы
function initDataBase(/*.array.*/$initActions, $dbinit_path) { function initDataBase($initActions/*: array*/, $dbinit_path) {
$pg = $this->db_manager->db->isPostgres(); $pg = $this->db_manager->db->isPostgres();
if (!$pg) { if (!$pg) {
$refs = []; $refs = [];

View file

@ -2,13 +2,13 @@
class Database_Manager class Database_Manager
{ {
public /*.Database.*/$db; public $db/*: Database*/;
function __construct(Database $db) { function __construct(Database $db) {
$this->db = $db; $this->db = $db;
} }
public function ExecuteAction(/*.array.*/$action, $db_file = "") { public function ExecuteAction($action/*: array*/, $db_file = "") {
switch($action["type"]) { switch($action["type"]) {
case "dropTable": case "dropTable":
$this->DropTableQuery($action["table_name"], true); $this->DropTableQuery($action["table_name"], true);
@ -94,7 +94,7 @@ class Database_Manager
return; return;
} }
/*.array.*/$data = $this->DumpTable($table); $data/*: array*/ = $this->DumpTable($table);
$this->db->query("ALTER TABLE ".$table." RENAME TO ".$tmp_table.";"); $this->db->query("ALTER TABLE ".$table." RENAME TO ".$tmp_table.";");
$table_info[$new_name] = $table_info[$old_name]; $table_info[$new_name] = $table_info[$old_name];
@ -141,7 +141,7 @@ class Database_Manager
$this->db->query($q); $this->db->query($q);
} }
function getConstraintDef(/*.array.*/$c) { function getConstraintDef($c/*: array*/) {
if ($c['type'] == 'unique') { if ($c['type'] == 'unique') {
return "UNIQUE(" . implode(", ", $c['fields']) . ")"; return "UNIQUE(" . implode(", ", $c['fields']) . ")";
} }
@ -169,8 +169,8 @@ class Database_Manager
public function DumpTable($table_name) { public function DumpTable($table_name) {
$pg = $this->db->isPostgres(); $pg = $this->db->isPostgres();
/*.array.*/$result = array(); $result/*: array*/ = array();
/*.array.*/$data = $this->db->fetchAllArray("SELECT * FROM ".$table_name.";"); $data/*: array*/ = $this->db->fetchAllArray("SELECT * FROM ".$table_name.";");
if (!$pg) { if (!$pg) {
$table_fields = $this->TableInfo($table_name); $table_fields = $this->TableInfo($table_name);
@ -178,7 +178,7 @@ class Database_Manager
$type = strtolower($value['type']); $type = strtolower($value['type']);
if ($type == "boolean") { if ($type == "boolean") {
foreach ($data as &$row) { foreach ($data as &$row) {
/*.array.*/$row = $row; $row/*: array*/ = $row;
if (isset($row[$name])) { if (isset($row[$name])) {
$row[$name] = boolval($row[$name]); $row[$name] = boolval($row[$name]);
} }

View file

@ -66,7 +66,7 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate
} }
function getInt($name) { function getInt($name) {
return intval($this->fields[$name]); return (int)$this->fields[$name];
} }
function getBlob($name) { function getBlob($name) {

View file

@ -12,7 +12,7 @@ class Database_Statement
protected $conn; protected $conn;
protected $query; protected $query;
function __construct($query, /*.Database.*/ $conn) { function __construct($query, $conn/*: Database*/) {
$this->query = $query; $this->query = $query;
$this->conn = $conn; $this->conn = $conn;
} }
@ -41,7 +41,7 @@ class Database_Statement
if ($this->limit) { if ($this->limit) {
$this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}"; $this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}";
} }
/*.Database_PDOStatement.*/$stmt = $this->conn->prepare($this->query); $stmt/*: Database_PDOStatement*/ = $this->conn->prepare($this->query);
foreach ($this->binds as $bind) { foreach ($this->binds as $bind) {
list($n, $value, $type) = $bind; list($n, $value, $type) = $bind;
$stmt->bindValue($n, $value, (int) $type); $stmt->bindValue($n, $value, (int) $type);

View file

@ -8,7 +8,7 @@ class Database_StatementIterator implements Iterator
private $fetchmode; private $fetchmode;
private $row_count; private $row_count;
public function __construct(/*.Database_PDOStatement.*/ $rs) { public function __construct($rs/*: Database_PDOStatement*/) {
$this->result = $rs; $this->result = $rs;
$this->row_count = $rs->getRecordCount(); $this->row_count = $rs->getRecordCount();
} }

View file

@ -39,7 +39,7 @@ class Excel_Document {
if ($type == 'Borders') { if ($type == 'Borders') {
$doc->startElement('Borders'); $doc->startElement('Borders');
foreach ($s as $border) { foreach ($s as $border) {
/*.array.*/$border = $border; $border/*: array*/ = $border;
$doc->startElement('Border'); $doc->startElement('Border');
foreach ($border as $key => $value) { foreach ($border as $key => $value) {
$doc->writeAttribute('ss:' . $key, $value); $doc->writeAttribute('ss:' . $key, $value);

View file

@ -64,7 +64,7 @@ class Excel_Table
if(! isset($this->rows[$x])) { if(! isset($this->rows[$x])) {
$this->rows[$x] = new TableRow(); $this->rows[$x] = new TableRow();
} }
/*.TableRow.*/$row = $this->rows[$x]; $row/*: TableRow*/ = $this->rows[$x];
$row->setCell($y, $value); $row->setCell($y, $value);
} }
@ -118,7 +118,7 @@ class Excel_Table
assert(is_numeric($x) && $x > 0); assert(is_numeric($x) && $x > 0);
assert(is_numeric($cell) && $cell > 0); assert(is_numeric($cell) && $cell > 0);
/*.TableRow.*/$row = $this->rows[$x]; $row/*: TableRow*/ = $this->rows[$x];
$row->cells[$cell]->merge = $merge; $row->cells[$cell]->merge = $merge;
} }
@ -153,7 +153,7 @@ class Excel_Table
*/ */
function getRows() function getRows()
{ {
/*.array.*/$keys = array_keys($this->rows); $keys/*: array*/ = array_keys($this->rows);
return max($keys); return max($keys);
} }
@ -164,7 +164,7 @@ class Excel_Table
*/ */
function getRowCells(TableRow $row) function getRowCells(TableRow $row)
{ {
/*.array.*/$keys = array_keys($row->cells); $keys/*: array*/ = array_keys($row->cells);
return max($keys); return max($keys);
} }
@ -202,7 +202,7 @@ class Excel_Table
/** /**
* Генерация клетки таблицы (Переработать) * Генерация клетки таблицы (Переработать)
*/ */
function createCell (TableCell $ncell, XMLWriter $doc, $j, /*.any.*/$value, $setIndex) { function createCell (TableCell $ncell, XMLWriter $doc, $j, $value/*: any*/, $setIndex) {
$doc->startElement("Cell"); $doc->startElement("Cell");
if ($ncell->style) { if ($ncell->style) {
@ -262,7 +262,7 @@ class Excel_Table
$doc->writeAttribute('ss:Height', $this->rows[$i]->height); $doc->writeAttribute('ss:Height', $this->rows[$i]->height);
} }
/*.TableRow.*/$nrow = $this->rows[$i]; $nrow/*: TableRow*/ = $this->rows[$i];
// Флаг индикатор подстановки номера столбца // Флаг индикатор подстановки номера столбца
$setIndex = false; $setIndex = false;
for ($j = 1; $j <= $columns; $j++) { for ($j = 1; $j <= $columns; $j++) {

View file

@ -8,7 +8,7 @@ class Filter_ActionAccess
public $access = array(); public $access = array();
public $processor; public $processor;
function __construct(/*.Filter_Filter.*/$processor) { function __construct($processor/*: Filter_Filter*/) {
$this->processor = $processor; $this->processor = $processor;
} }

View file

@ -7,7 +7,7 @@ class Filter_ActionLogger
public $action; public $action;
public $processor; public $processor;
function __construct(/*.Filter_Filter.*/$processor) { function __construct($processor/*: Filter_Filter*/) {
$this->processor = $processor; $this->processor = $processor;
$this->file = fopen(Shortcut::getUrl('access.log'), "a"); $this->file = fopen(Shortcut::getUrl('access.log'), "a");
} }

View file

@ -6,7 +6,7 @@
class Filter_Filter class Filter_Filter
{ {
public $processor; public $processor;
public function __construct(/*.Controller_Action.*/$processor) public function __construct($processor/*: Controller_Action*/)
{ {
$this->processor = $processor; $this->processor = $processor;
} }

View file

@ -38,7 +38,7 @@ class Form_Field
} }
} }
function setValue(/*.any.*/$value) function setValue($value/*: any*/)
{ {
$this->value = $value; $this->value = $value;
} }

View file

@ -256,7 +256,7 @@ class Functions {
return $result; return $result;
} }
static function _get($key, /*.any.*/$value, /*.array.*/$array) { static function _get($key, $value/*: any*/, $array/*: array*/) {
foreach ($array as $item) { foreach ($array as $item) {
if ($item[$key] == $value) return $item; if ($item[$key] == $value) return $item;
} }
@ -368,7 +368,7 @@ class Functions {
* Преобразует ключи элементов для многомерного массива * Преобразует ключи элементов для многомерного массива
* @return mixed * @return mixed
*/ */
static function hash_key ($key_name,/*. array .*/ $array) { static function hash_key ($key_name,$array/*: array*/) {
$result = array(); $result = array();
foreach($array as $value) { foreach($array as $value) {

View file

@ -55,7 +55,7 @@ class HttpRequest extends Collection implements ArrayAccess
return $this->_session; return $this->_session;
} }
function set($key, /*.any.*/$value) function set($key, $value/*: any*/)
{ {
return parent::get('data')->set($key, $value); return parent::get('data')->set($key, $value);
} }

View file

@ -48,7 +48,7 @@ class MailAlt
/** /**
* Тема письма * Тема письма
*/ */
function subject(/*.string.*/$subject) function subject($subject/*: string*/)
{ {
$this->mailer->Subject = $subject; $this->mailer->Subject = $subject;
} }

View file

@ -7,7 +7,7 @@ class Model_Factory
public $_registry; public $_registry;
public $_shortcut; public $_shortcut;
public function __construct (/*.Database.*/ $db, Settings $_registry = null) public function __construct ($db/*: Database*/, Settings $_registry = null)
{ {
$this->db = $db; $this->db = $db;
$this->_registry = $_registry; $this->_registry = $_registry;

View file

@ -158,7 +158,7 @@ class Path
} }
// Сравнение двух путей на равентство // Сравнение двух путей на равентство
public function equal(/*.Path.*/ $path) public function equal($path/*: Path*/)
{ {
if (count($this->path) == count($path->path)) { if (count($this->path) == count($path->path)) {
for ($i = 0; $i < count($this->path); $i++) { for ($i = 0; $i < count($this->path); $i++) {
@ -202,7 +202,7 @@ class Path
* *
* @return boolean * @return boolean
*/ */
public function isParent(/*.Path.*/ $path) public function isParent($path/*: Path*/)
{ {
if (isset($this->url['host']) && isset($path->url['host']) if (isset($this->url['host']) && isset($path->url['host'])
&& ($this->url['host'] != $path->url['host'])) return false; && ($this->url['host'] != $path->url['host'])) return false;

View file

@ -119,7 +119,7 @@ class Setup
return; return;
} }
/*.SimpleXMLElement.*/$item = $this->stack[count($this->stack) - 1]; $item/*: SimpleXMLElement*/ = $this->stack[count($this->stack) - 1];
$root = $item->children(); $root = $item->children();
foreach ($root as $node) foreach ($root as $node)
{ {
@ -196,7 +196,7 @@ class Setup
/** /**
* Выполнение Списка SQL команд * Выполнение Списка SQL команд
*/ */
function batchSQLZip(/*.Database.*/ $conn, $file) function batchSQLZip($conn/*: Database*/, $file)
{ {
$stmtList = Tools_SQLStatementExtractor::extract($this->zip->getFromName($file)); $stmtList = Tools_SQLStatementExtractor::extract($this->zip->getFromName($file));
foreach ($stmtList as $stmt) { foreach ($stmtList as $stmt) {
@ -204,7 +204,7 @@ class Setup
} }
} }
static function batchSQL(/*.Database.*/ $conn, $file) static function batchSQL($conn/*: Database*/, $file)
{ {
$stmtList = Tools_SQLStatementExtractor::extractFile($file); $stmtList = Tools_SQLStatementExtractor::extractFile($file);
foreach ($stmtList as $stmt) { foreach ($stmtList as $stmt) {

View file

@ -111,7 +111,7 @@ class Tools_SQLStatementExtractor {
if ($check === "" || $check === $string) { if ($check === "" || $check === $string) {
return true; return true;
} else { } else {
return (strpos($string, $check) === 0) ? true : false; return (strpos($string, $check) === 0);
} }
} }
@ -121,11 +121,11 @@ class Tools_SQLStatementExtractor {
* @param string $string The string to check in (haystack). * @param string $string The string to check in (haystack).
* @return boolean True if $string ends with $check, or they are equal, or $check is empty. * @return boolean True if $string ends with $check, or they are equal, or $check is empty.
*/ */
protected static function endsWith(/*.string.*/$check, $string) { protected static function endsWith($check/*: string*/, $string) {
if ($check === "" || $check === $string) { if ($check === "" || $check === $string) {
return true; return true;
} else { } else {
return (strpos(strrev($string), strrev($check)) === 0) ? true : false; return (strpos(strrev($string), strrev($check)) === 0);
} }
} }

View file

@ -26,7 +26,7 @@ class Tools_TemplateImage
'miriad' => 'MyriadPro-Cond.ttf', 'miriad' => 'MyriadPro-Cond.ttf',
'miriadbd' => 'MyriadPro-BoldCond.ttf' 'miriadbd' => 'MyriadPro-BoldCond.ttf'
); );
protected $src; protected $src;
protected $context = array(); protected $context = array();
@ -35,6 +35,8 @@ class Tools_TemplateImage
protected $image; protected $image;
protected $prepare = true; protected $prepare = true;
public $debug = false; public $debug = false;
public $filename;
public $resource;
function __construct ($template = false) function __construct ($template = false)
{ {
@ -116,7 +118,7 @@ class Tools_TemplateImage
return ""; return "";
} }
function imageText($text, $value) function imageText($text, $value/*: stdClass*/)
{ {
assert(is_string($text)); assert(is_string($text));

View file

@ -69,7 +69,7 @@ class Validator_Validator
} }
} }
public function addRule(/*.any.*/$rule) { public function addRule($rule/*: any*/) {
if (is_array($rule)) { if (is_array($rule)) {
$this->chain = array_merge($this->chain, $rule); $this->chain = array_merge($this->chain, $rule);
} else { } else {
@ -77,7 +77,7 @@ class Validator_Validator
} }
} }
public function skip(/*.Validator_Rule_Abstract.*/$rule, /*.Collection.*/$container) // -> Rule_Abstract public function skip($rule/*: Validator_Rule_Abstract*/, $container/*: Collection*/) // -> Rule_Abstract
{ {
if ($rule->skipEmpty()) { if ($rule->skipEmpty()) {
$data = $container->get($rule->field); $data = $container->get($rule->field);

View file

@ -31,7 +31,7 @@ class View_Pages
* @param $onpage int количество элем на странице * @param $onpage int количество элем на странице
* @return string * @return string
*/ */
static function getLimit(/*.number.*/$page, /*.number.*/$onpage) { static function getLimit($page/*: number*/, $onpage/*: number*/) {
if ($page <= 0) { $page = 1; } if ($page <= 0) { $page = 1; }
return "LIMIT $onpage OFFSET " . ($page - 1) * $onpage; return "LIMIT $onpage OFFSET " . ($page - 1) * $onpage;
} }

View file

@ -99,7 +99,7 @@ class View_Top extends View_Composite {
$init = array(); $init = array();
foreach($s->_section as $key => $item) { foreach($s->_section as $key => $item) {
/*.View_View.*/$ss = $item; $ss/*: View_View*/ = $item;
if ($ss->codeGenerator !== null) { if ($ss->codeGenerator !== null) {
// функцию которая вычисляет а не результат // функцию которая вычисляет а не результат
$part = call_user_func($ss->codeGenerator, $this, $key, $value); $part = call_user_func($ss->codeGenerator, $this, $key, $value);

View file

@ -1,6 +1,7 @@
<?php <?php
function loadConfig($filename) { function loadConfig($filename) {
$settings = null;
if (@include($filename)) { if (@include($filename)) {
return $settings; return $settings;
} }

View file

@ -46,7 +46,7 @@ function phptal_time ($e)
*/ */
function phptal_component ($expression) { function phptal_component ($expression) {
$begin = floatval(microtime(true)); $begin = floatval(microtime(true));
/*.Controller_Component.*/$component = null; $component/*: Controller_Component*/ = null;
if (class_exists("Controller_Site")) { //Если мы в CMS2 if (class_exists("Controller_Site")) { //Если мы в CMS2
$component = Controller_Site::loadComponent($expression); $component = Controller_Site::loadComponent($expression);