Skip to content

Commit

Permalink
Replace [] with array() to enhance compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamshory committed Nov 21, 2024
1 parent e27c8d9 commit 65cd28d
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/Database/PicoDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public function fetch($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue = n
throw new NullPointerException(self::DATABASE_NONECTION_IS_NULL);
}

$result = [];
$result = array();
$this->executeDebug($sql);
$stmt = $this->databaseConnection->prepare($sql);

Expand Down Expand Up @@ -703,7 +703,7 @@ public function fetchAll($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue
throw new NullPointerException(self::DATABASE_NONECTION_IS_NULL);
}

$result = [];
$result = array();
$this->executeDebug($sql);
$stmt = $this->databaseConnection->prepare($sql);

Expand Down
2 changes: 1 addition & 1 deletion src/Database/PicoDatabaseEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PicoDatabaseEntity
*
* @var PicoDatabase[]
*/
private $databases = [];
private $databases = array();

/**
* Default database connection
Expand Down
18 changes: 9 additions & 9 deletions src/Generator/PicoDatabaseDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ public function createAlterTableAddFromEntities($entities, $tableName = null, $d
$tableName = $this->getTableName($tableName, $tableInfo);
$database = $this->getDatabase($database, $entities);

$queryAlter = [];
$queryAlter = array();
$numberOfColumn = count($tableInfo->getColumns());

if (!empty($tableInfo->getColumns())) {
$dbColumnNames = [];
$dbColumnNames = array();
$rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
$createdColumns = [];
$createdColumns = array();
if (is_array($rows) && !empty($rows)) {
foreach ($rows as $row) {
$dbColumnNames[] = $row['Field'];
Expand Down Expand Up @@ -290,13 +290,13 @@ public function createAlterTableAddFromEntity($entity)
$tableName = $tableInfo->getTableName();
$database = $entity->currentDatabase();

$queryAlter = [];
$queryAlter = array();
$numberOfColumn = count($tableInfo->getColumns());

if (!empty($tableInfo->getColumns())) {
$dbColumnNames = [];
$dbColumnNames = array();
$rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
$createdColumns = [];
$createdColumns = array();
if (is_array($rows) && !empty($rows)) {
foreach ($rows as $row) {
$dbColumnNames[] = $row['Field'];
Expand Down Expand Up @@ -334,7 +334,7 @@ public function createAlterTableAddFromEntity($entity)
private function addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColumns)
{
$pk = $tableInfo->getPrimaryKeys();
$queries = [];
$queries = array();
if (isset($pk) && is_array($pk) && !empty($pk)) {
foreach ($pk as $primaryKey) {
if (in_array($primaryKey['name'], $createdColumns)) {
Expand All @@ -361,7 +361,7 @@ private function addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColu
*/
private function addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdColumns, $databaseType)
{
$queries = [];
$queries = array();
$aik = $this->getAutoIncrementKey($tableInfo);

foreach ($tableInfo->getColumns() as $entityColumn) {
Expand Down Expand Up @@ -399,7 +399,7 @@ private function addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdC
public function getAutoIncrementKey($tableInfo)
{
$autoIncrement = $tableInfo->getAutoIncrementKeys();
$autoIncrementKeys = [];
$autoIncrementKeys = array();

if (is_array($autoIncrement) && !empty($autoIncrement)) {
foreach ($autoIncrement as $col) {
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/PicoDtoGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function __construct($database, $baseDir, $tableName, $baseNamespaceDto,
protected function createProperty($typeMap, $columnName, $columnType)
{
$propertyName = PicoStringUtil::camelize($columnName);
$docs = [];
$docs = array();
$docStart = "\t/**";
$docEnd = "\t */";

Expand Down Expand Up @@ -247,7 +247,7 @@ public function generate()

$rows = PicoColumnGenerator::getColumnList($this->database, $picoTableName);

$attrs = [];
$attrs = array();
if (is_array($rows)) {
foreach ($rows as $row) {
$columnName = $row['Field'];
Expand Down
6 changes: 3 additions & 3 deletions src/Generator/PicoEntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function createProperty($typeMap, $row, $nonupdatables = null)
$description = $this->getPropertyName($columnName);
$type = $this->getDataType($typeMap, $columnType);

$docs = [];
$docs = array();
$docStart = "\t/**";
$docEnd = "\t */";

Expand All @@ -122,7 +122,7 @@ protected function createProperty($typeMap, $row, $nonupdatables = null)
$docs[] = "\t * @NotNull";
}

$attrs = [];
$attrs = array();
$attrs[] = "name=\"$columnName\"";
$attrs[] = "type=\"$columnType\"";
$length = $this->getDataLength($columnType);
Expand Down Expand Up @@ -267,7 +267,7 @@ public function generate($nonupdatables = null)

$rows = PicoColumnGenerator::getColumnList($this->database, $picoTableName);

$attrs = [];
$attrs = array();
if (is_array($rows)) {
foreach ($rows as $row) {
$prop = $this->createProperty($typeMap, $row, $nonupdatables);
Expand Down
6 changes: 3 additions & 3 deletions src/Geometry/Area.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Area
*
* @var float[]
*/
public $coords = [];
public $coords = array();

/**
* Hyperlink reference associated with the area.
Expand Down Expand Up @@ -125,7 +125,7 @@ public function coordsFromTriangle($object)
public function coordsFromPolygon($object)
{
$points = $object->getPoints();
$coords = [];
$coords = array();
foreach ($points as $point) {
$coords[] = $point->x;
$coords[] = $point->y;
Expand Down Expand Up @@ -167,7 +167,7 @@ public function getCoords($zoom = 1)
*/
public function getHTML()
{
$attrs = [];
$attrs = array();
$attrs[] = 'shape="' . $this->shape . '"';
$attrs[] = 'coords="' . implode(", ", $this->getCoords($this->zoom)) . '"';

Expand Down
2 changes: 1 addition & 1 deletion src/Geometry/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Map
*
* @var Area[]
*/
private $areas = [];
private $areas = array();

/**
* Constructor to initialize the Map with optional areas.
Expand Down
4 changes: 2 additions & 2 deletions src/Geometry/NodeAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class NodeAttribute
*
* @var string[]
*/
private $values = [];
private $values = array();

/**
* Constructor to initialize the NodeAttribute with values.
Expand All @@ -42,7 +42,7 @@ public function __construct($values)
*/
public function __toString()
{
$attributes = [];
$attributes = array();
if (isset($this->values) && is_array($this->values)) {
foreach ($this->values as $key => $value) {
$attributes[] = $key . '="' . htmlspecialchars($value) . '"';
Expand Down
4 changes: 2 additions & 2 deletions src/Geometry/Polygon.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Polygon
*
* @var Point[]
*/
private $points = [];
private $points = array();

/**
* Constructor to initialize the Polygon with an array of Points.
Expand Down Expand Up @@ -54,7 +54,7 @@ public function addPoint($point)
*/
public function clearPolygon()
{
$this->points = [];
$this->points = array();
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/MagicDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MagicDto extends stdClass // NOSONAR
*
* @var array
*/
private $_classParams = []; // NOSONAR
private $_classParams = array(); // NOSONAR

/**
* Data source.
Expand Down
2 changes: 1 addition & 1 deletion src/MagicObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ protected function executeNativeQuery()
$queryString = $nativeQueryUtil->extractQueryString($docComment);
$returnType = $nativeQueryUtil->extractReturnType($docComment, $callerClassName);

$params = [];
$params = array();

try {
// Apply query parameters (pagination, sorting, etc.)
Expand Down
2 changes: 1 addition & 1 deletion src/Pagination/PicoPagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function getOffset()
*/
public static function getPageUrl($page, $parameterName = 'page', $path = null)
{
$urls = [];
$urls = array();
$paths = explode("?", $_SERVER['REQUEST_URI']);
$path = $path === null ? trim($paths[0]) : $path;
$urls[] = $path;
Expand Down
2 changes: 1 addition & 1 deletion src/Request/PicoRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function getRequestBody()
public static function getRequestHeaders()
{
if (!function_exists('getallheaders')) {
$headers = [];
$headers = array();
foreach ($_SERVER as $name => $value) {
/* RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities. */
if (strtolower(substr($name, 0, 5)) == 'http_') {
Expand Down
2 changes: 1 addition & 1 deletion src/Util/ClassUtil/ExtendedReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ExtendedReflectionClass extends ReflectionClass {
*
* @var array
*/
protected $useStatements = [];
protected $useStatements = array();

/**
* Flag indicating whether use statements have been parsed.
Expand Down
12 changes: 6 additions & 6 deletions src/Util/Database/EntityUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function getPropertyColumn($entity)
return [];
}
$columns = $tableInfo->getColumns();
$propertyColumns = [];
$propertyColumns = array();
foreach($columns as $prop=>$column)
{
$propertyColumns[$prop] = $column['name'];
Expand All @@ -54,7 +54,7 @@ public static function getPropertyJoinColumn($entity)
return [];
}
$joinColumns = $tableInfo->getJoinColumns();
$propertyColumns = [];
$propertyColumns = array();
foreach($joinColumns as $prop=>$column)
{
$propertyColumns[$prop] = $column['name'];
Expand All @@ -71,7 +71,7 @@ public static function getPropertyJoinColumn($entity)
*/
public static function getEntityData($data, $map)
{
$newData = [];
$newData = array();
if(isset($data))
{
if(is_array($data))
Expand Down Expand Up @@ -99,7 +99,7 @@ public static function getEntityData($data, $map)
*/
private static function fromArray($data, $map)
{
$newData = [];
$newData = array();
foreach($map as $key=>$value)
{
if(isset($data[$value]))
Expand All @@ -119,7 +119,7 @@ private static function fromArray($data, $map)
*/
private static function fromStdClass($data, $map)
{
$newData = [];
$newData = array();
foreach($map as $key=>$value)
{
if(isset($data->{$value}))
Expand All @@ -139,7 +139,7 @@ private static function fromStdClass($data, $map)
*/
private static function fromMagicObject($data, $map)
{
$newData = [];
$newData = array();
foreach($map as $key=>$value)
{
$newData[$key] = $data->get($value);
Expand Down
4 changes: 2 additions & 2 deletions src/Util/Database/NativeQueryUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private function handleSingleClassReturnType($stmt, $returnType)
private function mapRowsToMagicObject($stmt)
{
$result = $stmt->fetchAll(PDO::FETCH_OBJ);
$objects = [];
$objects = array();

foreach ($result as $row) {
$objects[] = new MagicObject($row);
Expand All @@ -220,7 +220,7 @@ private function mapRowsToMagicObject($stmt)
private function mapRowsToClass($stmt, $className)
{
$result = $stmt->fetchAll(PDO::FETCH_OBJ);
$objects = [];
$objects = array();

foreach ($result as $row) {
$objects[] = new $className($row);
Expand Down
4 changes: 2 additions & 2 deletions src/Util/Database/PicoDatabaseUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function sortableFromParams($params)
*/
public static function valuesFromParams($params)
{
$ret = [];
$ret = array();
if(self::isArray($params))
{
foreach($params as $param)
Expand Down Expand Up @@ -366,7 +366,7 @@ public static function splitSql($sqlText)
});

// Initialize state variables
$queries = [];
$queries = array();
$currentQuery = '';
$isAppending = false;
$delimiter = ';';
Expand Down
Loading

0 comments on commit 65cd28d

Please sign in to comment.