From f9447b53ee8b86da7360d03c25b17b97307f5fb0 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 14:55:24 +0000 Subject: [PATCH 1/9] Adding .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de4a392 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/vendor +/composer.lock From ea52403868d5574ca2fe6a48c3d64107315ed231 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:27:10 +0000 Subject: [PATCH 2/9] Add PHPCS to composer dev requirements and fix composer.json --- composer.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 77ad7a5..431b3fb 100644 --- a/composer.json +++ b/composer.json @@ -7,10 +7,17 @@ "authors": [ { "name": "Fabrizio Branca", - "email": "mail@{firstname}-{lastname}.de" + "email": "{firstname}.{lastname}@aoe.com" } ], "require": { "magento-hackathon/magento-composer-installer": "*" + }, + "require-dev": { + "squizlabs/php_codesniffer": "2.*" + }, + "extra": { + "skip-package-deployment": true, + "magento-root-dir": "./" } } From 3c7d420452f0131cbeec68c99b901398d91a51b8 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:28:55 +0000 Subject: [PATCH 3/9] Adding customized PSR2 ruleset to handle Magento 1 codebase --- phpcs.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 phpcs.xml diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..f4c766f --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,16 @@ + + + Magento extension ruleset based on PSR-2 but modified for Magento 1 + + + + + + + + + + + + + From 29affcbae4a8fc1ba071f6c5b48ed89ba1ad3dc9 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:34:08 +0000 Subject: [PATCH 4/9] Add PHP min-version to composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 431b3fb..4801298 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ } ], "require": { + "php": ">=5.3", "magento-hackathon/magento-composer-installer": "*" }, "require-dev": { From 1b5ea0a9a7e027980fc03ba2cf67cec15eba7b64 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:35:17 +0000 Subject: [PATCH 5/9] Adding travis config --- .travis.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0fcf99b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: php +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - hhvm +matrix: + allow_failures: + - php: hhvm +before_script: + # Composer + - composer --no-interaction self-update + - composer --no-interaction --prefer-source --dev install +script: + # Code style + - php vendor/bin/phpcs --standard=./phpcs.xml --encoding=utf-8 ./app ./lib ./shell From f3e28da0838a6753b16550c832948806a2a2e335 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:41:44 +0000 Subject: [PATCH 6/9] Fix PSR2 related errors --- .../Aoe/ClassPathCache/Helper/Data.php | 2 - app/code/community/Varien/Autoload.php | 37 +++++++++---------- shell/aoe_classpathcache.php | 3 -- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/app/code/community/Aoe/ClassPathCache/Helper/Data.php b/app/code/community/Aoe/ClassPathCache/Helper/Data.php index 154689d..cbcbb9b 100644 --- a/app/code/community/Aoe/ClassPathCache/Helper/Data.php +++ b/app/code/community/Aoe/ClassPathCache/Helper/Data.php @@ -76,6 +76,4 @@ public function getUrl() ) ); } - - } diff --git a/app/code/community/Varien/Autoload.php b/app/code/community/Varien/Autoload.php index e79914c..7eef833 100644 --- a/app/code/community/Varien/Autoload.php +++ b/app/code/community/Varien/Autoload.php @@ -10,16 +10,16 @@ class Varien_Autoload const SCOPE_FILE_PREFIX = '__'; const CACHE_KEY_PREFIX = 'classPathCache'; - static protected $_instance; - static protected $_scope = 'default'; - static protected $_cache = array(); - static protected $_numberOfFilesAddedToCache = 0; + protected static $_instance; + protected static $_scope = 'default'; + protected static $_cache = array(); + protected static $_numberOfFilesAddedToCache = 0; - static public $useAPC = null; - static protected $cacheKey = self::CACHE_KEY_PREFIX; + public static $useAPC = null; + protected static $cacheKey = self::CACHE_KEY_PREFIX; /* Base Path */ - static protected $_BP = ''; + protected static $_BP = ''; /** * Class constructor @@ -50,7 +50,7 @@ public function __construct() * * @return Varien_Autoload */ - static public function instance() + public static function instance() { if (!self::$_instance) { self::$_instance = new Varien_Autoload(); @@ -61,7 +61,7 @@ static public function instance() /** * Register SPL autoload function */ - static public function register() + public static function register() { spl_autoload_register(array(self::instance(), 'autoload')); } @@ -96,7 +96,7 @@ public function autoload($class) * * @return string */ - static function getFileFromClassName($className) + public static function getFileFromClassName($className) { $className = ltrim($className, '\\'); $fileName = ''; @@ -119,7 +119,7 @@ static function getFileFromClassName($className) * * @param string $code scope code */ - static public function registerScope($code) + public static function registerScope($code) { self::$_scope = $code; } @@ -129,7 +129,7 @@ static public function registerScope($code) * * @return string */ - static public function getScope() + public static function getScope() { return self::$_scope; } @@ -139,7 +139,7 @@ static public function getScope() * * @return string */ - static public function getCacheFilePath() + public static function getCacheFilePath() { return self::$_BP . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'classPathCache.php'; } @@ -149,7 +149,7 @@ static public function getCacheFilePath() * * @return string */ - static public function getRevalidateFlagPath() + public static function getRevalidateFlagPath() { return self::$_BP . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'classPathCache.flag'; } @@ -159,7 +159,7 @@ static public function getRevalidateFlagPath() * * @param array $cache */ - static public function setCache(array $cache) + public static function setCache(array $cache) { self::$_cache = $cache; } @@ -169,7 +169,7 @@ static public function setCache(array $cache) * * @return array */ - static public function loadCacheContent() + public static function loadCacheContent() { if (self::isApcUsed()) { @@ -203,7 +203,7 @@ static public function loadCacheContent() * * @return mixed */ - static public function getFullPath($className) + public static function getFullPath($className) { if (!isset(self::$_cache[$className])) { self::$_cache[$className] = self::searchFullPath(self::getFileFromClassName($className)); @@ -223,7 +223,7 @@ static public function getFullPath($className) * * @return bool|string */ - static public function searchFullPath($filename) + public static function searchFullPath($filename) { // return stream_resolve_include_path($filename); $paths = explode(PATH_SEPARATOR, get_include_path()); @@ -289,5 +289,4 @@ public function __destruct() } } } - } diff --git a/shell/aoe_classpathcache.php b/shell/aoe_classpathcache.php index ac75b62..a269a70 100644 --- a/shell/aoe_classpathcache.php +++ b/shell/aoe_classpathcache.php @@ -87,10 +87,7 @@ public function usageHelp() } return $help; } - - } $shell = new Aoe_ClassPathCache_Shell(); $shell->run(); - From c631ada2b17763dd22767a61bae528f1f49758b1 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:50:20 +0000 Subject: [PATCH 7/9] Update PHPCS command to prevent warnings from failing the CI run --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0fcf99b..e573700 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,4 @@ before_script: - composer --no-interaction --prefer-source --dev install script: # Code style - - php vendor/bin/phpcs --standard=./phpcs.xml --encoding=utf-8 ./app ./lib ./shell + - php vendor/bin/phpcs --runtime-set ignore_warnings_on_exit true --standard=./phpcs.xml --encoding=utf-8 --report-width=120 ./app ./lib ./shell From ecb7a03068cbda47444d2eb9d7f58e4a86ca9f15 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:56:06 +0000 Subject: [PATCH 8/9] Add build status image tracking master branch to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09bc868..bd0e46d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# AOE ClassPathCache +# AOE ClassPathCache [![Build Status](https://travis-ci.org/AOEpeople/Aoe_ClassPathCache.svg?branch=master)](https://travis-ci.org/AOEpeople/Aoe_ClassPathCache) ## Change log From c66077be31f657838eb1b43aba722905d1beb891 Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Wed, 4 Mar 2015 15:58:40 +0000 Subject: [PATCH 9/9] Update version number and changelog --- README.md | 6 ++++++ app/code/community/Aoe/ClassPathCache/etc/config.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd0e46d..ab887e9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ ## Change log +* v0.5.1 + * Added Travis CI config file + * Add PHPCS ruleset and check + * Fixed several PSR-2 related errors in the code + * Added tracking of the Travis CI build status for master into the README + * v0.5.0 * Changed code pool from 'local' to 'community'. NB: This change could possibly break things if you are manually installing the code instead of using modman/composer diff --git a/app/code/community/Aoe/ClassPathCache/etc/config.xml b/app/code/community/Aoe/ClassPathCache/etc/config.xml index dbb4cbf..892bcb2 100644 --- a/app/code/community/Aoe/ClassPathCache/etc/config.xml +++ b/app/code/community/Aoe/ClassPathCache/etc/config.xml @@ -2,7 +2,7 @@ - 0.5.0 + 0.5.1