From 626e9b3fcaaaf87ce786c6a7521b107c7a20dfe2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 8 Oct 2018 12:33:28 +0300 Subject: [PATCH 1/3] LICENSE.txt -> LICENSE --- LICENSE.txt => LICENSE | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE.txt => LICENSE (100%) diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE From 3daba85ab245a7ffe5f0b125b6f56884994ef2dc Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 8 Oct 2018 12:34:06 +0300 Subject: [PATCH 2/3] Do not throw execption on empty input --- src/Exception.php | 31 ------------------------------- src/Parser.php | 38 +++++++++++++------------------------- 2 files changed, 13 insertions(+), 56 deletions(-) delete mode 100644 src/Exception.php diff --git a/src/Exception.php b/src/Exception.php deleted file mode 100644 index 13a3a6b..0000000 --- a/src/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ - | - +------------------------------------------------------------------------+ -*/ - -namespace Phalcon\Cop; - -use Phalcon\Exception as PhalconException; - -/** - * Phalcon\Cop\Exception - * - * @package Phalcon\Cop - */ -class Exception extends PhalconException -{ -} diff --git a/src/Parser.php b/src/Parser.php index 34b8b1f..fdfe979 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -1,21 +1,13 @@ | - +------------------------------------------------------------------------+ -*/ +/** + * This file is part of the Cop package. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Phalcon\Cop; @@ -44,9 +36,9 @@ class Parser ]; /** - * Parse CLI command + * Parse console input. * - * @param array $argv + * @param array $argv * @return array */ public function parse(array $argv = []): array @@ -54,6 +46,7 @@ public function parse(array $argv = []): array if (empty($argv)) { $argv = $this->getArgvFromServer(); } + array_shift($argv); $this->parsedCommands = []; @@ -81,18 +74,13 @@ public function getBoolean(string $key, bool $default = false): bool } /** - * Get console command either from argument or from Server + * Gets array of arguments passed from the input. * * @return array - * @throws Exception */ protected function getArgvFromServer(): array { - if (!empty($_SERVER['argv'])) { - return $_SERVER['argv']; - } - - throw new Exception("Parameters haven't been defined yet"); + return empty($_SERVER['argv']) ? [] : $_SERVER['argv']; } /** From da68c5d8870aa61310251d2d057d46168a42b319 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 8 Oct 2018 12:37:13 +0300 Subject: [PATCH 3/3] Do not require Phalcon --- .travis.yml | 12 +++-------- composer.json | 3 +-- tests/_ci/install_phalcon.sh | 40 ------------------------------------ 3 files changed, 4 insertions(+), 51 deletions(-) delete mode 100644 tests/_ci/install_phalcon.sh diff --git a/.travis.yml b/.travis.yml index 190126e..63128e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,27 +21,21 @@ cache: - vendor - $HOME/.composer/cache -env: - global: - - PHALCON_VERSION=v3.3.2 #TODO change this version to 4.0 later + before_install: - phpenv config-rm xdebug.ini || true - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com $GH_TOKEN; fi; install: - - bash tests/_ci/install_phalcon.sh - - cd $TRAVIS_BUILD_DIR - travis_retry composer install --prefer-dist --no-interaction before_script: script: - vendor/bin/phpcs - - phpunit tests -v + - vendor/bin/phpunit tests -v - vendor/bin/phpstan analyse -l max -c phpstan.neon src -v notifications: - email: - on_success: never - on_failure: never + email: false diff --git a/composer.json b/composer.json index 1ab09a2..4848fe5 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,7 @@ "forum": "https://forum.phalconphp.com/" }, "require": { - "php": ">=7.0", - "ext-phalcon": "~3.3" + "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.5", diff --git a/tests/_ci/install_phalcon.sh b/tests/_ci/install_phalcon.sh deleted file mode 100644 index 37cdc5e..0000000 --- a/tests/_ci/install_phalcon.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# Ensure that this is being run inside a CI container -if [ "${CI}" != "true" ]; then - echo "This script is designed to run inside a CI container only. Exiting" - exit 1 -fi - -PHALCON_VERSION=${PHALCON_VERSION:-master} -PHP_MAJOR=`$(phpenv which php-config) --version | cut -d '.' -f 1,2` - -LOCAL_SRC_DIR=${HOME}/src/phalcon/${PHALCON_VERSION} -LOCAL_LIB_DIR=${HOME}/.local/lib -LOCAL_LIBRARY=${LOCAL_LIB_DIR}/phalcon-${PHALCON_VERSION}-${PHP_MAJOR}.so - -PHALCON_INI_FILE=$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/50-phalcon.ini - -EXTENSION_DIR=`$(phpenv which php-config) --extension-dir` - -if [ ! -f ${LOCAL_LIBRARY} ]; then - mkdir -p ${LOCAL_SRC_DIR} - mkdir -p ${LOCAL_LIB_DIR} - git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b ${PHALCON_VERSION} ${LOCAL_SRC_DIR} - - cd ${LOCAL_SRC_DIR}/build - - ./install --phpize $(phpenv which phpize) --php-config $(phpenv which php-config) - - if [ ! -f "${EXTENSION_DIR}/phalcon.so" ]; then - echo "Unable to locate installed phalcon.so" - exit 1 - fi - - cp "${EXTENSION_DIR}/phalcon.so" ${LOCAL_LIBRARY} -fi - -echo "[Phalcon]" > ${PHALCON_INI_FILE} -echo "extension=${LOCAL_LIBRARY}" >> ${PHALCON_INI_FILE} - -php --ri phalcon || exit 1