From 285dbc12c89110be5b4437e2813d90d500a85fd3 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 3 Jul 2012 15:34:19 -0500 Subject: [PATCH 1/8] [zen-66] Fix import - Import Translator class, not namespace --- src/Transfer/Adapter/AbstractAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transfer/Adapter/AbstractAdapter.php b/src/Transfer/Adapter/AbstractAdapter.php index 609d76d..8cc9bed 100644 --- a/src/Transfer/Adapter/AbstractAdapter.php +++ b/src/Transfer/Adapter/AbstractAdapter.php @@ -25,7 +25,7 @@ Zend\Filter, Zend\Filter\Exception as FilterException, Zend\Loader, - Zend\I18n\Translator, + Zend\I18n\Translator\Translator, Zend\Validator; /** From 7309b7d18fa763cb3c26f68e81ba744f0df03804 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Wed, 4 Jul 2012 08:10:00 +0200 Subject: [PATCH 2/8] Remove old stuff * Remove PHPTools (PHPNamespacer) * Remove zf1 mvc --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 21d57da..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "tools/phptools"] - path = tools/phptools - url = git://github.com/ralphschindler/PHPTools.git From d8f3cd35588949a688edd3f3bbc559e63475a115 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:19:42 +0200 Subject: [PATCH 3/8] [CS][Library] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Mon, 9 Jul 2012 16:34:21 +0200 Subject: [PATCH 4/8] [CS][test] Remove @copyright & @license for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@copyright/d' $fl.old > $fl; rm -f $fl.old; done; for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@license/d' $fl.old > $fl; rm -f $fl.old; done; --- test/ClassFileLocatorTest.php | 4 ---- test/TestAsset/LocatorShouldFindThis.php | 4 ---- test/Transfer/Adapter/AbstractAdapterTestMockAdapter.php | 4 ---- test/Transfer/Adapter/AbstractTest.php | 4 ---- test/Transfer/Adapter/HttpTest.php | 4 ---- test/Transfer/Adapter/HttpTestMockAdapter.php | 4 ---- 6 files changed, 24 deletions(-) diff --git a/test/ClassFileLocatorTest.php b/test/ClassFileLocatorTest.php index a73f80a..a60db85 100644 --- a/test/ClassFileLocatorTest.php +++ b/test/ClassFileLocatorTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\File; @@ -29,8 +27,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_File */ class ClassFileLocatorTest extends \PHPUnit_Framework_TestCase diff --git a/test/TestAsset/LocatorShouldFindThis.php b/test/TestAsset/LocatorShouldFindThis.php index 70de7ac..513637b 100644 --- a/test/TestAsset/LocatorShouldFindThis.php +++ b/test/TestAsset/LocatorShouldFindThis.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Loader * @subpackage Exception - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\File\TestAsset; @@ -24,8 +22,6 @@ /** * @package Zend_Loader * @subpackage Exception - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ interface LocatorShouldFindThis { diff --git a/test/Transfer/Adapter/AbstractAdapterTestMockAdapter.php b/test/Transfer/Adapter/AbstractAdapterTestMockAdapter.php index 58a3cd9..15d519f 100644 --- a/test/Transfer/Adapter/AbstractAdapterTestMockAdapter.php +++ b/test/Transfer/Adapter/AbstractAdapterTestMockAdapter.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\File\Transfer\Adapter; @@ -29,8 +27,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_File */ class AbstractAdapterTestMockAdapter extends Adapter\AbstractAdapter diff --git a/test/Transfer/Adapter/AbstractTest.php b/test/Transfer/Adapter/AbstractTest.php index 72febc2..92d023f 100644 --- a/test/Transfer/Adapter/AbstractTest.php +++ b/test/Transfer/Adapter/AbstractTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\File\Transfer\Adapter; @@ -34,8 +32,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_File */ class AbstractTest extends \PHPUnit_Framework_TestCase diff --git a/test/Transfer/Adapter/HttpTest.php b/test/Transfer/Adapter/HttpTest.php index bbb70b6..9c6c642 100644 --- a/test/Transfer/Adapter/HttpTest.php +++ b/test/Transfer/Adapter/HttpTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -34,8 +32,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_File */ class HttpTest extends \PHPUnit_Framework_TestCase diff --git a/test/Transfer/Adapter/HttpTestMockAdapter.php b/test/Transfer/Adapter/HttpTestMockAdapter.php index f1d27d9..585e418 100644 --- a/test/Transfer/Adapter/HttpTestMockAdapter.php +++ b/test/Transfer/Adapter/HttpTestMockAdapter.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\File\Transfer\Adapter; @@ -29,8 +27,6 @@ * @category Zend * @package Zend_File * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_File */ class HttpTestMockAdapter extends Adapter\Http From c4012dc035fe832a1ea3c13ec52ebfe3cb233305 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:41:27 +0200 Subject: [PATCH 5/8] [CS][Tests] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Mon, 9 Jul 2012 16:46:59 -0500 Subject: [PATCH 6/8] [zen-49] Correct import statements across framework - Ran a script that would create multiple import statements out of multi-line import statements, and which would sort all import statements in alphabetic order. Script is at https://gist.github.com/3079222 and was run by dropping into the library/Zend folder and typing (in zsh) "for file in **/*.php;do php /path/to/replace-uses.php $file; done" --- src/ClassFileLocator.php | 10 +++++----- src/Transfer/Adapter/AbstractAdapter.php | 14 +++++++------- src/Transfer/Adapter/Http.php | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ClassFileLocator.php b/src/ClassFileLocator.php index 2165d81..18e8f6b 100644 --- a/src/ClassFileLocator.php +++ b/src/ClassFileLocator.php @@ -11,11 +11,11 @@ namespace Zend\File; // import SPL classes/interfaces into local scope -use DirectoryIterator, - FilterIterator, - RecursiveIterator, - RecursiveDirectoryIterator, - RecursiveIteratorIterator; +use DirectoryIterator; +use FilterIterator; +use RecursiveDirectoryIterator; +use RecursiveIterator; +use RecursiveIteratorIterator; /** * Locate files containing PHP classes, interfaces, abstracts or traits diff --git a/src/Transfer/Adapter/AbstractAdapter.php b/src/Transfer/Adapter/AbstractAdapter.php index c8b2146..c5ebdcb 100644 --- a/src/Transfer/Adapter/AbstractAdapter.php +++ b/src/Transfer/Adapter/AbstractAdapter.php @@ -10,13 +10,13 @@ namespace Zend\File\Transfer\Adapter; -use Zend\File\Transfer, - Zend\File\Transfer\Exception, - Zend\Filter, - Zend\Filter\Exception as FilterException, - Zend\Loader, - Zend\I18n\Translator\Translator, - Zend\Validator; +use Zend\File\Transfer; +use Zend\File\Transfer\Exception; +use Zend\Filter; +use Zend\Filter\Exception as FilterException; +use Zend\I18n\Translator\Translator; +use Zend\Loader; +use Zend\Validator; /** * Abstract class for file transfers (Downloads and Uploads) diff --git a/src/Transfer/Adapter/Http.php b/src/Transfer/Adapter/Http.php index b96197f..1f6048b 100644 --- a/src/Transfer/Adapter/Http.php +++ b/src/Transfer/Adapter/Http.php @@ -10,10 +10,10 @@ namespace Zend\File\Transfer\Adapter; -use Zend\File\Transfer, - Zend\File\Transfer\Exception, - Zend\ProgressBar, - Zend\ProgressBar\Adapter; +use Zend\File\Transfer; +use Zend\File\Transfer\Exception; +use Zend\ProgressBar; +use Zend\ProgressBar\Adapter; /** * File transfer adapter class for the HTTP protocol From 65a414ce33059543135d45c1582c075b2428cd08 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 10 Jul 2012 11:23:46 -0500 Subject: [PATCH 7/8] [zendframework/zf2#1802] CS cleanup - Added missing file/classlevel docblocks - Replaced file-level docblock in classmap_generator.php --- src/PhpClassFile.php | 17 +++++++++++++++-- .../MultipleClassesInMultipleNamespaces.php | 9 ++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/PhpClassFile.php b/src/PhpClassFile.php index a2972bf..afe3d81 100644 --- a/src/PhpClassFile.php +++ b/src/PhpClassFile.php @@ -1,12 +1,25 @@ classes[] = $class; return $this; } -} \ No newline at end of file +} diff --git a/test/TestAsset/MultipleClassesInMultipleNamespaces.php b/test/TestAsset/MultipleClassesInMultipleNamespaces.php index 6b88a90..3aeda85 100644 --- a/test/TestAsset/MultipleClassesInMultipleNamespaces.php +++ b/test/TestAsset/MultipleClassesInMultipleNamespaces.php @@ -1,4 +1,12 @@ Date: Thu, 12 Jul 2012 21:11:36 +0200 Subject: [PATCH 8/8] [PSR-2] fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed Applied php-cs-fixer --fixers=braces,elseif,short_tag,php_closing_tag,trailing_spaces,linefeed --- src/ClassFileLocator.php | 6 ++--- src/Exception/BadMethodCallException.php | 2 +- src/Exception/ExceptionInterface.php | 2 +- src/Exception/InvalidArgumentException.php | 6 ++--- src/Transfer/Adapter/AbstractAdapter.php | 24 ++++++++++--------- src/Transfer/Adapter/Http.php | 6 ++--- .../Exception/BadMethodCallException.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- src/Transfer/Exception/RuntimeException.php | 2 +- src/Transfer/Transfer.php | 2 +- 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/ClassFileLocator.php b/src/ClassFileLocator.php index 008d0b0..5ad4b73 100644 --- a/src/ClassFileLocator.php +++ b/src/ClassFileLocator.php @@ -27,10 +27,10 @@ class ClassFileLocator extends FilterIterator { /** * Create an instance of the locator iterator - * - * Expects either a directory, or a DirectoryIterator (or its recursive variant) + * + * Expects either a directory, or a DirectoryIterator (or its recursive variant) * instance. - * + * * @param string|DirectoryIterator $dirOrIterator */ public function __construct($dirOrIterator = '.') diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index d9c3734..d68eb76 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -14,6 +14,6 @@ * @category Zend * @package Zend_File_Transfer */ -class BadMethodCallException extends \BadMethodCallException implements +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface {} diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index cb6f56a..632be45 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -12,7 +12,7 @@ /** * Marker interface for exceptions found in this component - * + * * @package Zend_File * @subpackage Exception */ diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 42461b6..7d8f2ee 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -12,11 +12,11 @@ /** * Exception class raised when invalid arguments are discovered - * + * * @package Zend_File */ -class InvalidArgumentException - extends \InvalidArgumentException +class InvalidArgumentException + extends \InvalidArgumentException implements ExceptionInterface { } diff --git a/src/Transfer/Adapter/AbstractAdapter.php b/src/Transfer/Adapter/AbstractAdapter.php index c5ebdcb..ed20548 100644 --- a/src/Transfer/Adapter/AbstractAdapter.php +++ b/src/Transfer/Adapter/AbstractAdapter.php @@ -418,13 +418,13 @@ public function addValidators(array $validators, $files = null) foreach ($validators as $name => $validatorInfo) { if ($validatorInfo instanceof Validator\ValidatorInterface) { $this->addValidator($validatorInfo, null, null, $files); - } else if (is_string($validatorInfo)) { + } elseif (is_string($validatorInfo)) { if (!is_int($name)) { $this->addValidator($name, null, $validatorInfo, $files); } else { $this->addValidator($validatorInfo, null, null, $files); } - } else if (is_array($validatorInfo)) { + } elseif (is_array($validatorInfo)) { $argc = count($validatorInfo); $breakChainOnFailure = false; $options = array(); @@ -592,7 +592,8 @@ public function clearValidators() * @param array $options Options to set * @param array $files (Optional) Files to set the options for */ - public function setOptions($options = array(), $files = null) { + public function setOptions($options = array(), $files = null) + { $file = $this->getFiles($files, false, true); if (is_array($options)) { @@ -629,7 +630,8 @@ public function setOptions($options = array(), $files = null) { * @param array $files (Optional) Files to return the options for * @return array Options for given files */ - public function getOptions($files = null) { + public function getOptions($files = null) + { $file = $this->getFiles($files, false, true); foreach ($file as $key => $content) { @@ -1070,7 +1072,7 @@ public function getDestination($files = null) if (empty($destinations)) { $destinations = $this->getTmpDir(); - } else if (count($destinations) == 1) { + } elseif (count($destinations) == 1) { $destinations = current($destinations); } @@ -1144,9 +1146,9 @@ public function getHash($hash = 'crc32', $files = null) foreach($files as $key => $value) { if (file_exists($value['name'])) { $result[$key] = hash_file($hash, $value['name']); - } else if (file_exists($value['tmp_name'])) { + } elseif (file_exists($value['tmp_name'])) { $result[$key] = hash_file($hash, $value['tmp_name']); - } else if (empty($value['options']['ignoreNoFile'])) { + } elseif (empty($value['options']['ignoreNoFile'])) { throw new Exception\InvalidArgumentException("The file '{$value['name']}' does not exist"); } } @@ -1176,7 +1178,7 @@ public function getFileSize($files = null) } else { $result[$key] = $value['size']; } - } else if (empty($value['options']['ignoreNoFile'])) { + } elseif (empty($value['options']['ignoreNoFile'])) { throw new Exception\InvalidArgumentException("The file '{$value['name']}' does not exist"); } else { continue; @@ -1200,7 +1202,7 @@ protected function detectFileSize($value) { if (file_exists($value['name'])) { $result = sprintf("%u", @filesize($value['name'])); - } else if (file_exists($value['tmp_name'])) { + } elseif (file_exists($value['tmp_name'])) { $result = sprintf("%u", @filesize($value['tmp_name'])); } else { return null; @@ -1224,7 +1226,7 @@ public function getMimeType($files = null) foreach($files as $key => $value) { if (file_exists($value['name']) || file_exists($value['tmp_name'])) { $result[$key] = $value['type']; - } else if (empty($value['options']['ignoreNoFile'])) { + } elseif (empty($value['options']['ignoreNoFile'])) { throw new Exception\InvalidArgumentException("the file '{$value['name']}' does not exist"); } else { continue; @@ -1248,7 +1250,7 @@ protected function detectMimeType($value) { if (file_exists($value['name'])) { $file = $value['name']; - } else if (file_exists($value['tmp_name'])) { + } elseif (file_exists($value['tmp_name'])) { $file = $value['tmp_name']; } else { return null; diff --git a/src/Transfer/Adapter/Http.php b/src/Transfer/Adapter/Http.php index 1f6048b..0099924 100644 --- a/src/Transfer/Adapter/Http.php +++ b/src/Transfer/Adapter/Http.php @@ -107,7 +107,7 @@ public function isValid($files = null) $content = 0; if (isset($_SERVER['CONTENT_LENGTH'])) { $content = $_SERVER['CONTENT_LENGTH']; - } else if (!empty($_POST)) { + } elseif (!empty($_POST)) { $content = serialize($_POST); } @@ -339,7 +339,7 @@ public static function getProgress($id = null) if (is_array($call)) { $status = $call + $status; } - } else if (self::isUploadProgressAvailable()) { + } elseif (self::isUploadProgressAvailable()) { $call = call_user_func(self::$callbackUploadProgress, $id); if (is_array($call)) { $status = $call + $status; @@ -355,7 +355,7 @@ public static function getProgress($id = null) if (!is_array($call)) { $status['done'] = true; $status['message'] = 'Failure while retrieving the upload progress'; - } else if (!empty($status['cancel_upload'])) { + } elseif (!empty($status['cancel_upload'])) { $status['done'] = true; $status['message'] = 'The upload has been canceled'; } else { diff --git a/src/Transfer/Exception/BadMethodCallException.php b/src/Transfer/Exception/BadMethodCallException.php index 0f41366..f9164a4 100644 --- a/src/Transfer/Exception/BadMethodCallException.php +++ b/src/Transfer/Exception/BadMethodCallException.php @@ -16,6 +16,6 @@ * @category Zend * @package Zend_File_Transfer */ -class BadMethodCallException extends Exception\BadMethodCallException implements +class BadMethodCallException extends Exception\BadMethodCallException implements ExceptionInterface {} diff --git a/src/Transfer/Exception/InvalidArgumentException.php b/src/Transfer/Exception/InvalidArgumentException.php index c091d07..f3669c2 100644 --- a/src/Transfer/Exception/InvalidArgumentException.php +++ b/src/Transfer/Exception/InvalidArgumentException.php @@ -16,6 +16,6 @@ * @category Zend * @package Zend_File_Transfer */ -class InvalidArgumentException extends Exception\InvalidArgumentException implements +class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface {} diff --git a/src/Transfer/Exception/RuntimeException.php b/src/Transfer/Exception/RuntimeException.php index dcd5244..723c86b 100644 --- a/src/Transfer/Exception/RuntimeException.php +++ b/src/Transfer/Exception/RuntimeException.php @@ -16,6 +16,6 @@ * @category Zend * @package Zend_File_Transfer */ -class RuntimeException extends Exception\RuntimeException implements +class RuntimeException extends Exception\RuntimeException implements ExceptionInterface {} diff --git a/src/Transfer/Transfer.php b/src/Transfer/Transfer.php index b604c8b..e75239c 100644 --- a/src/Transfer/Transfer.php +++ b/src/Transfer/Transfer.php @@ -52,7 +52,7 @@ public function setAdapter($adapter, $direction = false, $options = array()) if (!is_string($adapter)) { throw new Exception\InvalidArgumentException('Adapter must be a string'); } - + if ($adapter[0] != '\\') { $adapter = '\Zend\File\Transfer\Adapter\\' . ucfirst($adapter); }