diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a855f5f3..e52ad74d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,12 @@ name: main -on: push +on: + pull_request: + push: jobs: build: runs-on: ubuntu-latest strategy: - matrix: + matrix: php-versions: [7.2, 7.3, 7.4] steps: - uses: actions/checkout@v2 @@ -21,7 +23,7 @@ jobs: uses: actions/cache@v1 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: ${{ runner.os }}-composer- - name: composer install run: composer install --no-interaction --no-ansi --no-progress --no-suggest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e145986d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php - -php: - - '7.3' - -dist: bionic - -cache: - timeout: 604800 - directories: - - "$HOME/.composer/cache" - - "$HOME/assets" - -before_install: - - git config --global advice.detachedHead false - - if [ -n "$GITHUB_TOKEN" ]; then composer config github-oauth.github.com "$GITHUB_TOKEN"; fi - -install: - - pecl install --force psr - -before_script: - - travis_retry composer install --no-interaction --no-ansi --no-progress --no-suggest - -script: - - vendor/bin/psalm - - phpenv config-rm xdebug.ini || true - - vendor/bin/phpcs - -notifications: - email: false diff --git a/composer.json b/composer.json index bf3b684e..362d418f 100644 --- a/composer.json +++ b/composer.json @@ -13,13 +13,13 @@ "Eclipse", "autocomplete" ], - "homepage": "https://phalconphp.com", + "homepage": "https://phalconphp.io", "license": "BSD-3-Clause", "authors": [ { "name": "Phalcon Team", - "email": "team@phalconphp.com", - "homepage": "https://phalconphp.com/en/team" + "email": "team@phalconphp.io", + "homepage": "https://phalconphp.io/en/team" }, { "name": "Contributors", @@ -29,7 +29,7 @@ "support": { "issues": "https://github.com/phalcon/ide-stubs/issues", "source": "https://github.com/phalcon/ide-stubs", - "forum": "https://forum.phalconphp.com/" + "forum": "https://forum.phalconphp.io/" }, "require": { "php": ">=7.2.0" diff --git a/src/Phalcon/Assets/Asset/Js.php b/src/Phalcon/Assets/Asset/Js.php index 80c4b120..7de3a9e8 100644 --- a/src/Phalcon/Assets/Asset/Js.php +++ b/src/Phalcon/Assets/Asset/Js.php @@ -10,7 +10,7 @@ namespace Phalcon\Assets\Asset; /** - * Represents Javascript assets + * Represents JavaScript assets */ class Js extends \Phalcon\Assets\Asset { diff --git a/src/Phalcon/Assets/Collection.php b/src/Phalcon/Assets/Collection.php index e4fd9766..c202bc09 100644 --- a/src/Phalcon/Assets/Collection.php +++ b/src/Phalcon/Assets/Collection.php @@ -64,7 +64,7 @@ class Collection implements \Countable, \Iterator /** * @var int */ - protected $position; + protected $position = 0; /** * @var string @@ -270,7 +270,7 @@ public function addInlineCss(string $content, bool $filter = true, $attributes = } /** - * Adds an inline javascript to the collection + * Adds an inline JavaScript to the collection * * @param string $content * @param bool $filter @@ -282,7 +282,7 @@ public function addInlineJs(string $content, bool $filter = true, $attributes = } /** - * Adds a javascript asset to the collection + * Adds a JavaScript asset to the collection * * @param array $attributes * @param string $path diff --git a/src/Phalcon/Assets/Filters/Cssmin.php b/src/Phalcon/Assets/Filters/Cssmin.php index 8c2698e6..774e9cba 100644 --- a/src/Phalcon/Assets/Filters/Cssmin.php +++ b/src/Phalcon/Assets/Filters/Cssmin.php @@ -10,7 +10,7 @@ namespace Phalcon\Assets\Filters; /** - * Minify the css - removes comments removes newlines and line feeds keeping + * Minify the CSS - removes comments removes newlines and line feeds keeping * removes last semicolon from last property */ class Cssmin implements \Phalcon\Assets\FilterInterface diff --git a/src/Phalcon/Assets/Manager.php b/src/Phalcon/Assets/Manager.php index b84eb4e7..d372afa9 100644 --- a/src/Phalcon/Assets/Manager.php +++ b/src/Phalcon/Assets/Manager.php @@ -14,7 +14,7 @@ /** * Phalcon\Assets\Manager * - * Manages collections of CSS/Javascript assets + * Manages collections of CSS/JavaScript assets */ class Manager extends AbstractInjectionAware { @@ -78,7 +78,7 @@ public function addAssetByType(string $type, Asset $asset): Manager } /** - * Adds a Css asset to the 'css' collection + * Adds a CSS asset to the 'css' collection * * ```php * $assets->addCss("css/bootstrap.css"); @@ -119,7 +119,7 @@ public function addInlineCodeByType(string $type, Inline $code): Manager } /** - * Adds an inline Css to the 'css' collection + * Adds an inline CSS to the 'css' collection * * @param string $content * @param mixed $filter @@ -131,7 +131,7 @@ public function addInlineCss(string $content, $filter = true, $attributes = null } /** - * Adds an inline javascript to the 'js' collection + * Adds an inline JavaScript to the 'js' collection * * @param string $content * @param mixed $filter @@ -143,7 +143,7 @@ public function addInlineJs(string $content, $filter = true, $attributes = null) } /** - * Adds a javascript asset to the 'js' collection + * Adds a JavaScript asset to the 'js' collection * * ```php * $assets->addJs("scripts/jquery.js"); diff --git a/src/Phalcon/Db/Adapter/AbstractAdapter.php b/src/Phalcon/Db/Adapter/AbstractAdapter.php index c91fc8c6..1935ad58 100644 --- a/src/Phalcon/Db/Adapter/AbstractAdapter.php +++ b/src/Phalcon/Db/Adapter/AbstractAdapter.php @@ -421,7 +421,7 @@ public function fetchAll(string $sqlQuery, int $fetchMode = Enum::FETCH_ASSOC, $ * * // Getting name of last edited robot * $robot = $connection->fetchColumn( - * "SELECT id, name FROM robots order by modified desc", + * "SELECT id, name FROM robots ORDER BY modified DESC", * 1 * ); * print_r($robot); diff --git a/src/Phalcon/Db/Adapter/AdapterInterface.php b/src/Phalcon/Db/Adapter/AdapterInterface.php index 9cf09489..7b1ec4b9 100644 --- a/src/Phalcon/Db/Adapter/AdapterInterface.php +++ b/src/Phalcon/Db/Adapter/AdapterInterface.php @@ -267,12 +267,12 @@ public function fetchAll(string $sqlQuery, int $fetchMode = 2, $placeholders = n * * ```php * // Getting count of robots - * $robotsCount = $connection->fetchColumn("SELECT count() FROM robots"); + * $robotsCount = $connection->fetchColumn("SELECT COUNT() FROM robots"); * print_r($robotsCount); * * // Getting name of last edited robot * $robot = $connection->fetchColumn( - * "SELECT id, name FROM robots order by modified desc", + * "SELECT id, name FROM robots ORDER BY modified DESC", * 1 * ); * print_r($robot); diff --git a/src/Phalcon/Db/Adapter/Pdo/Mysql.php b/src/Phalcon/Db/Adapter/Pdo/Mysql.php index 04d16231..107f51ad 100644 --- a/src/Phalcon/Db/Adapter/Pdo/Mysql.php +++ b/src/Phalcon/Db/Adapter/Pdo/Mysql.php @@ -10,7 +10,7 @@ namespace Phalcon\Db\Adapter\Pdo; /** - * Specific functions for the Mysql database system + * Specific functions for the MySQL database system * * ```php * use Phalcon\Db\Adapter\Pdo\Mysql; diff --git a/src/Phalcon/Db/Adapter/Pdo/Postgresql.php b/src/Phalcon/Db/Adapter/Pdo/Postgresql.php index 2d581d59..930be65a 100644 --- a/src/Phalcon/Db/Adapter/Pdo/Postgresql.php +++ b/src/Phalcon/Db/Adapter/Pdo/Postgresql.php @@ -12,7 +12,7 @@ use Phalcon\Db\RawValue; /** - * Specific functions for the Postgresql database system + * Specific functions for the PostgreSQL database system * * ```php * use Phalcon\Db\Adapter\Pdo\Postgresql; diff --git a/src/Phalcon/Db/Adapter/Pdo/Sqlite.php b/src/Phalcon/Db/Adapter/Pdo/Sqlite.php index 7bb69a4c..641b9b35 100644 --- a/src/Phalcon/Db/Adapter/Pdo/Sqlite.php +++ b/src/Phalcon/Db/Adapter/Pdo/Sqlite.php @@ -12,7 +12,7 @@ use Phalcon\Db\RawValue; /** - * Specific functions for the Sqlite database system + * Specific functions for the SQLite database system * * ```php * use Phalcon\Db\Adapter\Pdo\Sqlite; diff --git a/src/Phalcon/Db/Column.php b/src/Phalcon/Db/Column.php index bfadbc3e..956a644c 100644 --- a/src/Phalcon/Db/Column.php +++ b/src/Phalcon/Db/Column.php @@ -250,9 +250,11 @@ class Column implements \Phalcon\Db\ColumnInterface /** * Column not nullable? * + * Default SQL definition is NOT NULL. + * * @var bool */ - protected $notNull = false; + protected $notNull = true; /** * Column is part of the primary key? diff --git a/src/Phalcon/Debug.php b/src/Phalcon/Debug.php index 2e18f6c4..8b83c432 100644 --- a/src/Phalcon/Debug.php +++ b/src/Phalcon/Debug.php @@ -74,7 +74,7 @@ public function debugVar($varz, string $key = null): Debug } /** - * Returns the css sources + * Returns the CSS sources * * @return string */ @@ -83,7 +83,7 @@ public function getCssSources(): string } /** - * Returns the javascript sources + * Returns the JavaScript sources * * @return string */ diff --git a/src/Phalcon/Escaper.php b/src/Phalcon/Escaper.php index 218cfa25..65be80dc 100644 --- a/src/Phalcon/Escaper.php +++ b/src/Phalcon/Escaper.php @@ -69,7 +69,7 @@ public function escapeCss(string $css): string } /** - * Escape javascript strings by replacing non-alphanumeric chars by their + * Escape JavaScript strings by replacing non-alphanumeric chars by their * hexadecimal escaped representation * * @param string $js diff --git a/src/Phalcon/Flash/AbstractFlash.php b/src/Phalcon/Flash/AbstractFlash.php index cb3086e4..d8f3b026 100644 --- a/src/Phalcon/Flash/AbstractFlash.php +++ b/src/Phalcon/Flash/AbstractFlash.php @@ -143,7 +143,7 @@ public function notice(string $message): string } /** - * Set the autoescape mode in generated html + * Set the autoescape mode in generated HTML * * @param bool $autoescape * @return FlashInterface diff --git a/src/Phalcon/Forms/Element/Check.php b/src/Phalcon/Forms/Element/Check.php index 252045d6..3a0a77d0 100644 --- a/src/Phalcon/Forms/Element/Check.php +++ b/src/Phalcon/Forms/Element/Check.php @@ -18,7 +18,7 @@ class Check extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Email.php b/src/Phalcon/Forms/Element/Email.php index d89895dd..dcd634f4 100644 --- a/src/Phalcon/Forms/Element/Email.php +++ b/src/Phalcon/Forms/Element/Email.php @@ -18,7 +18,7 @@ class Email extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/File.php b/src/Phalcon/Forms/Element/File.php index 7085a434..4210ffd3 100644 --- a/src/Phalcon/Forms/Element/File.php +++ b/src/Phalcon/Forms/Element/File.php @@ -16,7 +16,7 @@ class File extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Hidden.php b/src/Phalcon/Forms/Element/Hidden.php index faa70448..212274f9 100644 --- a/src/Phalcon/Forms/Element/Hidden.php +++ b/src/Phalcon/Forms/Element/Hidden.php @@ -18,7 +18,7 @@ class Hidden extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Numeric.php b/src/Phalcon/Forms/Element/Numeric.php index 384b8af1..e56db2af 100644 --- a/src/Phalcon/Forms/Element/Numeric.php +++ b/src/Phalcon/Forms/Element/Numeric.php @@ -18,7 +18,7 @@ class Numeric extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Password.php b/src/Phalcon/Forms/Element/Password.php index a914d3c0..5eea07c3 100644 --- a/src/Phalcon/Forms/Element/Password.php +++ b/src/Phalcon/Forms/Element/Password.php @@ -18,7 +18,7 @@ class Password extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Radio.php b/src/Phalcon/Forms/Element/Radio.php index c3ce28db..a91609ba 100644 --- a/src/Phalcon/Forms/Element/Radio.php +++ b/src/Phalcon/Forms/Element/Radio.php @@ -18,7 +18,7 @@ class Radio extends \Phalcon\Forms\Element\AbstractElement { /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Forms/Element/Select.php b/src/Phalcon/Forms/Element/Select.php index 7796f076..a5f3c15b 100644 --- a/src/Phalcon/Forms/Element/Select.php +++ b/src/Phalcon/Forms/Element/Select.php @@ -51,7 +51,7 @@ public function getOptions() } /** - * Renders the element widget returning html + * Renders the element widget returning HTML * * @param array $attributes * @return string diff --git a/src/Phalcon/Html/Helper/AbstractHelper.php b/src/Phalcon/Html/Helper/AbstractHelper.php index 8e02f3e8..b02f1a4c 100644 --- a/src/Phalcon/Html/Helper/AbstractHelper.php +++ b/src/Phalcon/Html/Helper/AbstractHelper.php @@ -14,7 +14,7 @@ /** * Phalcon\Html\Helper\AbstractHelper * - * Abstract class for all html helpers + * Abstract class for all HTML helpers */ abstract class AbstractHelper { diff --git a/src/Phalcon/Mvc/Model.php b/src/Phalcon/Mvc/Model.php index dab6d99f..921dffbd 100644 --- a/src/Phalcon/Mvc/Model.php +++ b/src/Phalcon/Mvc/Model.php @@ -663,7 +663,7 @@ public function dump(): array * $transaction2->rollback(); * ``` * - * @param arrray|string|int|null $parameters = [ + * @param array|string|int|null $parameters = [ * 'conditions' => '' * 'columns' => '', * 'bind' => [], @@ -752,7 +752,7 @@ public static function find($parameters = null): ResultsetInterface * ); * ``` * - * @param arrray|string|int|null $parameters = [ + * @param array|string|int|null $parameters = [ * 'conditions' => '' * 'columns' => '', * 'bind' => [], diff --git a/src/Phalcon/Mvc/Model/Criteria.php b/src/Phalcon/Mvc/Model/Criteria.php index 532ce0b7..53767d7e 100644 --- a/src/Phalcon/Mvc/Model/Criteria.php +++ b/src/Phalcon/Mvc/Model/Criteria.php @@ -48,40 +48,30 @@ class Criteria implements \Phalcon\Mvc\Model\CriteriaInterface, \Phalcon\Di\Inje /** - * Sets the DependencyInjector container + * Appends a condition to the current conditions using an AND operator * - * @param \Phalcon\Di\DiInterface $container - * @return void + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return CriteriaInterface */ - public function setDI(\Phalcon\Di\DiInterface $container) + public function andWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface { } /** - * Returns the DependencyInjector container + * Appends a BETWEEN condition to the current conditions * - * @return DiInterface - */ - public function getDI(): DiInterface - { - } - - /** - * Set a model on which the query will be executed + * ```php + * $criteria->betweenWhere("price", 100.25, 200.50); + * ``` * - * @param string $modelName + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum * @return CriteriaInterface */ - public function setModelName(string $modelName): CriteriaInterface - { - } - - /** - * Returns an internal model name on which the criteria will be applied - * - * @return string - */ - public function getModelName(): string + public function betweenWhere(string $expr, $minimum, $maximum): CriteriaInterface { } @@ -109,12 +99,13 @@ public function bindTypes(array $bindTypes): CriteriaInterface } /** - * Sets SELECT DISTINCT / SELECT ALL flag + * Sets the cache options in the criteria + * This method replaces all previously set cache options * - * @param mixed $distinct + * @param array $cache * @return CriteriaInterface */ - public function distinct($distinct): CriteriaInterface + public function cache(array $cache): CriteriaInterface { } @@ -138,226 +129,158 @@ public function columns($columns): CriteriaInterface } /** - * Adds an INNER join to the query - * - * ```php - * $criteria->join( - * Robots::class - * ); - * - * $criteria->join( - * Robots::class, - * "r.id = RobotsParts.robots_id" - * ); - * - * $criteria->join( - * Robots::class, - * "r.id = RobotsParts.robots_id", - * "r" - * ); - * - * $criteria->join( - * Robots::class, - * "r.id = RobotsParts.robots_id", - * "r", - * "LEFT" - * ); - * ``` + * Adds the conditions parameter to the criteria * - * @param string $model - * @param mixed $conditions - * @param mixed $alias - * @param mixed $type + * @param string $conditions * @return CriteriaInterface */ - public function join(string $model, $conditions = null, $alias = null, $type = null): CriteriaInterface + public function conditions(string $conditions): CriteriaInterface { } /** - * Adds an INNER join to the query + * Creates a query builder from criteria. * * ```php - * $criteria->innerJoin( - * Robots::class - * ); - * - * $criteria->innerJoin( - * Robots::class, - * "r.id = RobotsParts.robots_id" - * ); - * - * $criteria->innerJoin( - * Robots::class, - * "r.id = RobotsParts.robots_id", - * "r" - * ); + * $builder = Robots::query() + * ->where("type = :type:") + * ->bind(["type" => "mechanical"]) + * ->createBuilder(); * ``` * - * @param string $model - * @param mixed $conditions - * @param mixed $alias - * @return CriteriaInterface + * @return BuilderInterface */ - public function innerJoin(string $model, $conditions = null, $alias = null): CriteriaInterface + public function createBuilder(): BuilderInterface { } /** - * Adds a LEFT join to the query - * - * ```php - * $criteria->leftJoin( - * Robots::class, - * "r.id = RobotsParts.robots_id", - * "r" - * ); - * ``` + * Sets SELECT DISTINCT / SELECT ALL flag * - * @param string $model - * @param mixed $conditions - * @param mixed $alias + * @param mixed $distinct * @return CriteriaInterface */ - public function leftJoin(string $model, $conditions = null, $alias = null): CriteriaInterface + public function distinct($distinct): CriteriaInterface { } /** - * Adds a RIGHT join to the query - * - * ```php - * $criteria->rightJoin( - * Robots::class, - * "r.id = RobotsParts.robots_id", - * "r" - * ); - * ``` + * Executes a find using the parameters built with the criteria * - * @param string $model - * @param mixed $conditions - * @param mixed $alias - * @return CriteriaInterface + * @return ResultsetInterface */ - public function rightJoin(string $model, $conditions = null, $alias = null): CriteriaInterface + public function execute(): ResultsetInterface { } /** - * Sets the conditions parameter in the criteria + * Adds the "for_update" parameter to the criteria * - * @param string $conditions - * @param mixed $bindParams - * @param mixed $bindTypes + * @param bool $forUpdate * @return CriteriaInterface */ - public function where(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface + public function forUpdate(bool $forUpdate = true): CriteriaInterface { } /** - * Appends a condition to the current conditions using an AND operator + * Builds a Phalcon\Mvc\Model\Criteria based on an input array like $_POST * - * @param string $conditions - * @param mixed $bindParams - * @param mixed $bindTypes + * @param \Phalcon\Di\DiInterface $container + * @param string $modelName + * @param array $data + * @param string $operator * @return CriteriaInterface */ - public function andWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface + public static function fromInput(\Phalcon\Di\DiInterface $container, string $modelName, array $data, string $operator = 'AND'): CriteriaInterface { } /** - * Appends a condition to the current conditions using an OR operator + * Returns the columns to be queried * - * @param string $conditions - * @param mixed $bindParams - * @param mixed $bindTypes - * @return CriteriaInterface + * @return string|null */ - public function orWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface + public function getColumns(): ?string { } /** - * Appends a BETWEEN condition to the current conditions - * - * ```php - * $criteria->betweenWhere("price", 100.25, 200.50); - * ``` + * Returns the conditions parameter in the criteria * - * @param string $expr - * @param mixed $minimum - * @param mixed $maximum - * @return CriteriaInterface + * @return string|null */ - public function betweenWhere(string $expr, $minimum, $maximum): CriteriaInterface + public function getConditions(): ?string { } /** - * Appends a NOT BETWEEN condition to the current conditions - * - * ```php - * $criteria->notBetweenWhere("price", 100.25, 200.50); - * ``` + * Returns the DependencyInjector container * - * @param string $expr - * @param mixed $minimum - * @param mixed $maximum - * @return CriteriaInterface + * @return DiInterface */ - public function notBetweenWhere(string $expr, $minimum, $maximum): CriteriaInterface + public function getDI(): DiInterface { } /** - * Appends an IN condition to the current conditions - * - * ```php - * $criteria->inWhere("id", [1, 2, 3]); - * ``` + * Returns the group clause in the criteria + */ + public function getGroupBy() + { + } + + /** + * Returns the having clause in the criteria + */ + public function getHaving() + { + } + + /** + * Returns the limit parameter in the criteria, which will be an integer if + * limit was set without an offset, an array with 'number' and 'offset' keys + * if an offset was set with the limit, or null if limit has not been set. * - * @param string $expr - * @param array $values - * @return CriteriaInterface + * @return string|null */ - public function inWhere(string $expr, array $values): CriteriaInterface + public function getLimit(): ?string { } /** - * Appends a NOT IN condition to the current conditions + * Returns an internal model name on which the criteria will be applied * - * ```php - * $criteria->notInWhere("id", [1, 2, 3]); - * ``` + * @return string + */ + public function getModelName(): string + { + } + + /** + * Returns the order clause in the criteria * - * @param string $expr - * @param array $values - * @return CriteriaInterface + * @return string|null */ - public function notInWhere(string $expr, array $values): CriteriaInterface + public function getOrderBy(): ?string { } /** - * Adds the conditions parameter to the criteria + * Returns all the parameters defined in the criteria * - * @param string $conditions - * @return CriteriaInterface + * @return array */ - public function conditions(string $conditions): CriteriaInterface + public function getParams(): array { } /** - * Adds the order-by clause to the criteria + * Returns the conditions parameter in the criteria * - * @param string $orderColumns - * @return CriteriaInterface + * @return string|null */ - public function orderBy(string $orderColumns): CriteriaInterface + public function getWhere(): ?string { } @@ -382,158 +305,235 @@ public function having($having): CriteriaInterface } /** - * Adds the limit parameter to the criteria. + * Adds an INNER join to the query * * ```php - * $criteria->limit(100); - * $criteria->limit(100, 200); - * $criteria->limit("100", "200"); + * $criteria->innerJoin( + * Robots::class + * ); + * + * $criteria->innerJoin( + * Robots::class, + * "r.id = RobotsParts.robots_id" + * ); + * + * $criteria->innerJoin( + * Robots::class, + * "r.id = RobotsParts.robots_id", + * "r" + * ); * ``` * - * @param int $limit - * @param int $offset + * @param string $model + * @param mixed $conditions + * @param mixed $alias * @return CriteriaInterface */ - public function limit(int $limit, int $offset = 0): CriteriaInterface + public function innerJoin(string $model, $conditions = null, $alias = null): CriteriaInterface { } /** - * Adds the "for_update" parameter to the criteria + * Appends an IN condition to the current conditions * - * @param bool $forUpdate + * ```php + * $criteria->inWhere("id", [1, 2, 3]); + * ``` + * + * @param string $expr + * @param array $values * @return CriteriaInterface */ - public function forUpdate(bool $forUpdate = true): CriteriaInterface + public function inWhere(string $expr, array $values): CriteriaInterface { } /** - * Adds the "shared_lock" parameter to the criteria + * Adds an INNER join to the query * - * @param bool $sharedLock + * ```php + * $criteria->join( + * Robots::class + * ); + * + * $criteria->join( + * Robots::class, + * "r.id = RobotsParts.robots_id" + * ); + * + * $criteria->join( + * Robots::class, + * "r.id = RobotsParts.robots_id", + * "r" + * ); + * + * $criteria->join( + * Robots::class, + * "r.id = RobotsParts.robots_id", + * "r", + * "LEFT" + * ); + * ``` + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @param mixed $type * @return CriteriaInterface */ - public function sharedLock(bool $sharedLock = true): CriteriaInterface + public function join(string $model, $conditions = null, $alias = null, $type = null): CriteriaInterface { } /** - * Sets the cache options in the criteria - * This method replaces all previously set cache options + * Adds a LEFT join to the query * - * @param array $cache + * ```php + * $criteria->leftJoin( + * Robots::class, + * "r.id = RobotsParts.robots_id", + * "r" + * ); + * ``` + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias * @return CriteriaInterface */ - public function cache(array $cache): CriteriaInterface + public function leftJoin(string $model, $conditions = null, $alias = null): CriteriaInterface { } /** - * Returns the conditions parameter in the criteria + * Adds the limit parameter to the criteria. * - * @return string|null - */ - public function getWhere(): ?string - { - } - - /** - * Returns the columns to be queried + * ```php + * $criteria->limit(100); + * $criteria->limit(100, 200); + * $criteria->limit("100", "200"); + * ``` * - * @return string|null + * @param int $limit + * @param int $offset + * @return CriteriaInterface */ - public function getColumns(): ?string + public function limit(int $limit, int $offset = 0): CriteriaInterface { } /** - * Returns the conditions parameter in the criteria + * Appends a NOT BETWEEN condition to the current conditions * - * @return string|null + * ```php + * $criteria->notBetweenWhere("price", 100.25, 200.50); + * ``` + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return CriteriaInterface */ - public function getConditions(): ?string + public function notBetweenWhere(string $expr, $minimum, $maximum): CriteriaInterface { } /** - * Returns the limit parameter in the criteria, which will be an integer if - * limit was set without an offset, an array with 'number' and 'offset' keys - * if an offset was set with the limit, or null if limit has not been set. + * Appends a NOT IN condition to the current conditions * - * @return string|null + * ```php + * $criteria->notInWhere("id", [1, 2, 3]); + * ``` + * + * @param string $expr + * @param array $values + * @return CriteriaInterface */ - public function getLimit(): ?string + public function notInWhere(string $expr, array $values): CriteriaInterface { } /** - * Returns the order clause in the criteria + * Adds the order-by clause to the criteria * - * @return string|null + * @param string $orderColumns + * @return CriteriaInterface */ - public function getOrderBy(): ?string + public function orderBy(string $orderColumns): CriteriaInterface { } /** - * Returns the group clause in the criteria + * Appends a condition to the current conditions using an OR operator + * + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return CriteriaInterface */ - public function getGroupBy() + public function orWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface { } /** - * Returns the having clause in the criteria + * Adds a RIGHT join to the query + * + * ```php + * $criteria->rightJoin( + * Robots::class, + * "r.id = RobotsParts.robots_id", + * "r" + * ); + * ``` + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @return CriteriaInterface */ - public function getHaving() + public function rightJoin(string $model, $conditions = null, $alias = null): CriteriaInterface { } /** - * Returns all the parameters defined in the criteria + * Sets the DependencyInjector container * - * @return array + * @param \Phalcon\Di\DiInterface $container + * @return void */ - public function getParams(): array + public function setDI(\Phalcon\Di\DiInterface $container) { } /** - * Builds a Phalcon\Mvc\Model\Criteria based on an input array like $_POST + * Set a model on which the query will be executed * - * @param \Phalcon\Di\DiInterface $container * @param string $modelName - * @param array $data - * @param string $operator * @return CriteriaInterface */ - public static function fromInput(\Phalcon\Di\DiInterface $container, string $modelName, array $data, string $operator = 'AND'): CriteriaInterface + public function setModelName(string $modelName): CriteriaInterface { } /** - * Creates a query builder from criteria. - * - * ```php - * $builder = Robots::query() - * ->where("type = :type:") - * ->bind(["type" => "mechanical"]) - * ->createBuilder(); - * ``` + * Adds the "shared_lock" parameter to the criteria * - * @return BuilderInterface + * @param bool $sharedLock + * @return CriteriaInterface */ - public function createBuilder(): BuilderInterface + public function sharedLock(bool $sharedLock = true): CriteriaInterface { } /** - * Executes a find using the parameters built with the criteria + * Sets the conditions parameter in the criteria * - * @return ResultsetInterface + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return CriteriaInterface */ - public function execute(): ResultsetInterface + public function where(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface { } } diff --git a/src/Phalcon/Mvc/Model/Query/Builder.php b/src/Phalcon/Mvc/Model/Query/Builder.php index 6c919f58..101f74ae 100644 --- a/src/Phalcon/Mvc/Model/Query/Builder.php +++ b/src/Phalcon/Mvc/Model/Query/Builder.php @@ -88,7 +88,9 @@ class Builder implements \Phalcon\Mvc\Model\Query\BuilderInterface, \Phalcon\Di\ protected $limit; - + /** + * @var array|string + */ protected $models; diff --git a/src/Phalcon/Tag.php b/src/Phalcon/Tag.php index 986c9330..be8e8a3b 100644 --- a/src/Phalcon/Tag.php +++ b/src/Phalcon/Tag.php @@ -616,7 +616,7 @@ public static function selectStatic($parameters, $data = null): string } /** - * Set autoescape mode in generated html + * Set autoescape mode in generated HTML * * @param bool $autoescape * @return void diff --git a/src/Phalcon/Tag/Select.php b/src/Phalcon/Tag/Select.php index afc70182..5c2584ce 100644 --- a/src/Phalcon/Tag/Select.php +++ b/src/Phalcon/Tag/Select.php @@ -12,7 +12,7 @@ /** * Phalcon\Tag\Select * - * Generates a SELECT html tag using a static array of values or a + * Generates a SELECT HTML tag using a static array of values or a * Phalcon\Mvc\Model resultset */ abstract class Select diff --git a/src/Phalcon/Translate/Adapter/Gettext.php b/src/Phalcon/Translate/Adapter/Gettext.php index e536a0c1..16c33aca 100644 --- a/src/Phalcon/Translate/Adapter/Gettext.php +++ b/src/Phalcon/Translate/Adapter/Gettext.php @@ -193,7 +193,7 @@ public function setDomain($domain): string * // Set locale to Dutch * $gettext->setLocale(LC_ALL, "nl_NL"); * - * // Try different possible locale names for german + * // Try different possible locale names for German * $gettext->setLocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge"); * ``` * diff --git a/src/Phalcon/Validation/Validator/ExclusionIn.php b/src/Phalcon/Validation/Validator/ExclusionIn.php index 0ff1673c..8d6991d0 100644 --- a/src/Phalcon/Validation/Validator/ExclusionIn.php +++ b/src/Phalcon/Validation/Validator/ExclusionIn.php @@ -69,7 +69,7 @@ class ExclusionIn extends AbstractValidator * 'message' => '', * 'template' => '', * 'domain' => [], - * 'strct' => false, + * 'strict' => false, * 'allowEmpty' => false * ] */ diff --git a/src/Phalcon/Validation/Validator/File.php b/src/Phalcon/Validation/Validator/File.php index 94b54a6b..750903ee 100644 --- a/src/Phalcon/Validation/Validator/File.php +++ b/src/Phalcon/Validation/Validator/File.php @@ -25,7 +25,7 @@ * new FileValidator( * [ * "maxSize" => "2M", - * "messageSize" => ":field exceeds the max filesize (:size)", + * "messageSize" => ":field exceeds the max file size (:size)", * "allowedTypes" => [ * "image/jpeg", * "image/png", @@ -49,8 +49,8 @@ * "anotherFile" => "4M", * ], * "messageSize" => [ - * "file" => "file exceeds the max filesize 2M", - * "anotherFile" => "anotherFile exceeds the max filesize 4M", + * "file" => "file exceeds the max file size 2M", + * "anotherFile" => "anotherFile exceeds the max file size 4M", * "allowedTypes" => [ * "file" => [ * "image/jpeg", diff --git a/src/Phalcon/Validation/Validator/File/AbstractFile.php b/src/Phalcon/Validation/Validator/File/AbstractFile.php index 849cd591..8e824bf9 100644 --- a/src/Phalcon/Validation/Validator/File/AbstractFile.php +++ b/src/Phalcon/Validation/Validator/File/AbstractFile.php @@ -26,7 +26,7 @@ * new Size( * [ * "maxSize" => "2M", - * "messageSize" => ":field exceeds the max filesize (:size)", + * "messageSize" => ":field exceeds the max file size (:size)", * ] * ) * ); @@ -43,8 +43,8 @@ * "anotherFile" => "4M", * ], * "messageSize" => [ - * "file" => "file exceeds the max filesize 2M", - * "anotherFile" => "anotherFile exceeds the max filesize 4M", + * "file" => "file exceeds the max file size 2M", + * "anotherFile" => "anotherFile exceeds the max file size 4M", * ], * ] * ) @@ -59,7 +59,7 @@ abstract class AbstractFile extends AbstractValidator protected $messageFileEmpty = 'Field :field must not be empty'; /** - * File exceeed the file size setted in PHP configuration + * File exceeds the file size set in PHP configuration */ protected $messageIniSize = 'File :field exceeds the maximum file size'; @@ -86,14 +86,14 @@ public function setMessageFileEmpty($messageFileEmpty) } /** - * File exceeed the file size setted in PHP configuration + * File exceeds the file size set in PHP configuration */ public function getMessageIniSize() { } /** - * File exceeed the file size setted in PHP configuration + * File exceeds the file size set in PHP configuration * * @param mixed $messageIniSize */ diff --git a/src/Phalcon/Validation/Validator/File/Size/Equal.php b/src/Phalcon/Validation/Validator/File/Size/Equal.php index 8fad03de..1ac14551 100644 --- a/src/Phalcon/Validation/Validator/File/Size/Equal.php +++ b/src/Phalcon/Validation/Validator/File/Size/Equal.php @@ -26,7 +26,7 @@ * [ * "size" => "2M", * "included" => true, - * "message" => ":field exceeds the equal filesize (:size)", + * "message" => ":field exceeds the equal file size (:size)", * ] * ) * ); @@ -47,8 +47,8 @@ * "anotherFile" => true, * ], * "message" => [ - * "file" => "file does not have the right filesize", - * "anotherFile" => "anotherFile wrong filesize (4MB)", + * "file" => "file does not have the right file size", + * "anotherFile" => "anotherFile wrong file size (4MB)", * ], * ] * ) @@ -58,7 +58,7 @@ class Equal extends AbstractFile { - protected $template = 'File :field does not have the exact :size filesize'; + protected $template = 'File :field does not have the exact :size file size'; /** diff --git a/src/Phalcon/Validation/Validator/File/Size/Max.php b/src/Phalcon/Validation/Validator/File/Size/Max.php index 0ea7f76e..dc89c4a1 100644 --- a/src/Phalcon/Validation/Validator/File/Size/Max.php +++ b/src/Phalcon/Validation/Validator/File/Size/Max.php @@ -26,7 +26,7 @@ * [ * "size" => "2M", * "included" => true, - * "message" => ":field exceeds the max filesize (:size)", + * "message" => ":field exceeds the max file size (:size)", * ] * ) * ); @@ -47,8 +47,8 @@ * "anotherFile" => true, * ], * "message" => [ - * "file" => "file exceeds the max filesize 2M", - * "anotherFile" => "anotherFile exceeds the max filesize 4M", + * "file" => "file exceeds the max file size 2M", + * "anotherFile" => "anotherFile exceeds the max file size 4M", * ], * ] * ) diff --git a/src/Phalcon/Validation/Validator/File/Size/Min.php b/src/Phalcon/Validation/Validator/File/Size/Min.php index 69ea086a..2f63f5b5 100644 --- a/src/Phalcon/Validation/Validator/File/Size/Min.php +++ b/src/Phalcon/Validation/Validator/File/Size/Min.php @@ -26,7 +26,7 @@ * [ * "size" => "2M", * "included" => true, - * "message" => ":field exceeds the min filesize (:size)", + * "message" => ":field exceeds the min file size (:size)", * ] * ) * ); @@ -47,8 +47,8 @@ * "anotherFile" => true, * ], * "message" => [ - * "file" => "file exceeds the min filesize 2M", - * "anotherFile" => "anotherFile exceeds the min filesize 4M", + * "file" => "file exceeds the min file size 2M", + * "anotherFile" => "anotherFile exceeds the min file size 4M", * ], * ] * )