-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation about PHP 7.1 migration
- Loading branch information
1 parent
3725535
commit c76f868
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# UPGRADE FROM 3.x to 4.0 | ||
|
||
The major change in version 4.0 is the full migration to PHP 7.1. It has an impact on interface implementations. | ||
|
||
## Types are explicit | ||
|
||
From now on, all types are explicits in method signatures. It has an impact on classes that implements : | ||
|
||
- \FeedIo\FeedInterface | ||
- \FeedIo\Feed\ItemInterface | ||
- \FeedIo\Feed\NodeInterface | ||
- \FeedIo\Feed\ElementsAwareInterface | ||
- \FeedIo\Feed\Item\AuthorInterface | ||
- \FeedIo\Feed\Item\MediaInterface | ||
- \FeedIo\Feed\Node\CategoryInterface | ||
- \FeedIo\Feed\Node\ElementInterface | ||
|
||
For instance, `FeedIo\FeedInterface::setUrl($url)` becomes : | ||
|
||
```php | ||
/** | ||
* @param string $url | ||
* @return FeedInterface | ||
*/ | ||
public function setUrl(string $url) : FeedInterface; | ||
``` | ||
As a consequence, you need to adapt any class that implements `FeedIo\FeedInterface` according to the new signature : | ||
|
||
```php | ||
/** | ||
* @param string $url | ||
* @return FeedInterface | ||
*/ | ||
public function setUrl($url) | ||
{ | ||
$this->url = $url; | ||
|
||
return $this; | ||
} | ||
``` | ||
becomes : | ||
|
||
```php | ||
/** | ||
* @param string $url | ||
* @return FeedInterface | ||
*/ | ||
public function setUrl(string $url) : FeedInterface | ||
{ | ||
$this->url = $url; | ||
|
||
return $this; | ||
} | ||
``` | ||
You should refer to the new interfaces declaration to get the full list of concerned functions. |