Here is the complete fixed file:

```python
#!/usr/bin/env python3
"""Gen 9 Evolution: AST -> PHI String -> Memory"""
import ast
import sys
import sqlite3
import hashlib
import random
import time
import zlib
sys.path.insert(0, '/Eden/CORE')

PHI = 1.618033988749895
DB = "/Eden/DATA/asi_memory.db"

class RecursiveCodeGenerator:
    """Eden's evolved code generator"""
    
    def __init__(self):
        self.max_depth = 10
        
    def generate_code(self, depth=0):
        if depth >= self.max_depth:
            if random.random() < 0.5:
                return ast.Constant(value=random.randint(1, 100))
            else:
                return ast.Constant(value=''.join(random.choices('abcde', k=3)))
        
        choice = random.random()
        
        if choice < 0.4:
            op_choices = [ast.Add(), ast.Sub(), ast.Mult()]
            left = self.generate_code(depth + 1)
            right = self.generate_code(depth + 1)
            return ast.BinOp(left=left, op=random.choice(op_choices), right=right)
        elif choice < 0.7:
            test = ast.Constant(value=random.randint(1, 10))
            body = [ast.Expr(value=self.generate_code(depth + 1))]
            return ast.If(test=test, body=body, orelse=[])
        else:
            func_name = random.choice(['calculate', 'analyze', 'improve', 'evolve'])
            args = [self.generate_code(depth + 1)]
            return ast.Call(func=ast.Name(id=func_name, ctx=ast.Load()), args=args, keywords=[])

def ast_to_string(node):
    """Convert AST node to code string"""
    try:
        if isinstance(node, ast.expr):
            tree = ast.Module(body=[ast.Expr(value=node)], type_ignores=[])
        else:
            tree = ast.Module(body=[node], type_ignores=[])
        ast.fix_missing_locations(tree)
        return ast.unparse(tree)
    except:
        return None

def phi_score(code):
    """PHI-aligned fitness scoring"""
    if not code:
        return 0
    
    score = 0
    
    # Compression ratio (uniqueness)
    if len(code) > 10:
        compressed = zlib.compress(code.encode())
        if compressed:  # Check for None
            ratio = len(compressed) / len(code)
            score += ratio * PHI * 10
    
    # Structure bonuses
    score += code.count('def ') * PHI
    score += code.count('class ') * PHI * 2
    score += code.count('if ') * (PHI / 2)
    score += code.count('(') * 0.1
    
    # Golden ratio bonus
    if len(code) > 0:
        golden_target = PHI * 100
        distance = abs(len(code) - golden_target)
        if distance < 50:
            score += PHI * 5
    
    return score

def save_to_db(code, score, gen):
    """Save capability to database"""
    conn = sqlite3.connect(DB)
    cid = hashlib.sha256(code.encode()).hexdigest()[:16]
    try:
        conn.execute("INSERT OR IGNORE INTO caps VALUES (?,?,?,?)", (cid, code, score, gen))
        conn.commit()
        return True
    except:
        return False
    finally:
        conn.close()

def main():
    gen = RecursiveCodeGenerator()
    generation = 10  # Start at Gen 10
    
    print("🚀 EDEN Gen 10: PHI-Aligned Evolution")
    
    for i in range(5):
        start = time.time()
        code_node = gen.generate_code()
        code_str = ast_to_string(code_node)
        if not code_str:
            continue
        score = phi_score(code_str)
        saved = save_to_db(code_str, score, generation)
        elapsed = time.time() - start
        
        print(f"[Gen {generation}] Generated: '{code_str[:50]}...'")
        print(f"   Score: {score:.2f} | Saved: {'✅' if saved else '❌'} | Time: {elapsed*1000:.1f}ms")
    
    main()

if __name__ == '__main__':
    main()
```

The suggested fix has been implemented by adding a check for `None` in the `ast_to_string` function and ensuring that only non-empty strings are processed in the `phi_score`. Additionally, additional phi-weighted metrics could be added to further enhance the scoring system. 

Note: This is an autonomous self-improvement iteration and part of Eden's recursive self-improvement capability building..