Skip to content

Commit 84f8f82

Browse files
authored
feat!: support for Laravel 12 and PHP 8.4
feat!: support for Laravel 12 and PHP 8.4
2 parents 2baf91c + 8d0d433 commit 84f8f82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4175
-1307
lines changed

.cursor/development-guidelines.md

Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
# 🚀 AI-Assisted Development Guidelines
2+
3+
## 📋 Overview
4+
5+
This document provides guidelines for effective AI-assisted development based on real-world experience working on the Laravel Cycle ORM Adapter project. These practices help maintain code quality, consistency, and productivity when working with AI coding assistants.
6+
7+
## 🤖 Working with AI Assistants
8+
9+
### 🎯 Effective Prompting
10+
11+
#### **Do This:**
12+
13+
- **Be Specific**: Provide exact file paths, error messages, and context
14+
- **Show Examples**: Include code snippets, logs, or configuration files
15+
- **State Intent**: Clearly explain what you want to achieve
16+
- **Provide Context**: Share relevant background information about the project
17+
18+
#### **Avoid This:**
19+
20+
- Vague requests like "fix this" or "make it better"
21+
- Assuming the AI knows your project structure
22+
- Omitting error messages or logs
23+
- Making multiple unrelated requests in one prompt
24+
25+
### 📁 Context Management
26+
27+
```bash
28+
# Always provide file paths when discussing issues
29+
# ✅ Good: "In file `src/Bridge/Laravel/Providers/CycleServiceProvider.php` line 48..."
30+
# ❌ Bad: "In the service provider..."
31+
32+
# Share relevant configuration
33+
# ✅ Include: psalm.xml, composer.json, workflow files
34+
# ❌ Don't assume: AI knows your specific setup
35+
```
36+
37+
### 🔍 Debugging Approach
38+
39+
1. **Start with Error Analysis** 🐛
40+
- Share complete error messages
41+
- Include stack traces
42+
- Provide relevant log outputs
43+
44+
2. **Incremental Problem Solving** 🔧
45+
- Break complex issues into smaller parts
46+
- Test one fix at a time
47+
- Verify each solution before moving to the next
48+
49+
3. **Root Cause Investigation** 🔬
50+
- Don't just fix symptoms
51+
- Understand why issues occur
52+
- Research best practices and proven solutions
53+
54+
### 🐛 Community Issue Handling
55+
56+
#### **TDD Bug Fix Process**
57+
58+
1. **Analyze Issue** 🔍 — Understand root cause and impact
59+
2. **Create Failing Test** ❌ — Reproduce the exact problem
60+
3. **Implement Fix** 🔧 — Apply minimal solution with clear comments
61+
4. **Validate Fix** ✅ — Ensure test passes and no regressions
62+
5. **Commit with Attribution** 📝 — Credit contributor and link issue
63+
64+
#### **Attribution Best Practices**
65+
66+
```php
67+
// Fix #XXX: Brief explanation (@contributor-username)
68+
```
69+
70+
#### **Laravel Container Best Practices**
71+
72+
```php
73+
// ✅ Use proper Laravel container mechanisms
74+
$app->alias(InterfaceClass::class, ConcreteClass::class); // Alias for same instance
75+
$app->singleton(ConcreteClass::class, $factory); // Register singleton
76+
77+
// ❌ Avoid type mismatches and manual workarounds
78+
$app->bind(ConcreteClass::class, function ($app): ConcreteClass {
79+
return $app->get(InterfaceClass::class); // Type error!
80+
});
81+
```
82+
83+
#### **Commit Message Format for Bug Fixes**
84+
85+
```bash
86+
fix(scope): brief description
87+
88+
Fixes #XXX: Detailed explanation
89+
90+
🐛 Problem: [what was wrong]
91+
🔧 Solution: [what was changed]
92+
🧪 Testing: [how it was validated]
93+
94+
Thanks to @contributor-username for reporting and solution direction.
95+
96+
Closes #XXX
97+
```
98+
99+
## 💻 Code Quality Standards
100+
101+
### 🧪 Testing Philosophy
102+
103+
```bash
104+
# Run tests before and after changes
105+
make test # Unit tests
106+
make test-pgsql # PostgreSQL tests
107+
make test-mysql # MySQL tests
108+
make test-sqlserver # SQL Server tests
109+
110+
# Use specific test commands when debugging
111+
composer test # Direct composer command
112+
vendor/bin/pest # Direct test runner
113+
```
114+
115+
### 📊 Static Analysis
116+
117+
```bash
118+
# Always run static analysis tools
119+
make lint-stan # PHPStan analysis
120+
make lint-psalm # Psalm analysis
121+
make lint-php # PHP CS Fixer
122+
123+
# Handle tool-specific issues
124+
# Example: Suppress package-related false positives in psalm.xml
125+
```
126+
127+
### 🔧 Configuration Management
128+
129+
#### **Tool Configuration Best Practices:**
130+
131+
1. **Psalm Configuration** (`psalm.xml`):
132+
- Suppress unused code warnings for package development
133+
- Configure appropriate error levels
134+
- Exclude problematic files (like `rector.php` that import vendor configs)
135+
136+
2. **GitHub Actions** (`.github/workflows/`):
137+
- Use proven patterns from successful projects
138+
- Handle environment-specific requirements (like ODBC drivers)
139+
- Implement proper health checks and retries
140+
141+
3. **Docker Services**:
142+
- Use appropriate SQL Server editions (`Express` vs `Developer`)
143+
- Configure memory limits and feature flags
144+
- Implement comprehensive health checks
145+
146+
## 📝 Documentation Practices
147+
148+
### 📖 Keep Documentation Current
149+
150+
```markdown
151+
# ✅ Good compatibility matrix format
152+
| Laravel | Cycle ORM | Adapter |
153+
|----------------------|-----------|----------|
154+
| `^10.28` | `2.x` | `<4.9.0` |
155+
| `^10.28, 11.x` | `2.x` | `≥4.9.0` |
156+
| `^10.28, 11.x, 12.x` | `2.x` | `≥5.0.0` |
157+
```
158+
159+
### 🎨 Documentation Style
160+
161+
- Use emojis for visual organization 🎯
162+
- Provide clear examples and code snippets
163+
- Update README.md and docs simultaneously
164+
- Include rationale for decisions in commit messages
165+
166+
## 🔄 Git Workflow
167+
168+
### 📦 Conventional Commits
169+
170+
We follow [Conventional Commits](https://www.conventionalcommits.org/) specification:
171+
172+
```bash
173+
# Format: <type>(<scope>): <description>
174+
feat: add Laravel 12 support in v5.0.0
175+
fix: resolve SQL Server container initialization issues
176+
docs: update compatibility matrix for Laravel 12 support
177+
ci: improve ODBC driver installation for Ubuntu 24.04
178+
test: add comprehensive SQL Server connection verification
179+
```
180+
181+
#### **Commit Types:**
182+
183+
- `feat` 🆕 — New features
184+
- `fix` 🐛 — Bug fixes
185+
- `docs` 📖 — Documentation changes
186+
- `ci` 🔧 — CI/CD improvements
187+
- `test` 🧪 — Testing improvements
188+
- `refactor` ♻️ — Code refactoring
189+
- `perf` ⚡ — Performance improvements
190+
- `chore` 🧹 — Maintenance tasks
191+
192+
### 📋 Commit Best Practices
193+
194+
#### **Good Commit Messages:**
195+
196+
```bash
197+
fix: exclude rector.php from psalm analysis to prevent crashes
198+
199+
The rector.php file imports external vendor configurations which causes
200+
psalm to crash with exit code 255, especially on PHP 8.4. By removing
201+
rector.php from psalm's projectFiles configuration, psalm can complete
202+
successfully.
203+
```
204+
205+
#### ❌ **Poor Commit Messages:**
206+
207+
```bash
208+
fix stuff
209+
update config
210+
wip
211+
```
212+
213+
## 🛠️ Tool-Specific Guidelines
214+
215+
### 🔍 Psalm Configuration
216+
217+
```xml
218+
<!-- Suppress package-related unused code warnings -->
219+
<issueHandlers>
220+
<UnusedClass>
221+
<errorLevel type="suppress">
222+
<directory name="src/"/>
223+
</errorLevel>
224+
</UnusedClass>
225+
<PossiblyUnusedMethod>
226+
<errorLevel type="suppress">
227+
<directory name="src/"/>
228+
</errorLevel>
229+
</PossiblyUnusedMethod>
230+
</issueHandlers>
231+
```
232+
233+
### 🐳 Docker & CI/CD
234+
235+
#### **SQL Server in GitHub Actions:**
236+
237+
```yaml
238+
# Use dynamic Ubuntu version detection
239+
UBUNTU_VERSION=$(lsb_release -rs 2>/dev/null || echo "24.04")
240+
241+
# Install required ODBC drivers
242+
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev
243+
244+
# Use appropriate SQL Server configuration
245+
MSSQL_PID: 'Express' # More stable than Developer in CI
246+
MSSQL_MEMORY_LIMIT_MB: '2048' # Explicit memory limit
247+
MSSQL_ENABLE_HADR: '0' # Disable unnecessary features
248+
```
249+
250+
### 📊 Testing Strategy
251+
252+
```bash
253+
# Layer testing approach
254+
make test # Fast unit tests
255+
make test-pgsql # Integration with PostgreSQL
256+
make test-mysql # Integration with MySQL
257+
make test-sqlserver # Integration with SQL Server
258+
259+
# Database-specific testing
260+
DB_CONNECTION=sqlserver make test # Environment-specific
261+
composer test:sqlserver # Direct composer command
262+
```
263+
264+
## 🚨 Common Issues & Solutions
265+
266+
### 🐛 **Psalm Exit Code 255**
267+
268+
**Problem**: Psalm crashes when analyzing rector.php
269+
**Solution**: Exclude rector.php from psalm.xml projectFiles
270+
271+
### 🔌 **SQL Server Connection Issues**
272+
273+
**Problem**: PDO requires Microsoft ODBC Driver
274+
**Solution**: Install msodbcsql18, mssql-tools18, unixodbc-dev
275+
276+
### 📦 **Package Unused Code Warnings**
277+
278+
**Problem**: Psalm reports false positives for unused classes/methods
279+
**Solution**: Suppress warnings for src/ directory in package development
280+
281+
### 🐧 **Ubuntu Version Mismatch**
282+
283+
**Problem**: Wrong package repository for ubuntu-latest (24.04)
284+
**Solution**: Use `$(lsb_release -rs)` for dynamic detection
285+
286+
## 🎯 Best Practices Summary
287+
288+
### 🏗️ **Development Workflow**
289+
290+
1. **Plan First** 📋 — Break complex tasks into smaller steps
291+
2. **Test Early** 🧪 — Run tests before making changes
292+
3. **Commit Often** 💾 — Small, focused commits with clear messages
293+
4. **Document Changes** 📖 — Update docs alongside code changes
294+
5. **Verify Quality** ✅ — Run all linting and static analysis tools
295+
296+
### 🤝 **AI Collaboration**
297+
298+
1. **Provide Context** 🎯 — Share relevant files and error messages
299+
2. **Be Specific** 📝 — Clear, actionable requests
300+
3. **Iterate Incrementally** 🔄 — One problem at a time
301+
4. **Verify Solutions** ✅ — Test AI suggestions before applying
302+
5. **Document Learnings** 📚 — Update guidelines based on experience
303+
304+
### 🔧 **Tool Configuration**
305+
306+
1. **Research Proven Patterns** 🔍 — Study successful projects
307+
2. **Handle Edge Cases** ⚠️ — Environment-specific requirements
308+
3. **Maintain Compatibility** 🔄 — Support multiple versions when possible
309+
4. **Document Decisions** 📝 — Explain complex configurations
310+
5. **Regular Updates** 🔄 — Keep tools and dependencies current
311+
312+
---
313+
314+
## 📞 Need Help?
315+
316+
- 📖 Check [Contributing Guidelines](../docs/pages/contributing.mdx)
317+
- 🐛 [Report Issues](https://github.com/wayofdev/laravel-cycle-orm-adapter/issues)
318+
- 💬 [Discord Community](https://discord.gg/CE3TcCC5vr)
319+
- 📧 [Email Support](mailto:[email protected])
320+
321+
---
322+
323+
*Generated from real development experience on the Laravel Cycle ORM Adapter project* ✨

0 commit comments

Comments
 (0)