import os
import re

base = r"C:\xampp\htdocs\New_Stram_Site_web\src\Entity"

for filename in os.listdir(base):
    if not filename.endswith('.php'):
        continue
    filepath = os.path.join(base, filename)
    
    with open(filepath, 'r', encoding='utf-8') as f:
        content = f.read()
    
    if not content.strip():
        print(f"SKIP (empty): {filename}")
        continue
    
    original = content
    
    # Fix: "nullable: true, length: 600, nullable: true" -> "length: 600, nullable: true"
    content = re.sub(r'nullable: true, (length: \d+), nullable: true', r'\1, nullable: true', content)
    
    # Fix: "nullable: true, length: 255, nullable: true" -> already covered above
    
    if content != original:
        with open(filepath, 'w', encoding='utf-8') as f:
            f.write(content)
        print(f"FIXED: {filename}")
    else:
        print(f"OK: {filename}")

print("\nDone fixing annotations.")
