Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

[BE] to be defined #6

Open
mstaack opened this issue Jan 8, 2020 · 1 comment
Open

[BE] to be defined #6

mstaack opened this issue Jan 8, 2020 · 1 comment
Assignees
Labels

Comments

@mstaack
Copy link
Member

mstaack commented Jan 8, 2020

to be defined

  • Test Annotation
    • Using data providers needs the notation at the bottom
/** @test */
public function it_does_sth()

// VS

/**
 * @test
 */
public function it_does_sth()
  • action naming
    • AttachModelToRelationAction vs AttachModelToRelationAction
    • class naming says SHOULD suffix - but actions are very special classes as they are more like functions.
  • pivot accessor
    • pivot vs attribute_category
    • MUST use pivot table name as accessor
  • PSR-12 - single use statements
  • abort() & throw() helper
@Gummibeer Gummibeer changed the title Import FQN Standard Definition To be defined collection Jan 8, 2020
@Gummibeer Gummibeer changed the title To be defined collection [BE] To be defined collection Jan 8, 2020
@Gummibeer Gummibeer added the php label Jan 8, 2020
@elbgoods elbgoods deleted a comment from mstaack Jan 8, 2020
@Gummibeer
Copy link
Contributor

Gummibeer commented Feb 5, 2020

2020-02-05 - #11 & #12

  • Import FQN Standard Definition - use statt FQCN im code
    • \Closure vs use Closure
    • notice: fully qualified namespace in code sometimes have a usage to prevent the aliasing rabbithole (hello Client::class)

MUST all classes referenced in code will be imported use and classes with common name conflicts will get aliased use Guzzle\Client as GuzzleClient

SHOULD use the explicit keywords if, throw, return over Laravel short helpers.

  • Dynamic "const" methods - UPPER_SNAKE_CASE
    • Image::PATH_PATTERN() vs Image::getPathPattern() - the pattern is generated by config values (function calls) but is something like a constant.

MUST use normal method naming also for macro/const like methods.

every solution has a right for existence/usage - this rule will be removed and all three ways are allowed.

  • Explicity over magic
    • protected $with => with() & load()
    • protected $appends => resource

MUST use explicit calls in query builder and resources to generate arrays

SHOULD be used from time to time

  • inverted instance of checking
    • ! $object instanceof MyClass => ! is_a()

SHOULD use ! is_a() for inverted instance checking and can use both for normal instance checking

  • test case method naming (@eisfeuer ?)
    • index_returns_an_ok_response

SHOULD use [entity:it]_can_[do_something]{_when_[some_condition]} naming pattern

SHOULD use name() on groups that have a prefix() call

  • compact() vs explicit array definition
    • route('api.admin.attribute_groups.destroy', ['attributeGroup' => $attributeGroup]);
    • route('api.admin.attribute_groups.destroy', compact('attributeGroup'));

MUST use explicit array definition in business logic app/
SHOULD use compact() in phpunit test route() generation

MUST respect Array Keys rule - lower_snake_case.dot.notation

  • enum naming - lowerCamel, lower_snake, UPPER_SNAKE, UpperCamel ...

MUST use UPPER_SNAKE_CASE for enum naming

  • DB standard

MUST use postgresql for SQL based databases also for prototypes

@Gummibeer Gummibeer changed the title [BE] To be defined collection [BE] to be defined Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants