fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled
Some checks failed
Deploy Application / deploy (push) Has been cancelled
This commit is contained in:
@@ -272,6 +272,105 @@ final readonly class Url
|
||||
|
||||
---
|
||||
|
||||
## ✅ Clone With Syntax (Relevantes Feature)
|
||||
|
||||
### Clone With für State-Objekte
|
||||
|
||||
PHP 8.5 führt die `clone()` Funktion mit Property-Überschreibung ein, die perfekt für immutable State-Objekte geeignet ist.
|
||||
|
||||
**Syntax:**
|
||||
```php
|
||||
$newState = clone($state, ['property' => $value]);
|
||||
```
|
||||
|
||||
**Framework Integration:**
|
||||
|
||||
Die `clone with` Syntax wurde erfolgreich in alle LiveComponent State-Objekte integriert:
|
||||
|
||||
```php
|
||||
// Vorher (PHP 8.4):
|
||||
public function withCount(int $count): self
|
||||
{
|
||||
return new self(
|
||||
count: $count,
|
||||
lastUpdate: $this->lastUpdate,
|
||||
renderCount: $this->renderCount
|
||||
);
|
||||
}
|
||||
|
||||
// Nachher (PHP 8.5):
|
||||
public function withCount(int $count): self
|
||||
{
|
||||
return clone($this, ['count' => $count]);
|
||||
}
|
||||
```
|
||||
|
||||
**Vorteile:**
|
||||
- ✅ Reduziert Boilerplate-Code um ~30-40%
|
||||
- ✅ Verbessert Lesbarkeit - klarer Intent
|
||||
- ✅ Funktioniert perfekt mit `readonly` Klassen
|
||||
- ✅ Type-Safety bleibt erhalten
|
||||
- ✅ Automatische Property-Kopie für unveränderte Properties
|
||||
|
||||
**Beispiele aus dem Framework:**
|
||||
|
||||
```php
|
||||
// Einfache Transformation
|
||||
public function withLastUpdate(string $timestamp): self
|
||||
{
|
||||
return clone($this, ['lastUpdate' => $timestamp]);
|
||||
}
|
||||
|
||||
// Mehrere Properties ändern
|
||||
public function increment(): self
|
||||
{
|
||||
return clone($this, [
|
||||
'count' => $this->count + 1,
|
||||
'lastUpdate' => date('H:i:s')
|
||||
]);
|
||||
}
|
||||
|
||||
// Mit berechneten Werten
|
||||
public function withSearchResults(string $query, array $results, float $executionTimeMs): self
|
||||
{
|
||||
return clone($this, [
|
||||
'query' => $query,
|
||||
'results' => $results,
|
||||
'resultCount' => $this->countResults($results),
|
||||
'executionTimeMs' => $executionTimeMs,
|
||||
'timestamp' => time()
|
||||
]);
|
||||
}
|
||||
```
|
||||
|
||||
**Wann explizite `new self()` besser ist:**
|
||||
|
||||
Für komplexe Array-Manipulationen kann die explizite Variante lesbarer bleiben:
|
||||
|
||||
```php
|
||||
// Komplexe Array-Manipulation - explizit bleibt lesbarer
|
||||
public function withTodoRemoved(string $todoId): self
|
||||
{
|
||||
$newTodos = array_filter(
|
||||
$this->todos,
|
||||
fn ($todo) => $todo['id'] !== $todoId
|
||||
);
|
||||
|
||||
return clone($this, ['todos' => array_values($newTodos)]);
|
||||
}
|
||||
```
|
||||
|
||||
**Migration Status:**
|
||||
- ✅ Phase 1: Alle einfachen Transformationen migriert (~80 Methoden)
|
||||
- ✅ Phase 2: Mittlere Transformationen migriert (~50 Methoden)
|
||||
- ⏭️ Phase 3: Komplexe Transformationen bleiben explizit (optional)
|
||||
|
||||
**Referenz:**
|
||||
- [PHP 8.5 Release Notes - Clone With](https://www.php.net/releases/8.5/en.php#clone-with)
|
||||
- [RFC: Clone with](https://wiki.php.net/rfc/clone_with)
|
||||
|
||||
---
|
||||
|
||||
## ❌ Nicht-Relevante Features
|
||||
|
||||
### Property Hooks (❌ Inkompatibel mit Framework)
|
||||
|
||||
Reference in New Issue
Block a user