Skip to content

Commit

Permalink
bug #36162 [Profiler] Fix profiler nullable string type (mRoca)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.0 branch.

Discussion
----------

[Profiler] Fix profiler nullable string type

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | -

This PR fixes nullable string types in setter for the Profile class.

The detected issue comes from [the Profiler class](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L149) :

```php
$profile->setIp($request->getClientIp()); // string or null
```

The corresponding return types for the Profile getters are allready good:
```php
    /**
     * Returns the IP.
     *
     * @return string|null The IP
     */
    public function getIp()
    {
        return $this->ip;
    }
```

Commits
-------

b5d4061 Fix profiler nullable string type
  • Loading branch information
fabpot committed Apr 21, 2020
2 parents ebc90fb + b5d4061 commit 22f1076
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpKernel/Profiler/Profile.php
Expand Up @@ -101,7 +101,7 @@ public function getIp()
return $this->ip;
}

public function setIp(string $ip)
public function setIp(?string $ip)
{
$this->ip = $ip;
}
Expand Down Expand Up @@ -131,7 +131,7 @@ public function getUrl()
return $this->url;
}

public function setUrl(string $url)
public function setUrl(?string $url)
{
$this->url = $url;
}
Expand Down

0 comments on commit 22f1076

Please sign in to comment.