Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x phpstan #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ phpstan:
image: registry.gitlab.com/socialconnect-php/auth:7.3
script:
- composer install -o
- ./vendor/bin/phpstan.phar analyse src/ tests/ --no-progress --level 2
- ./vendor/bin/phpstan.phar analyse src/ tests/ --no-progress
tags:
- docker

Expand Down
36 changes: 26 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@

dist: trusty
sudo: false

env:
global:
- DEFAULT=1

language: php

php:
- 7.1
- 7.2
- 7.3

matrix:
fast_finish: true

include:
- php: 7.3
env: DEFAULT=0 STATIC_ANALYSIS=1

- php: 7.3
env: DEFAULT=0 PHPCS=1

install:
- composer self-update
- composer --prefer-dist install

script:
- ./vendor/bin/phpcs --standard=PSR2 --report=emacs --extensions=php --warning-severity=0 src/ tests/Test
- 'if [ {$TRAVIS_PHP_VERSION} = "7.3" ]; then
./vendor/bin/phpunit --process-isolation -v --debug --coverage-clover=coverage.clover;
else
./vendor/bin/phpunit -v --debug --no-coverage;
fi'
- if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION == "7.3" ]]; then vendor/bin/phpunit --process-isolation -v --debug --coverage-clover=coverage.clover; fi
- if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION != "7.3" ]]; then vendor/bin/phpunit -v --debug --no-coverage; fi
- if [[ $PHPCS == 1 ]]; then vendor/bin/phpcs --standard=PSR2 --report=emacs --extensions=php --warning-severity=0 src/ tests/Test; fi
- if [[ $STATIC_ANALYSIS == 1 ]]; then vendor/bin/phpstan.phar analyse src/ tests/; fi

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "7.3" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- |
if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION == "7.3" ]]; then
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi

notifications:
email: false
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 4
ignoreErrors:
- '#should return SocialConnect\\Common\\Entity\\User but returns object#'
6 changes: 4 additions & 2 deletions src/OAuth2/Provider/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ public function parseToken(string $body)
'name' => 'fullname',
]);

$this->user = $hydrator->hydrate(new User(), $response['user']);
$this->user->id = str_replace('/users/', '', $this['user']['uri']);
/** @var \SocialConnect\Common\Entity\User $user */
$user = $hydrator->hydrate(new User(), $response['user']);
$this->user = $user;
$this->user->id = str_replace('/users/', '', $response['user']['uri']);

$token->setUserId((string) $this->user->id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenID/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function discover(string $url)
$xml = new \SimpleXMLElement($response->getBody()->getContents());

$this->version = 2;
$this->loginEntrypoint = $xml->XRD->Service->URI;
$this->loginEntrypoint = (string)$xml->XRD->Service->URI;

return $this->getOpenIdUrl();
}
Expand Down