Completed
Push — master ( 7928ab...1cefdb )
by Georgio
04:03 queued 11s
created

testConstructCorrectInterfaceWithoutCustomUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.9
cc 1
nc 1
nop 0
1
<?php
2
3
namespace OAuthTest\Unit\OAuth1\Service;
4
5
use OAuth\OAuth1\Service\FiveHundredPx;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, OAuthTest\Unit\OAuth1\Service\FiveHundredPx.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
6
use PHPUnit\Framework\TestCase;
7
8
class FiveHundredPx extends TestCase
9
{
10
    /**
11
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
12
     */
13
    public function testConstructCorrectInterfaceWithoutCustomUri(): void
14
    {
15
        $service = new FiveHundredPx(
16
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
17
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
18
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
19
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
20
        );
21
22
        self::assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service);
23
    }
24
25
    /**
26
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
27
     */
28
    public function testConstructCorrectInstanceWithoutCustomUri(): void
29
    {
30
        $service = new FiveHundredPx(
31
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
34
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
        );
36
37
        self::assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service);
38
    }
39
40
    /**
41
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
42
     */
43
    public function testConstructCorrectInstanceWithCustomUri(): void
44
    {
45
        $service = new FiveHundredPx(
46
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
47
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
48
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
49
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
50
            $this->createMock('\\OAuth\\Common\\Http\\Uri\\UriInterface')
51
        );
52
53
        self::assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service);
54
    }
55
56
    /**
57
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
58
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
59
     */
60
    public function testGetRequestTokenEndpoint(): void
61
    {
62
        $service = new FiveHundredPx(
63
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
64
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
65
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
66
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
67
        );
68
69
        self::assertSame(
70
            'https://api.500px.com/v1/oauth/request_token',
71
            $service->getRequestTokenEndpoint()->getAbsoluteUri()
72
        );
73
    }
74
75
    /**
76
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
77
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getAuthorizationEndpoint
78
     */
79
    public function testGetAuthorizationEndpoint(): void
80
    {
81
        $service = new FiveHundredPx(
82
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
83
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
84
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
85
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
86
        );
87
88
        self::assertSame(
89
            'https://api.500px.com/v1/oauth/authorize',
90
            $service->getAuthorizationEndpoint()->getAbsoluteUri()
91
        );
92
    }
93
94
    /**
95
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
96
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getAccessTokenEndpoint
97
     */
98
    public function testGetAccessTokenEndpoint(): void
99
    {
100
        $service = new FiveHundredPx(
101
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
102
            $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...ient\\ClientInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
103
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
104
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
105
        );
106
107
        self::assertSame(
108
            'https://api.500px.com/v1/oauth/access_token',
109
            $service->getAccessTokenEndpoint()->getAbsoluteUri()
110
        );
111
    }
112
113
    /**
114
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
115
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
116
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse
117
     */
118
    public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse(): void
119
    {
120
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
121
        $client->expects(self::once())->method('retrieveResponse')->willReturn(null);
122
123
        $service = new FiveHundredPx(
124
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
125
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
126
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
127
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
128
        );
129
130
        $this->expectException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException');
131
132
        $service->requestRequestToken();
133
    }
134
135
    /**
136
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
137
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
138
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse
139
     */
140
    public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray(): void
141
    {
142
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
143
        $client->expects(self::once())->method('retrieveResponse')->willReturn('notanarray');
144
145
        $service = new FiveHundredPx(
146
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
147
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
148
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
149
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
150
        );
151
152
        $this->expectException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException');
153
154
        $service->requestRequestToken();
155
    }
156
157
    /**
158
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
159
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
160
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse
161
     */
162
    public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet(): void
163
    {
164
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
165
        $client->expects(self::once())->method('retrieveResponse')->willReturn('foo=bar');
166
167
        $service = new FiveHundredPx(
168
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
169
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
170
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
171
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
172
        );
173
174
        $this->expectException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException');
175
176
        $service->requestRequestToken();
177
    }
178
179
    /**
180
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
181
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
182
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse
183
     */
184
    public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue(): void
185
    {
186
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
187
        $client->expects(self::once())->method('retrieveResponse')->willReturn(
188
            'oauth_callback_confirmed=false'
189
        );
190
191
        $service = new FiveHundredPx(
192
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
193
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
194
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
195
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
196
        );
197
198
        $this->expectException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException');
199
200
        $service->requestRequestToken();
201
    }
202
203
    /**
204
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
205
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
206
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse
207
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse
208
     */
209
    public function testParseRequestTokenResponseValid(): void
210
    {
211
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
212
        $client->expects(self::once())->method('retrieveResponse')->willReturn(
213
            'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar'
214
        );
215
216
        $service = new FiveHundredPx(
217
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
218
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
219
            $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...TokenStorageInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
220
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
221
        );
222
223
        self::assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken());
224
    }
225
226
    /**
227
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
228
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
229
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse
230
     */
231
    public function testParseAccessTokenResponseThrowsExceptionOnError(): void
232
    {
233
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
234
        $client->expects(self::once())->method('retrieveResponse')->willReturn('error=bar');
235
236
        $token = $this->createMock('\\OAuth\\OAuth1\\Token\\TokenInterface');
237
238
        $storage = $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
239
        $storage->expects(self::any())->method('retrieveAccessToken')->willReturn($token);
240
241
        $service = new FiveHundredPx(
242
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
243
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
244
            $storage,
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
245
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
246
        );
247
248
        $this->expectException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException');
249
250
        $service->requestAccessToken('foo', 'bar', $token);
0 ignored issues
show
Documentation introduced by
$token is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a string|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
251
    }
252
253
    /**
254
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::__construct
255
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint
256
     * @covers \OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse
257
     */
258
    public function testParseAccessTokenResponseValid(): void
259
    {
260
        $client = $this->createMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
261
        $client->expects(self::once())->method('retrieveResponse')->willReturn(
262
            'oauth_token=foo&oauth_token_secret=bar'
263
        );
264
265
        $token = $this->createMock('\\OAuth\\OAuth1\\Token\\TokenInterface');
266
267
        $storage = $this->createMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
268
        $storage->expects(self::any())->method('retrieveAccessToken')->willReturn($token);
269
270
        $service = new FiveHundredPx(
271
            $this->createMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'),
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...\CredentialsInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Cons...r\CredentialsInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
272
            $client,
0 ignored issues
show
Documentation introduced by
$client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Http\Client\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
273
            $storage,
0 ignored issues
show
Documentation introduced by
$storage is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\Common\Stor...\TokenStorageInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
274
            $this->createMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')
0 ignored issues
show
Documentation introduced by
$this->createMock('\\OAu...e\\SignatureInterface') is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<OAuth\OAuth1\Signature\SignatureInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
275
        );
276
277
        self::assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token));
0 ignored issues
show
Documentation introduced by
$token is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a string|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
278
    }
279
}
280