GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c24b9a...c8d4f0 )
by Freek
06:04 queued 04:29
created

Listener::__wakeup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Spatie\Once;
4
5
class Listener
6
{
7
    /** @var bool */
8
    private $hasBeenSerialized = false;
9
10
    public function __construct($object)
11
    {
12
        $this->objectHash = spl_object_hash($object);
0 ignored issues
show
Bug introduced by
The property objectHash does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
    }
14
15
    public function __destruct()
16
    {
17
        if (! $this->hasBeenSerialized) {
18
            Cache::forget($this->objectHash);
19
        }
20
    }
21
22
    public function __wakeup()
23
    {
24
        $this->hasBeenSerialized = true;
25
    }
26
}
27