Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set php 5.4 as minimum requirement #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.buildpath
.DS_Store
.idea
.php-cs-fixer.cache
.project
composer.lock
vendor
Expand Down
17 changes: 17 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new Finder())
->notPath('tests/Zend/Loader/_files/ParseError.php')
->in('.');

return (new Config())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'array_syntax' => ['syntax' => 'short'],
'modernize_types_casting' => true,
'logical_operators' => true,
]);
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"name": "zf1s/zf1",
"description": "Zend Framework 1 complete package, PHP 5.3-8.3 compatible. Please consider using individual zf1s/zend-* packages instead - see README.",
"description": "Zend Framework 1 complete package, PHP 5.4-8.3 compatible. Please consider using individual zf1s/zend-* packages instead - see README.",
"type": "library",
"keywords": [
"framework",
"zf1"
],
"homepage": "https://github.com/zf1s/zf1",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.3.3",
"php": ">=5.4",
"symfony/polyfill-php70": "^1.19"
},
"require-dev": {
Expand All @@ -22,7 +28,8 @@
"php-parallel-lint/php-parallel-lint": "1.3.0",
"staabm/annotate-pull-request-from-checkstyle": "1.5.0",
"zf1s/dbunit": "1.3.3",
"zf1s/phpunit": "3.7.43"
"zf1s/phpunit": "3.7.43",
"friendsofphp/php-cs-fixer": "^3.60"
},
"autoload": {
"psr-0": {
Expand Down
100 changes: 50 additions & 50 deletions packages/zend-acl/library/Zend/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Zend_Acl
*
* @var array
*/
protected $_resources = array();
protected $_resources = [];

/**
* @var Zend_Acl_Role_Interface
Expand All @@ -112,19 +112,19 @@ class Zend_Acl
*
* @var array
*/
protected $_rules = array(
'allResources' => array(
'allRoles' => array(
'allPrivileges' => array(
protected $_rules = [
'allResources' => [
'allRoles' => [
'allPrivileges' => [
'type' => self::TYPE_DENY,
'assert' => null
),
'byPrivilegeId' => array()
),
'byRoleId' => array()
),
'byResourceId' => array()
);
],
'byPrivilegeId' => []
],
'byRoleId' => []
],
'byResourceId' => []
];

/**
* Adds a Role having an identifier unique to the registry
Expand Down Expand Up @@ -315,11 +315,11 @@ public function addResource($resource, $parent = null)
$this->_resources[$resourceParentId]['children'][$resourceId] = $resource;
}

$this->_resources[$resourceId] = array(
$this->_resources[$resourceId] = [
'instance' => $resource,
'parent' => $resourceParent,
'children' => array()
);
'children' => []
];

return $this;
}
Expand Down Expand Up @@ -451,7 +451,7 @@ public function remove($resource)
throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e);
}

$resourcesRemoved = array($resourceId);
$resourcesRemoved = [$resourceId];
if (null !== ($resourceParent = $this->_resources[$resourceId]['parent'])) {
unset($this->_resources[$resourceParent->getResourceId()]['children'][$resourceId]);
}
Expand Down Expand Up @@ -484,7 +484,7 @@ public function removeAll()
unset($this->_rules['byResourceId'][$resourceId]);
}

$this->_resources = array();
$this->_resources = [];

return $this;
}
Expand Down Expand Up @@ -612,12 +612,12 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr

// ensure that all specified Roles exist; normalize input to array of Role objects or null
if (!is_array($roles)) {
$roles = array($roles);
$roles = [$roles];
} else if (0 === count($roles)) {
$roles = array(null);
$roles = [null];
}
$rolesTemp = $roles;
$roles = array();
$roles = [];
foreach ($rolesTemp as $role) {
if (null !== $role) {
$roles[] = $this->_getRoleRegistry()->get($role);
Expand All @@ -630,12 +630,12 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
// ensure that all specified Resources exist; normalize input to array of Resource objects or null
if ($resources !== null) {
if (!is_array($resources)) {
$resources = array($resources);
$resources = [$resources];
} else if (0 === count($resources)) {
$resources = array(null);
$resources = [null];
}
$resourcesTemp = $resources;
$resources = array();
$resources = [];
foreach ($resourcesTemp as $resource) {
if (null !== $resource) {
$resources[] = $this->get($resource);
Expand All @@ -645,7 +645,7 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
}
unset($resourcesTemp, $resource);
} else {
$allResources = array(); // this might be used later if resource iteration is required
$allResources = []; // this might be used later if resource iteration is required
foreach ($this->_resources as $rTarget) {
$allResources[] = $rTarget['instance'];
}
Expand All @@ -654,9 +654,9 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr

// normalize privileges to array
if (null === $privileges) {
$privileges = array();
$privileges = [];
} else if (!is_array($privileges)) {
$privileges = array($privileges);
$privileges = [$privileges];
}

switch ($operation) {
Expand All @@ -672,7 +672,7 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
$rules['allPrivileges']['type'] = $type;
$rules['allPrivileges']['assert'] = $assert;
if (!isset($rules['byPrivilegeId'])) {
$rules['byPrivilegeId'] = array();
$rules['byPrivilegeId'] = [];
}
} else {
foreach ($privileges as $privilege) {
Expand Down Expand Up @@ -712,13 +712,13 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
if (0 === count($privileges)) {
if (null === $resource && null === $role) {
if ($type === $rules['allPrivileges']['type']) {
$rules = array(
'allPrivileges' => array(
$rules = [
'allPrivileges' => [
'type' => self::TYPE_DENY,
'assert' => null
),
'byPrivilegeId' => array()
);
],
'byPrivilegeId' => []
];
}
continue;
}
Expand Down Expand Up @@ -747,21 +747,21 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr
* clean up all the rules for the global allResources, as well as the indivually
* set resources (per privilege as well)
*/
foreach (array_merge(array(null), $allResources) as $resource) {
foreach (array_merge([null], $allResources) as $resource) {
$rules =& $this->_getRules($resource, $role, true);
if (null === $rules) {
continue;
}
if (0 === count($privileges)) {
if (null === $role) {
if ($type === $rules['allPrivileges']['type']) {
$rules = array(
'allPrivileges' => array(
$rules = [
'allPrivileges' => [
'type' => self::TYPE_DENY,
'assert' => null
),
'byPrivilegeId' => array()
);
],
'byPrivilegeId' => []
];
}
continue;
}
Expand Down Expand Up @@ -921,10 +921,10 @@ protected function _getRoleRegistry()
*/
protected function _roleDFSAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null)
{
$dfs = array(
'visited' => array(),
'stack' => array()
);
$dfs = [
'visited' => [],
'stack' => []
];

if (null !== ($result = $this->_roleDFSVisitAllPrivileges($role, $resource, $dfs))) {
return $result;
Expand Down Expand Up @@ -1009,10 +1009,10 @@ protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_
throw new Zend_Acl_Exception('$privilege parameter may not be null');
}

$dfs = array(
'visited' => array(),
'stack' => array()
);
$dfs = [
'visited' => [],
'stack' => []
];

if (null !== ($result = $this->_roleDFSVisitOnePrivilege($role, $resource, $privilege, $dfs))) {
return $result;
Expand Down Expand Up @@ -1172,7 +1172,7 @@ protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend
if (!$create) {
return $nullRef;
}
$this->_rules['byResourceId'][$resourceId] = array();
$this->_rules['byResourceId'][$resourceId] = [];
}
$visitor =& $this->_rules['byResourceId'][$resourceId];
} while (false);
Expand All @@ -1184,7 +1184,7 @@ protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend
if (!$create) {
return $nullRef;
}
$visitor['allRoles']['byPrivilegeId'] = array();
$visitor['allRoles']['byPrivilegeId'] = [];
}
return $visitor['allRoles'];
}
Expand All @@ -1193,8 +1193,8 @@ protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend
if (!$create) {
return $nullRef;
}
$visitor['byRoleId'][$roleId]['byPrivilegeId'] = array();
$visitor['byRoleId'][$roleId]['allPrivileges'] = array('type' => null, 'assert' => null);
$visitor['byRoleId'][$roleId]['byPrivilegeId'] = [];
$visitor['byRoleId'][$roleId]['allPrivileges'] = ['type' => null, 'assert' => null];
}
return $visitor['byRoleId'][$roleId];
}
Expand Down
14 changes: 7 additions & 7 deletions packages/zend-acl/library/Zend/Acl/Role/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Zend_Acl_Role_Registry
*
* @var array
*/
protected $_roles = array();
protected $_roles = [];

/**
* Adds a Role having an identifier unique to the registry
Expand Down Expand Up @@ -72,11 +72,11 @@ public function add(Zend_Acl_Role_Interface $role, $parents = null)
throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry");
}

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

if (null !== $parents) {
if (!is_array($parents)) {
$parents = array($parents);
$parents = [$parents];
}
/**
* @see Zend_Acl_Role_Registry_Exception
Expand All @@ -98,11 +98,11 @@ public function add(Zend_Acl_Role_Interface $role, $parents = null)
}
}

$this->_roles[$roleId] = array(
$this->_roles[$roleId] = [
'instance' => $role,
'parents' => $roleParents,
'children' => array()
);
'children' => []
];

return $this;
}
Expand Down Expand Up @@ -258,7 +258,7 @@ public function remove($role)
*/
public function removeAll()
{
$this->_roles = array();
$this->_roles = [];

return $this;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/zend-amf/library/Zend/Amf/Adobe/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
*
* @var array
*/
protected $_users = array();
protected $_users = [];

/**
* Create auth adapter
Expand All @@ -79,8 +79,8 @@ public function __construct($rolefile)
foreach($xml->role as $role) {
$this->_acl->addRole(new Zend_Acl_Role((string)$role["id"]));
foreach($role->user as $user) {
$this->_users[(string)$user["name"]] = array("password" => (string)$user["password"],
"role" => (string)$role["id"]);
$this->_users[(string)$user["name"]] = ["password" => (string)$user["password"],
"role" => (string)$role["id"]];
}
}
}
Expand Down Expand Up @@ -116,15 +116,15 @@ public function authenticate()
if(!isset($this->_users[$this->_username])) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND,
null,
array('Username not found')
['Username not found']
);
}

$user = $this->_users[$this->_username];
if($user["password"] != $this->_password) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID,
null,
array('Authentication failed')
['Authentication failed']
);
}

Expand Down
Loading