Passed
Push — v3 ( 1e51d3...178405 )
by Andrew
25:46
created

m210817_230853_announcement_v3_4::safeDown()   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
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace nystudio107\seomatic\migrations;
4
5
use Craft;
6
use craft\db\Migration;
7
8
/**
9
 * m210817_230853_announcement_v3_4 migration.
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
11
class m210817_230853_announcement_v3_4 extends Migration
0 ignored issues
show
Coding Style introduced by
Class name is not valid; consider M210817_230853_Announcement_V3_4 instead
Loading history...
Coding Style introduced by
Class name must begin with a capital letter
Loading history...
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    public function safeUp()
17
    {
18
        if (version_compare(Craft::$app->getVersion(), '3.7', '>=')) {
19
            Craft::$app->announcements->push(
0 ignored issues
show
Bug introduced by
The method push() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
            Craft::$app->announcements->/** @scrutinizer ignore-call */ 
20
                                        push(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
                function ($language) {
21
                    return Craft::t('seomatic', 'SEO Settings fields', [], $language);
22
                },
23
                function ($language) {
24
                    return Craft::t('seomatic', 'The [SEO Settings]({url}) fields now feature **Override** light switches next to each setting, letting you explicitly override SEO settings on a per-entry basis.', [
25
                        'url' => 'https://nystudio107.com/docs/seomatic/fields.html',
26
                    ], $language);
27
                },
28
                'seomatic'
29
            );
30
        }
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function safeDown()
37
    {
38
        echo "m210817_230853_announcement_v3_4 cannot be reverted.\n";
39
        return false;
40
    }
41
}
42