Skip to content

Fix PHP 7.4 deprecations #930

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

Merged
merged 8 commits into from
Dec 10, 2019
Merged
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
8 changes: 7 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ build: false
clone_depth: 2
clone_folder: c:\projects\sentry-php
skip_branch_with_pr: true
image: Visual Studio 2019
branches:
only:
- master
- develop
- /^release\/.+$/

environment:
matrix:
Expand All @@ -22,6 +24,10 @@ environment:
DEPENDENCIES: lowest
- PHP_VERSION: 7.3-Win32-VC15
DEPENDENCIES: highest
- PHP_VERSION: 7.4-Win32-VC15
DEPENDENCIES: lowest
- PHP_VERSION: 7.4-Win32-VC15
DEPENDENCIES: highest

matrix:
fast_finish: true
Expand Down Expand Up @@ -49,7 +55,7 @@ install:
- IF %INSTALL_PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %INSTALL_PHP%==1 echo extension=php_openssl.dll >> php.ini
- cd c:\projects\sentry-php
- IF NOT EXIST composer.phar appveyor-retry appveyor DownloadFile https://github.com/composer/composer/releases/download/1.8.3/composer.phar
- IF NOT EXIST composer.phar appveyor-retry appveyor DownloadFile https://github.com/composer/composer/releases/download/1.9.1/composer.phar
- php composer.phar self-update
- IF %DEPENDENCIES%==lowest php composer.phar update --no-progress --no-interaction --no-suggest --ansi --prefer-lowest --prefer-dist
- IF %DEPENDENCIES%==highest php composer.phar update --no-progress --no-interaction --no-suggest --ansi --prefer-dist
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- 7.4

env:
- dependencies=highest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fix remaining PHP 7.4 deprecations (#930)

## 2.2.5 (2019-11-27)

- Add compatibility with Symfony 5 (#925)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^7.5.18",
"symfony/phpunit-bridge": "^4.3|^5.0",
"vimeo/psalm": "^3.4"
},
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ parameters:
- tests
ignoreErrors:
- '/Argument of an invalid type object supplied for foreach, only iterables are supported/'
- '/Binary operation "\*" between array and 2 results in an error\./'
- '/Http\\Client\\Curl\\Client/'
- '/^Parameter #1 \$object of method ReflectionProperty::setValue\(\) expects object, null given\.$/' # https://github.com/phpstan/phpstan/pull/2340
-
Expand Down
11 changes: 8 additions & 3 deletions src/Serializer/AbstractSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ protected function serializeCallable(callable $callable): string
$callableType = $reflection->isClosure() ? 'Lambda ' : 'Callable ';
$callableReturnType = $reflection->getReturnType();

if (null !== $callableReturnType) {
$callableType .= $callableReturnType . ' ';
if ($callableReturnType instanceof \ReflectionNamedType) {
$callableType .= $callableReturnType->getName() . ' ';
}

if ($class) {
Expand All @@ -316,7 +316,12 @@ private function serializeCallableParameters(\ReflectionFunctionAbstract $reflec
{
$params = [];
foreach ($reflection->getParameters() as &$param) {
$paramType = $param->getType() ?? 'mixed';
$reflectionType = $param->getType();
if ($reflectionType instanceof \ReflectionNamedType) {
$paramType = $reflectionType->getName();
} else {
$paramType = 'mixed';
}

if ($param->allowsNull()) {
$paramType .= '|null';
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/AbstractSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function serializableCallableProvider(): array
return [
[
'callable' => function (array $param1) {
return $param1 * 2;
throw new \Exception('Don\'t even think about invoke me');
},
'expected' => 'Lambda ' . __NAMESPACE__ . '\\{closure} [array param1]',
],
Expand Down