Skip to content

Commit

Permalink
Merge pull request #709 from phalcon/3.0.x
Browse files Browse the repository at this point in the history
3.0.3
  • Loading branch information
sergeyklay authored Dec 15, 2016
2 parents e35352e + 1fa47bc commit d34e982
Show file tree
Hide file tree
Showing 93 changed files with 3,279 additions and 1,035 deletions.
119 changes: 85 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,111 @@
# Phalcon Framework
#
# Copyright (c) 2011-2016 Phalcon Team (https://www.phalconphp.com)
#
# This source file is subject to the New BSD License that is bundled
# with this package in the file LICENSE.txt.
#
# If you did not receive a copy of the license and are unable to
# obtain it through the world-wide-web, please send an email
# to [email protected] so we can send you a copy immediately.

language: php

dist: trusty
sudo: required

php:
- 5.5
- 5.6
- 7.0

sudo: required
dist: trusty
matrix:
include:
- php: 7.0
env: ZEND_BACKEND="--backend=ZendEngine3"

services:
- memcached
- redis
- mongodb
- mysql

git:
depth: 1

cache:
apt: true
ccache: true
timeout: 691200
directories:
- .temp
- vendor
- $HOME/.ccache
- $HOME/.composer/cache

env:
global:
- DOCKER_COMPOSE_VERSION="1.8.1" PHALCON_SRC_PATH="${TRAVIS_BUILD_DIR}/cphalcon"
matrix:
- PHALCON_VERSION="3.0.x"
- ZEND_DONT_UNLOAD_MODULES=1
- CC="ccache gcc"
- PATH="$PATH:~/bin"
- PHALCON_VERSION="v3.0.2"

before_install:
- sudo service memcached stop
- sudo service docker stop
# Fix Hash Sum mismatch
- sudo apt-get purge -y google-chrome-stable
- sudo rm -f /etc/apt/sources.list.d/google*
- phpenv config-rm xdebug.ini
- phpenv config-rm xdebug.ini || true
- sudo ln -s /home/travis/.phpenv/versions/$(phpenv version-name)/bin/phpize /usr/bin/
- sudo ln -s /home/travis/.phpenv/versions/$(phpenv version-name)/bin/php-config /usr/bin/
- export PHP_MAJOR="$(echo $TRAVIS_PHP_VERSION | cut -d '.' -f 1,2)"
- if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi;
# Install dev-dependencies
- travis_retry composer install --prefer-dist --no-interaction --ignore-platform-reqs
- travis_retry composer require "phalcon/zephir:dev-master" --ignore-platform-reqs
- travis_retry composer require duncan3dc/fork-helper:$(if [[ "${PHP_MAJOR:0:1}" = "7" ]]; then echo "^2.0"; else echo "^1.0"; fi) --ignore-platform-reqs

install:
- git clone --depth=1 -q --branch=${PHALCON_VERSION} https://github.com/phalcon/cphalcon.git ${PHALCON_SRC_PATH}
# Install Docker
- sudo apt-get update -qq
- sudo apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y --force-yes docker-engine
- sudo service docker restart
# Install Docker Compose
- sudo rm /usr/local/bin/docker-compose
- curl -s -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
# Install Dependencies
- composer self-update
- travis_retry composer install --ignore-platform-reqs --prefer-source --no-interaction
- travis_retry composer require --ignore-platform-reqs duncan3dc/fork-helper:$(if [[ "${TRAVIS_PHP_VERSION:0:1}" = "7" ]]; then echo "^2.0"; else echo "^1.0"; fi)
# Pull images
- docker pull phalconphp/php:${TRAVIS_PHP_VERSION}
- docker pull phalconphp/zephir:${TRAVIS_PHP_VERSION}
- ( bash tests/_ci/install_zephir.sh )
# See https://github.com/aerospike/aerospike-client-php/issues/127
- '[[ "${PHP_MAJOR:0:1}" == "7" ]] || bash ${TRAVIS_BUILD_DIR}/tests/_ci/install_aerospike.sh'
- git clone -q --depth=1 https://github.com/phalcon/cphalcon.git -b ${PHALCON_VERSION}
- ln -s ${TRAVIS_BUILD_DIR}/.temp ${TRAVIS_BUILD_DIR}/cphalcon/.temp
- ( cd cphalcon; zephir fullclean && zephir generate $ZEND_BACKEND )
- ( cd cphalcon/ext; export CFLAGS="-g3 -O1 -std=gnu90 -Wall -DZEPHIR_RELEASE=1"; /usr/bin/phpize &> /dev/null && ./configure --silent --enable-phalcon &> /dev/null && make --silent -j3 &> /dev/null && make --silent install )
- ( bash tests/_ci/install_prereqs_$PHP_MAJOR.sh )

before_script:
- stty cols 160
- docker-compose -p incubator up -d
- docker-compose -p incubator ps
- docker logs incubator_aerospike
- sleep 1
# Create database and user
- echo 'CREATE DATABASE incubator CHARSET=utf8 COLLATE=utf8_unicode_ci' | mysql -u root
- echo "CREATE USER 'incubator'@'%' IDENTIFIED BY 'secret'" | mysql -u root
- echo "GRANT ALL PRIVILEGES ON incubator.* TO 'incubator'@'%' WITH GRANT OPTION" | mysql -u root
- cat ${TRAVIS_BUILD_DIR}/tests/_data/dump.sql | mysql -u root incubator
# See https://github.com/aerospike/aerospike-client-php/issues/127
- '[[ "${PHP_MAJOR:0:1}" == "7" ]] || bash ${TRAVIS_BUILD_DIR}/tests/_ci/install_aserver.sh'

script:
- bash tests/build.sh
- vendor/bin/phpcs
- vendor/bin/codecept build
- vendor/bin/codecept run

notifications:
email:
recipients:
- [email protected]
on_success: change
on_failure: always

addons:
apt:
packages:
- re2c
- beanstalkd
- python-bcrypt
- build-essential
- autoconf
- libssl-dev
- libyaml-dev
- liblua5.1-dev
- mysql-server-5.6
- mysql-server-core-5.6
- mysql-client-5.6
hosts:
- db
- incubator.local
3 changes: 2 additions & 1 deletion Library/Phalcon/Annotations/Adapter/Aerospike.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public function __construct(array $options = [])
if (!isset($options['hosts']) ||
!is_array($options['hosts']) ||
!isset($options['hosts'][0]) ||
!is_array($options['hosts'][0])
!is_array($options['hosts'][0]) ||
empty($options['hosts'][0])
) {
throw new Exception('No hosts given in options');
}
Expand Down
92 changes: 92 additions & 0 deletions Library/Phalcon/Annotations/Extended/AbstractAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2016 Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to [email protected] so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Serghei Iakovlev <[email protected]> |
+------------------------------------------------------------------------+
*/

namespace Phalcon\Annotations\Extended;

use Phalcon\Annotations\Adapter;
use Phalcon\Annotations\Exception;
use Phalcon\Annotations\Reflection;
use Phalcon\Traits\ConfigurableTrait;

/**
* Phalcon\Annotations\Extended\AbstractAdapter
*
* This is the base class for Phalcon\Annotations\Extended adapters
*
* @package Phalcon\Annotations\Extended
*/
abstract class AbstractAdapter extends Adapter implements AdapterInterface
{
use ConfigurableTrait;

/**
* Configurable properties.
* @var array
*/
protected $configurable = [];

/**
* AbstractAdapter constructor.
*
* @param array $options
*/
public function __construct(array $options = [])
{
$this->setParameters($options);
}

/**
* Returns prefixed identifier.
*
* @param string $id
* @return string
*/
abstract protected function getPrefixedIdentifier($id);

/**
* Check and cast returned result.
*
* @param mixed $result
* @return bool
*/
protected function castResult($result)
{
if ($result instanceof Reflection) {
return $result;
}

return false;
}

/**
* Check annotation key.
*
* @param string $key
*
* @throws Exception
*/
protected function checkKey($key)
{
if (!is_string($key)) {
throw new Exception(
sprintf('Invalid key type key to retrieve annotations. Expected string but got %s.', gettype($key))
);
}
}
}
Loading

0 comments on commit d34e982

Please sign in to comment.