Skip to content

Commit

Permalink
Sync with master (phalcon#912)
Browse files Browse the repository at this point in the history
* phalcon#875: Swiftmailer and Twig are no longer required

Moved Swiftmailer and Twig to the Composer "suggest"

* Add new validator: ArrayInclusionIn

* Fix unit test

* Fix unit test - last test method

* Support for the TIMESTAMPDIFF

* Add options to ReCaptcha Validator to make it work with v3.

* Fixed PHPCS issues

* fix(oracle): Added missing interface method sharedLock

* Moved opening brace to newline as suggested

Co-Authored-By: lubber-de <c64@lubber.de>

* Translate Adapter for multi-column csv (phalcon#890)

* [Translate] add an intl MessageFormatter interpolator (phalcon#892)

* Tidied up READMEs.

* Applied PSR2 to tests.

* Code standards.

* Tidied up Annotations.

* Tidied up codebase.
  • Loading branch information
ruudboon committed Aug 30, 2019
1 parent ce8aeaf commit d2d33a2
Show file tree
Hide file tree
Showing 28 changed files with 413 additions and 287 deletions.
6 changes: 2 additions & 4 deletions Library/Phalcon/Annotations/Extended/Adapter/Apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

namespace Phalcon\Annotations\Extended\Adapter;

use APCIterator;
use APCuIterator;
use Phalcon\Annotations\Exception;
use Phalcon\Annotations\Reflection;
use Phalcon\Annotations\Extended\AbstractAdapter;
Expand Down Expand Up @@ -145,7 +143,7 @@ public function flush()
$prefixPattern = '#^_PHAN' . preg_quote("{$this->prefix}", '#') . '#';

if (class_exists('\APCuIterator')) {
$iterator = new APCuIterator($prefixPattern);
$iterator = new \APCuIterator($prefixPattern);

foreach ($iterator as $item) {
apcu_delete(
Expand All @@ -156,7 +154,7 @@ public function flush()
return true;
}

$iterator = new APCIterator('user', $prefixPattern);
$iterator = new \APCIterator('user', $prefixPattern);

foreach ($iterator as $item) {
apc_delete(
Expand Down
3 changes: 1 addition & 2 deletions Library/Phalcon/Annotations/Extended/Adapter/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace Phalcon\Annotations\Extended\Adapter;

use DirectoryIterator;
use Phalcon\Annotations\Exception;
use Phalcon\Annotations\Reflection;
use Phalcon\Annotations\Extended\AbstractAdapter;
Expand Down Expand Up @@ -142,7 +141,7 @@ public function write($key, Reflection $reflection)
*/
public function flush()
{
$iterator = new DirectoryIterator($this->annotationsDir);
$iterator = new \DirectoryIterator($this->annotationsDir);

foreach ($iterator as $item) {
if ($item->isDot() || !$item->isFile() || $item->getExtension() !== 'php') {
Expand Down
57 changes: 26 additions & 31 deletions Library/Phalcon/Db/Dialect/Oracle.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Oracle extends Dialect
* @param string $sqlQuery
* @return string
*/
public function sharedLock(string $sqlQuery): string
public function sharedLock($sqlQuery)
{
return $sqlQuery . ' LOCK IN SHARE MODE';
}
Expand All @@ -71,7 +71,7 @@ public function sharedLock(string $sqlQuery): string
* @param mixed $number
* @return string
*/
public function limit(string $sqlQuery, $number):string
public function limit($sqlQuery, $number)
{
$offset = 0;

Expand Down Expand Up @@ -104,7 +104,7 @@ public function limit(string $sqlQuery, $number):string
*
* @throws Exception
*/
public function getColumnDefinition(ColumnInterface $column): string
public function getColumnDefinition(ColumnInterface $column)
{
$type = $column->getType();
$size = $column->getSize();
Expand Down Expand Up @@ -159,7 +159,7 @@ public function getColumnDefinition(ColumnInterface $column): string
*
* @throws Exception
*/
public function addColumn(string $tableName, string $schemaName, ColumnInterface $column): string
public function addColumn($tableName, $schemaName, ColumnInterface $column)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -175,7 +175,7 @@ public function addColumn(string $tableName, string $schemaName, ColumnInterface
*
* @throws Exception
*/
public function modifyColumn(string $tableName, string $schemaName, ColumnInterface $column, ColumnInterface $current = null): string
public function modifyColumn($tableName, $schemaName, ColumnInterface $column, ColumnInterface $current = null)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -190,7 +190,7 @@ public function modifyColumn(string $tableName, string $schemaName, ColumnInterf
*
* @throws Exception
*/
public function dropColumn(string $tableName, string $schemaName, string $columnName): string
public function dropColumn($tableName, $schemaName, $columnName)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -205,7 +205,7 @@ public function dropColumn(string $tableName, string $schemaName, string $column
*
* @throws Exception
*/
public function addIndex(string $tableName, string $schemaName, IndexInterface $index): string
public function addIndex($tableName, $schemaName, IndexInterface $index)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -220,7 +220,7 @@ public function addIndex(string $tableName, string $schemaName, IndexInterface $
*
* @throws Exception
*/
public function dropIndex(string $tableName, string $schemaName, string $indexName): string
public function dropIndex($tableName, $schemaName, $indexName)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -235,7 +235,7 @@ public function dropIndex(string $tableName, string $schemaName, string $indexNa
*
* @throws Exception
*/
public function addPrimaryKey(string $tableName, string $schemaName, IndexInterface $index): string
public function addPrimaryKey($tableName, $schemaName, IndexInterface $index)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -249,7 +249,7 @@ public function addPrimaryKey(string $tableName, string $schemaName, IndexInterf
*
* @throws Exception
*/
public function dropPrimaryKey(string $tableName, string $schemaName): string
public function dropPrimaryKey($tableName, $schemaName)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -264,7 +264,7 @@ public function dropPrimaryKey(string $tableName, string $schemaName): string
*
* @throws Exception
*/
public function addForeignKey(string $tableName, string $schemaName, ReferenceInterface $reference): string
public function addForeignKey($tableName, $schemaName, ReferenceInterface $reference)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -279,7 +279,7 @@ public function addForeignKey(string $tableName, string $schemaName, ReferenceIn
*
* @throws Exception
*/
public function dropForeignKey(string $tableName, string $schemaName, string $referenceName): string
public function dropForeignKey($tableName, $schemaName, $referenceName)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -294,7 +294,7 @@ public function dropForeignKey(string $tableName, string $schemaName, string $re
*
* @throws Exception
*/
public function createTable(string $tableName, string $schemaName, array $definition): string
public function createTable($tableName, $schemaName, array $definition)
{
throw new Exception('Not implemented yet.');
}
Expand All @@ -307,7 +307,7 @@ public function createTable(string $tableName, string $schemaName, array $defini
* @param bool $ifExists
* @return string
*/
public function dropTable(string $tableName, string $schemaName, $ifExists = true): string
public function dropTable($tableName, $schemaName, $ifExists = true)
{
$this->_escapeChar = '';

Expand Down Expand Up @@ -340,7 +340,7 @@ public function dropTable(string $tableName, string $schemaName, $ifExists = tru
* @param string $schemaName
* @return string
*/
public function listTables(string $schemaName = null): string
public function listTables($schemaName = null)
{
$baseQuery = /** @lang text */
"SELECT TABLE_NAME, OWNER FROM ALL_TABLES %s ORDER BY OWNER, TABLE_NAME";
Expand All @@ -366,7 +366,7 @@ public function listTables(string $schemaName = null): string
* @param string $schemaName
* @return string
*/
public function tableExists(string $tableName, string $schemaName = null): string
public function tableExists($tableName, $schemaName = null)
{

$oldEscapeChar=$this->_escapeChar;
Expand Down Expand Up @@ -398,7 +398,7 @@ public function tableExists(string $tableName, string $schemaName = null): strin
*
* @throws Exception
*/
public function createView(string $viewName, array $definition, string $schemaName = null): string
public function createView($viewName, array $definition, $schemaName = null)
{
if (!isset($definition['sql']) || empty($definition['sql'])) {
throw new Exception("The index 'sql' is required in the definition array");
Expand All @@ -415,7 +415,7 @@ public function createView(string $viewName, array $definition, string $schemaNa
* @param bool $ifExists
* @return string
*/
public function dropView(string $viewName, string $schemaName = null, $ifExists = true): string
public function dropView($viewName, $schemaName = null, $ifExists = true)
{
$this->_escapeChar = '';

Expand Down Expand Up @@ -446,7 +446,7 @@ public function dropView(string $viewName, string $schemaName = null, $ifExists
*
* @return string
*/
public function viewExists(string $viewName, string $schemaName = null): string
public function viewExists($viewName, $schemaName = null)
{
$view = $this->prepareTable($viewName, $schemaName);
$baseSql = sprintf(
Expand Down Expand Up @@ -491,7 +491,7 @@ public function listViews($schemaName = null)
* @param string $schema
* @return string
*/
public function describeColumns(string $table, string $schema = null): string
public function describeColumns($table, $schema = null)
{
$oldEscapeChar= $this->_escapeChar;
$this->_escapeChar = "'";
Expand Down Expand Up @@ -522,7 +522,7 @@ public function describeColumns(string $table, string $schema = null): string
* @param string $schema
* @return string
*/
public function describeIndexes(string $table, string $schema = null): string
public function describeIndexes($table, $schema = null)
{
$table = $this->escape($table);
$sql = 'SELECT I.TABLE_NAME, 0 AS C0, I.INDEX_NAME, IC.COLUMN_POSITION, IC.COLUMN_NAME ' .
Expand All @@ -538,12 +538,7 @@ public function describeIndexes(string $table, string $schema = null): string
return $sql;
}

/**
* @param string $table
* @param string|null $schema
* @return string
*/
public function describeReferences(string $table, string $schema = null): string
public function describeReferences($table, $schema = null)
{
$table = $this->escape($table);

Expand All @@ -569,7 +564,7 @@ public function describeReferences(string $table, string $schema = null): string
* @param string $schema
* @return string
*/
public function tableOptions(string $table, string $schema = null): string
public function tableOptions($table, $schema = null)
{
return '';
}
Expand All @@ -579,7 +574,7 @@ public function tableOptions(string $table, string $schema = null): string
*
* @return bool
*/
public function supportsSavepoints(): bool
public function supportsSavepoints()
{
return false;
}
Expand All @@ -589,7 +584,7 @@ public function supportsSavepoints(): bool
*
* @return bool
*/
public function supportsReleaseSavepoints(): bool
public function supportsReleaseSavepoints()
{
return false;
}
Expand All @@ -603,7 +598,7 @@ public function supportsReleaseSavepoints(): bool
* @param string $escapeChar
* @return string
*/
protected function prepareTable(string $table, string $schema = null, string $alias = null, string $escapeChar = null): string
protected function prepareTable($table, $schema = null, $alias = null, $escapeChar = null)
{
$table = $this->escape($table, $escapeChar);

Expand Down
3 changes: 1 addition & 2 deletions Library/Phalcon/Error/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

namespace Phalcon\Error;

use Exception;
use Phalcon\Di;
use Phalcon\DiInterface;
use Phalcon\Logger\Formatter;
Expand Down Expand Up @@ -77,7 +76,7 @@ function ($errno, $errstr, $errfile, $errline) {

set_exception_handler(
function ($e) {
/** @var Exception|\Error $e */
/** @var \Exception|\Error $e */
$options = [
'type' => $e->getCode(),
'message' => $e->getMessage(),
Expand Down
Loading

0 comments on commit d2d33a2

Please sign in to comment.