wispbit logo
wispbit
Early Access
  • Rules
    new!
  • Blog
  • Pricing
Categories
  • typescript
    22
  • postgresql
    15
  • migrations
    15
  • drizzle
    9
  • python
    8
  • nextjs
    8
  • react
    7
  • sqlalchemy
    6
  • alembic
    6
  • mysql
    4
  • markdown
    2
  • php
    2
  • rust
    2
  • javascript
    2
  • vue
    2
  • css
    1
  • expressjs
    1
  • flask
    1
  • quart
    1
  • golang
    1
  • graphql
    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
Privacy policyTerms of serviceBook a demo