Skip to content

Commit

Permalink
Add upgrade instructions (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Makarov <sam@rmcreative.ru>
  • Loading branch information
rustamwin and samdark committed Jan 22, 2023
1 parent 1b38504 commit e3edabd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions UPGRADE.md
@@ -0,0 +1,42 @@
# Upgrading Instructions for Yii Widget

### !!!IMPORTANT!!!

The following upgrading instructions are cumulative. That is,
if you want to upgrade from version A to version C and there is
version B between A and C, you need to following the instructions
for both A and B.

## Upgrade from 1.x

* `beforeRun`, `afterRun` and `run` methods have been removed from the `Widget` class, and only the `render` method
can now be used, so you may need to make some changes. For example:
```php
protected function beforeRun(): bool
{
//...
return true;
}

protected function afterRun(string $result): string
{
//...
return $result;
}

protected function run(): string
{
//...
return $content;
}
```
will be:
```php
public function render(): string|\Stringable
{
// "beforeRun" stuff
// "run" stuff
// "afterRun" stuff
return $result;
}
```

0 comments on commit e3edabd

Please sign in to comment.