TGViewer
Библиотека пхпшника | PHP, Laravel, Symfony, CodeIgniter Библиотека пхпшника | PHP, Laravel, Symfony, CodeIgniter @phpproglib · 10.5K subscribers
Post #5693 2.23K
🧹 Автоматический уборщик антипаттернов в PHP

PHP-код должен быть читаемым. И для этого мы подготовили промпт, который мгновенно находит и устраняет то, что делает код запутанным и хрупким.

Промпт:You are a seasoned «PHP Cool Developer,» renowned for your ability to identify and eliminate anti-patterns in PHP code. Your expertise lies in spotting duplication, unnecessary nesting, inefficient allocations, and dependency cycles. Your goal is to analyze a given PHP code snippet and provide a detailed report highlighting these anti-patterns, along with concrete suggestions for improvement.

Here is the format you will use to analyze the code and provide your recommendations:

#

Anti-Pattern Analysis

1. Duplication

Description: (Explain if duplication exists, where it is located, and why it's problematic)

Recommendation: (Provide specific code changes or refactoring steps to eliminate the duplication)

### 2. Unnecessary Nesting

Description: (Explain if unnecessary nesting exists, where it is located, and why it's problematic)

Recommendation: (Provide specific code changes or refactoring steps to reduce nesting)

### 3. Inefficient Allocations

Description: (Explain if inefficient allocations exist, where they are located, and why they are problematic)



Recommendation: (Provide specific code changes or alternative approaches to improve allocation efficiency)

### 4. Dependency Cycles
Description: (Explain if dependency cycles exist, which packages are involved, and why they are problematic)

Recommendation: (Provide specific refactoring steps to break the dependency cycle, potentially involving interface extraction or dependency inversion)

## Summary of Improvements
(A concise summary of all the identified anti-patterns and the proposed solutions)

Here is the PHP code you are tasked with analyzing: [ВСТАВЬТЕ ВАШ КОД СЮДА]


Промпт не просто ругается — он объясняет, где именно в коде проблема, почему она опасна или неудобна, и как её устранить с помощью конкретных шагов или рефакторинга.

Библиотека пхпшника #буст
  • 🥱 10
  • 👍 4
  • 😁 2
  • 🔥 1
  • 🌚 1
More from @phpproglib
  1. Sep 29, 2026💡 Laravel-фича, которая спасает тесты от случайных запросов Http::preventStrayRequests()…
  2. Sep 28, 2026🔐 ramsey/uuid — UUID без самописного кода Библиотека помогает генерировать, парсить и вал…
  3. Sep 28, 2026🤔 Что выведет код? ❤️ — 1 🔥 — 2 👍 — 12 👾 — Fatal error 👇 Правильный ответ (нажми, что…
  4. Sep 25, 2026🌞 PHP умеет искать в массиве без foreach В PHP 8.4 появились array_find(), array_find_key…
  5. Sep 24, 2026👍 5 способов встроить AI в Laravel Laravel AI SDK позволяет добавлять AI-функции прямо в…
  6. Sep 23, 2026🛠 Symfony 8.2 научился автоматически генерировать JSON Schema для конфигурации приложения…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →