diff --git a/.travis.yml b/.travis.yml index 667d3f2d0..b6b914adf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,13 +14,16 @@ env: before_script: - if [[ $TRAVIS_PHP_VERSION = '7.1' && $DB = 'sqlite' && "$DEPENDENCIES" != "low" ]]; then PHPUNIT_FLAGS="--coverage-clover ./build/logs/clover.xml"; else PHPUNIT_FLAGS=""; fi - if [[ "$PHPUNIT_FLAGS" == "" ]]; then phpenv config-rm xdebug.ini; fi + - if [[ $PHPSTAN = 1 ]]; then echo "extension=redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi - composer self-update - composer install --prefer-source - if [ "$DEPENDENCIES" != "low" ]; then composer update; fi; - if [ "$DEPENDENCIES" == "low" ]; then composer update --prefer-lowest; fi; + - if [[ $PHPSTAN = 1 ]]; then composer require --dev --prefer-stable phpstan/phpstan:^0.7 symfony/console:^3.0; fi - if [[ $DB == "mysql" || $DB == "mariadb" ]]; then mysql -e "CREATE SCHEMA doctrine_tests; GRANT ALL PRIVILEGES ON doctrine_tests.* to travis@'%'"; fi; script: + - if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -l 0 -c phpstan.neon lib; fi - ENABLE_SECOND_LEVEL_CACHE=0 ./vendor/bin/phpunit -v -c tests/travis/$DB.travis.xml $PHPUNIT_FLAGS - ENABLE_SECOND_LEVEL_CACHE=1 ./vendor/bin/phpunit -v -c tests/travis/$DB.travis.xml --exclude-group performance,non-cacheable,locking_functional @@ -39,6 +42,10 @@ matrix: env: - DB=sqlite - DEPENDENCIES='low' + - php: 7.1 + env: + - DB=pgsql + - PHPSTAN=1 allow_failures: - php: nightly diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 11205df04..a5024b8d9 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -514,10 +514,11 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec public function offsetSet($offset, $value) { if ( ! isset($offset)) { - return $this->add($value); + $this->add($value); + return; } - return $this->set($offset, $value); + $this->set($offset, $value); } /** diff --git a/lib/Doctrine/ORM/Query/ResultSetMapping.php b/lib/Doctrine/ORM/Query/ResultSetMapping.php index 5c4550980..efffa674c 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMapping.php +++ b/lib/Doctrine/ORM/Query/ResultSetMapping.php @@ -451,7 +451,7 @@ class ResultSetMapping /** * @param string $alias * - * @return AssociationMapping + * @return string */ public function getRelation($alias) { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..cc74bf06e --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + ignoreErrors: + # Memcache does not exist on PHP 7 + - '#Instantiated class Memcache not found#'