Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Libero/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<property name="fixable" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
Expand Down
39 changes: 39 additions & 0 deletions tests/cases/classes/constant-late-static-binding
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---DESCRIPTION---
Late-static binding must not be used for constants
---FILENAME---
Foo.php
---CONTENTS---
<?php

declare(strict_types=1);

namespace Vendor;

class Foo
{
public const BAR = 'baz';

public function __construct()
{
echo static::BAR;
}
}

---FIXED---
<?php

declare(strict_types=1);

namespace Vendor;

class Foo
{
public const BAR = 'baz';

public function __construct()
{
echo self::BAR;
}
}

---