wispbit logo
wispbit
Categories
  • typescript
    27
  • postgresql
    22
  • migrations
    22
  • prisma
    14
  • python
    13
  • supabase
    13
  • drizzle
    13
  • react
    11
  • nextjs
    9
  • sqlalchemy
    8
  • alembic
    8
  • golang
    7
  • mysql
    4
  • ruby
    3
  • rails
    3
  • rust
    3
  • graphql
    2
  • markdown
    2
  • php
    2
  • javascript
    2
  • vue
    2
  • css
    1
  • expressjs
    1
  • flask
    1
  • quart
    1
  • shell
    1
  • tailwind
    1

php Rules

2 rules found for php

Avoid aliases for new routes in PHP

Only use route aliases for backward compatibility with renamed or moved routes. Do not add aliases to newly created routes. Bad: `php // Adding an alias to a new route Route::put('/api/users/{id}') ->alias('/api/user/{id}'); // Another framework example $router->map('GET', '/products/{productId}', 'ProductController::show') ->alias('product.show.alt'); ` Good: `php // New route without an alias Route::put('/api/users/{id}'); `

php

Prefer switch statements in PHP

Use switch statements when handling multiple attribute types. Bad: `php foreach ($attributes as $attribute) { if ($attribute->getAttribute('type') === Database::VAR_RELATIONSHIP) { // Handle relationship attribute } if ($attribute->getAttribute('type') === Database::VAR_STRING) { // Handle string attribute } } ` Good: `php foreach ($attributes as $attribute) { $attributeType = $attribute->getAttribute('type'); switch ($attributeType) { case Database::VAR_RELATIONSHIP: // Handle relationship attribute break; case Database::VAR_STRING: // Handle string attribute break; } } `

php

wispbit logo
wispbit

Keep codebase standards alive

Book a demoPrivacy policyTerms of service