Carsten Windler - Plan A
International PHP Conference 2023/10/24
Carsten Windler
Principal Engineer @
https://www.linkedin.com/in/cwindler
https://carstenwindler.de
https://plana.earth
https://www.pexels.com/photo/white-ruled-paper-99562/
class Vat
{
private float $vat = 0.19;
public function getVat(): int
{
return $this->vat;
}
}
class OrderPosition
{
public function getGrossPrice(float $netPrice): float
{
$vatModel = new Vat();
$vat = $vatModel->getVat();
return $netPrice * (1 + $vat);
}
}
$orderPosition = new OrderPosition();
echo $orderPosition->getGrossPrice(100);
class ExampleClass
{
public function loadData(int $id): void
{
$user = User::find($id);
$test = new Order();
$order = $test->find($id);
// ....
}
}
👉 Automate!
{
"config": {
"fail-on-first-error": true
},
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "vendor/bin/php-cs-fixer fix --dry-run"
},
{
"action": "vendor/bin/phpstan"
}
]
}
}
parameters:
ignoreErrors:
-
message: "#^Method Vat\\:\\:getVat\\(\\) should return int but returns float\\.$#"
count: 1
path: phpstan/example.php
https://www.pexels.com/photo/empty-photo-frame-hanging-above-cabinet-in-light-room-6373506/
This is a great book!
⭐⭐⭐⭐⭐
- Carsten W.
👉 Buy it on Amazon 👈
As an AI, I am not allowed
to write fake book reviews
⭐⭐⭐⭐⭐⭐⭐
- Chad Geepety
Carsten Windler
PHP Insights
👉 somewhere between static code analysis and metrics
PHP Depend
👉 crazy number crunching