GildedRose-Refactoring-Kata/php/fixtures/texttest_fixture.php
Pen-y-Fan 081c69b864 Bump to PHP 8.0+
PHP 7.4 was end of life November 2022, it's time to bump to PHP 8 standard 🎉

- updated starting code to PHP 8 standard
- upgraded tooling (code quality, static analysis) to the latest versions
- tested with PHP 8.0, 8.1 and 8.2
   - the fixture is working
   - the example test is failing, as expected
   - code quality is as expected
   - static analysis is ok
2023-01-07 17:19:35 +00:00

41 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use GildedRose\GildedRose;
use GildedRose\Item;
echo 'OMGHAI!' . PHP_EOL;
$items = [
new Item('+5 Dexterity Vest', 10, 20),
new Item('Aged Brie', 2, 0),
new Item('Elixir of the Mongoose', 5, 7),
new Item('Sulfuras, Hand of Ragnaros', 0, 80),
new Item('Sulfuras, Hand of Ragnaros', -1, 80),
new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
// this conjured item does not work properly yet
new Item('Conjured Mana Cake', 3, 6),
];
$app = new GildedRose($items);
$days = 2;
if ((is_countable($argv) ? count($argv) : 0) > 1) {
$days = (int) $argv[1];
}
for ($i = 0; $i < $days; $i++) {
echo "-------- day ${i} --------" . PHP_EOL;
echo 'name, sellIn, quality' . PHP_EOL;
foreach ($items as $item) {
echo $item . PHP_EOL;
}
echo PHP_EOL;
$app->updateQuality();
}