Skip to content

Commit

Permalink
Merge pull request Shardj#5 from gfaza/DTPORTAL-19264-static_analysis…
Browse files Browse the repository at this point in the history
…_php_74

Dtportal 19264 static analysis php 74
  • Loading branch information
mattcar authored Oct 26, 2020
2 parents ca426e1 + a2aca29 commit 88f590e
Show file tree
Hide file tree
Showing 2,225 changed files with 75,464 additions and 73,454 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ vendor/*
composer.lock
bin/dbunit
bin/phpunit
.php_cs.cache
14 changes: 14 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

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

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRules([
'array_syntax' => ['syntax' => 'long'],
'list_syntax' => ['syntax' => 'long'],
'modernize_types_casting' => true,
'logical_operators' => true,
]);
4 changes: 0 additions & 4 deletions ISSUE_TEMPLATE

This file was deleted.

4 changes: 0 additions & 4 deletions PULL_REQUEST_TEMPLATE

This file was deleted.

21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potentially future versions
# Post end of life changes for zf1 to allow compatibility with the latest PHP versions.

If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted.


## Installation

Installable through git clone or through
`composer require shardj/zf1-future` https://packagist.org/packages/shardj/zf1-future

Minimum PHP Version is 7.0


## Extras

Recently https://github.com/Shardj/zf1-extras-future has been created for those who need it.


## Known issues and solutions

* ``Bootstrap error: Unable to resolve plugin "useragent"; no corresponding plugin with that name``
See comments in: https://github.com/Shardj/zf1-future/issues/92
8 changes: 4 additions & 4 deletions bin/classmap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@
$libraryPath = getcwd();

// Setup autoloading
$loader = new Zend_Loader_StandardAutoloader(array('autoregister_zf' => true));
$loader = new Zend_Loader_StandardAutoloader(['autoregister_zf' => true]);
$loader->setFallbackAutoloader(true);
$loader->register();

$rules = array(
$rules = [
'help|h' => 'Get usage message',
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory',
'append|a' => 'Append to autoload file if it exists',
'overwrite|w' => 'Whether or not to overwrite existing autoload file',
'ignore|i-s' => 'Comma-separated namespaces to ignore',
);
];

try {
$opts = new Zend_Console_Getopt($rules);
Expand All @@ -78,7 +78,7 @@
exit(0);
}

$ignoreNamespaces = array();
$ignoreNamespaces = [];
if (isset($opts->i)) {
$ignoreNamespaces = explode(',', $opts->i);
}
Expand Down
4 changes: 2 additions & 2 deletions bin/zf.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ZF
/**
* @var array of messages
*/
protected $_messages = array();
protected $_messages = [];

/**
* @var string
Expand Down Expand Up @@ -585,7 +585,7 @@ protected function _runSetupMoreInfo()
protected function _runTool()
{

$configOptions = array();
$configOptions = [];
if (isset($this->_configFile) && $this->_configFile) {
$configOptions['configOptions']['configFilepath'] = $this->_configFile;
}
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shardj/zf1-future",
"description": "Zend Framework 1 PHP 7.2 and 7.3 compatible",
"description": "Zend Framework 1. The aim is to keep ZF1 working with the latest PHP versions",
"type": "library",
"keywords": [
"framework",
Expand All @@ -9,7 +9,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.2.11"
"php": ">=7.0"
},
"autoload": {
"psr-0": {
Expand All @@ -35,6 +35,6 @@
"exclude": ["/demos", "/documentation", "/tests"]
},
"replace": {
"zendframework/zendframework1": "1.*"
"zendframework/zendframework1": ">=1.12.20"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class DocumentController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_DocumentService_Adapter
Expand All @@ -55,9 +55,9 @@ public function showAction()
return;
}
$q = $this->_doc->select("*");
$this->view->data = $this->_doc->query($name, $q, array(
$this->view->data = $this->_doc->query($name, $q, [
Zend_Cloud_DocumentService_Adapter_SimpleDB::RETURN_DOCUMENTS => true
));
]);
}

public function createAction()
Expand Down Expand Up @@ -87,8 +87,8 @@ public function addDocumentAction()
if (!$id = $this->_getParam('id', false)) {
return;
}
$fields = array();
foreach ($this->_getParam('field', array()) as $field) {
$fields = [];
foreach ($this->_getParam('field', []) as $field) {
if (!$field["name"]) {
continue;
}
Expand All @@ -99,7 +99,7 @@ public function addDocumentAction()
}
$document = new Zend_Cloud_DocumentService_Document($id, $fields);
$this->_doc->insertDocument($name, $document);
return $this->_helper->redirector('show', null, null, array("collection" => $name));
return $this->_helper->redirector('show', null, null, ["collection" => $name]);
}

public function deleteDocumentAction()
Expand All @@ -115,6 +115,6 @@ public function deleteDocumentAction()
return;
}
$this->_doc->deleteDocument($name, $id);
return $this->_helper->redirector('show', null, null, array("collection" => $name));
return $this->_helper->redirector('show', null, null, ["collection" => $name]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class QueueController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_QueueService_Adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class StorageController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_StorageService_Adapter
Expand All @@ -52,10 +52,10 @@ public function getAction()
return $this->_helper->redirector('index');
}

$item = $this->_storage->fetchItem($name, array(
$item = $this->_storage->fetchItem($name, [
Zend_Cloud_StorageService_Adapter_S3::FETCH_STREAM => true,
Zend_Cloud_StorageService_Adapter_WindowsAzure::RETURN_TYPE => Zend_Cloud_StorageService_Adapter_WindowsAzure::RETURN_STREAM
));
]);

if (!$item) {
$this->getResponse()->setHttpResponseCode(404);
Expand Down Expand Up @@ -103,11 +103,11 @@ public function uploadAction()
$name = $upload->getFileName(null, false);
}

$this->_storage->storeItem($name, $fp, array(
Zend_Cloud_StorageService_Adapter_S3::METADATA => array("type" => $mime)
));
$this->_storage->storeItem($name, $fp, [
Zend_Cloud_StorageService_Adapter_S3::METADATA => ["type" => $mime]
]);
try {
$this->_storage->storeMetadata($name, array("type" => $mime));
$this->_storage->storeMetadata($name, ["type" => $mime]);
} catch(Zend_Cloud_OperationNotAvailableException $e) {
// ignore it
}
Expand Down
4 changes: 2 additions & 2 deletions demos/Zend/Cloud/cloudexp/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
set_include_path(implode(PATH_SEPARATOR, [
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
]));

/** Zend_Application */
require_once 'Zend/Application.php';
Expand Down
10 changes: 5 additions & 5 deletions demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

class Gdata_OAuth_Helper extends Zend_Oauth_Consumer {
// Google's default oauth parameters/constants.
private $_defaultOptions = array(
private $_defaultOptions = [
'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
'version' => '1.0',
'requestTokenUrl' => 'https://www.google.com/accounts/OAuthGetRequestToken',
'userAuthorizationUrl' => 'https://www.google.com/accounts/OAuthAuthorizeToken',
'accessTokenUrl' => 'https://www.google.com/accounts/OAuthGetAccessToken'
);
];

/**
* Create Gdata_OAuth_Helper object
Expand Down Expand Up @@ -70,7 +70,7 @@ public function fetchRequestToken($scope, $callback) {
$this->_defaultOptions['callbackUrl'] = $uri;
$this->_config->setCallbackUrl($uri);
if (!isset($_SESSION['ACCESS_TOKEN'])) {
return parent::getRequestToken(array('scope' => $scope));
return parent::getRequestToken(['scope' => $scope]);
}
return null;
}
Expand All @@ -85,9 +85,9 @@ public function fetchRequestToken($scope, $callback) {
* @return void
*/
public function authorizeRequestToken($domain=null) {
$params = array();
$params = [];
if ($domain != null) {
$params = array('hd' => $domain);
$params = ['hd' => $domain];
}
$this->redirect($params);
}
Expand Down
6 changes: 3 additions & 3 deletions demos/Zend/Gdata/3LeggedOAuth/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
// Application constants. Replace these values with your own.
$APP_NAME = 'google-ZendGData3LOSample-1.0';
$APP_URL = getAppURL();
$scopes = array(
$scopes = [
'https://docs.google.com/feeds/',
'http://spreadsheets.google.com/feeds/'
);
];

// Setup OAuth consumer. Thes values should be replaced with your registered
// app's consumer key/secret.
Expand Down Expand Up @@ -78,7 +78,7 @@
$spreadsheetFeed = $spreadsheetsService->getSpreadsheetFeed(
'http://spreadsheets.google.com/feeds/spreadsheets/private/full?max-results=100');

renderHTML($accessToken, array($docsFeed, $spreadsheetFeed));
renderHTML($accessToken, [$docsFeed, $spreadsheetFeed]);
} else {
renderHTML();
}
Expand Down
14 changes: 7 additions & 7 deletions demos/Zend/Gdata/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ function createEvent ($client, $title = 'Tennis with Beth',
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array($gc->newWhere($where));
$newEntry->where = [$gc->newWhere($where)];

$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';

$when = $gc->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$newEntry->when = array($when);
$newEntry->when = [$when];

$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
Expand Down Expand Up @@ -458,7 +458,7 @@ function createWebContentEvent ($client, $title = 'World Cup 2006',
$when = $gc->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
$newEntry->when = array($when);
$newEntry->when = [$when];

$wc = $gc->newWebContent();
$wc->url = $url;
Expand All @@ -472,7 +472,7 @@ function createWebContentEvent ($client, $title = 'World Cup 2006',
$wcLink->href = $icon;

$wcLink->webContent = $wc;
$newEntry->link = array($wcLink);
$newEntry->link = [$wcLink];

$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
Expand All @@ -496,7 +496,7 @@ function createRecurringEvent ($client, $title = 'Tennis with Beth',
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array($gc->newWhere($where));
$newEntry->where = [$gc->newWhere($where)];

$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';
Expand Down Expand Up @@ -590,7 +590,7 @@ function addExtendedProperty ($client, $eventId,
$gc = new Zend_Gdata_Calendar($client);
if ($event = getEvent($client, $eventId)) {
$extProp = $gc->newExtendedProperty($name, $value);
$extProps = array_merge($event->extendedProperty, array($extProp));
$extProps = array_merge($event->extendedProperty, [$extProp]);
$event->extendedProperty = $extProps;
$eventNew = $event->save();
return $eventNew;
Expand Down Expand Up @@ -618,7 +618,7 @@ function setReminder($client, $eventId, $minutes=15)
$reminder = $gc->newReminder();
$reminder->setMinutes($minutes);
$reminder->setMethod($method);
$when->reminders = array($reminder);
$when->reminders = [$reminder];
}
$eventNew = $event->save();
return $eventNew;
Expand Down
Loading

0 comments on commit 88f590e

Please sign in to comment.