Skip to content

Commit

Permalink
DOC Do not use self
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 5, 2024
1 parent 0e3245c commit 3be11fb
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ PHPDocs are not only useful when looking at the source code, but are also used i
- Prefer the identical `===` operator over the equality `==` operator for comparisons.
- If you directly reference a third-party dependency in code, then ensure the dependency is required in the module's `composer.json` file.
- Avoid hardcoding values when there is a method available to dynamically get a value, for example use [`DataObjectSchema::tableName()`](api:SilverStripe\ORM\DataObjectSchema::tableName()) to get the table name for a `DataObject` model rather than hard coding it.
- Do not use the `self` keyword, e.g. `self::myMethod()` instead use the short-name of the current class e.g. `MyClass::myMethod()` which is functionally equivalent. This avoids a specific class of bug that is introduced when using late static binding downstream from `self`. Note that use of the `static` keyword is perfectly OK.

0 comments on commit 3be11fb

Please sign in to comment.