Skip to content

Commit

Permalink
php8.3 + symfony 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mathielen committed Mar 14, 2024
1 parent 0820d41 commit 1896ffb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
}
],
"require": {
"php": "^7.4",
"symfony/form": "~3.4|~4.0",
"symfony/http-foundation": "~3.4|~4.0",
"beberlei/assert": "@stable",
"doctrine/collections": "^1.4"
"php": "^8.0",
"symfony/form": "~5.4",
"symfony/http-foundation": "~5.4",
"beberlei/assert": "^3.3.2"
},
"require-dev": {
"phpunit/phpunit": "@stable"
Expand Down
13 changes: 7 additions & 6 deletions src/Mathielen/SapOci/Model/OciBasket.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

namespace Mathielen\SapOci\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Assert\Assertion;

class OciBasket implements OciBasketInterface
{
private Collection $items;
private array $items;

public function __construct(Collection $items = null)
public function __construct(array $items = [])
{
$this->items = $items ?: new ArrayCollection();
Assertion::allIsInstanceOf($items, OciBasketItemInterface::class);

$this->items = $items;
}

public function getItems(): Collection
public function getItems(): iterable
{
return $this->items;
}
Expand Down
8 changes: 5 additions & 3 deletions src/Mathielen/SapOci/Model/OciBasketInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Mathielen\SapOci\Model;

use Doctrine\Common\Collections\Collection;

interface OciBasketInterface
{
public function getItems(): Collection;

/**
* @return OciBasketItemInterface[]
*/
public function getItems(): iterable;
}
2 changes: 1 addition & 1 deletion src/Mathielen/SapOci/OciFormbuilderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function factor(OciBasketInterface $basket): FormBuilderInterface

$formBuilder = $this
->formFactory
->createNamedBuilder(null, FormType::class, $formData, $this->defaultFormOptions);
->createNamedBuilder('default', FormType::class, $formData, $this->defaultFormOptions);

foreach (\array_keys($formData) as $formFieldName) {
$this->addFormField($formBuilder, $formFieldName);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Mathielen/SapOci/Model/OciModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testConstraints($methodName): void
$this->assertTrue(true); //all good
}

public function getConstraintedMethodnames()
public static function getConstraintedMethodnames(): iterable
{
$rfl = new \ReflectionClass(Oci50BasketItem::class);

Expand Down

0 comments on commit 1896ffb

Please sign in to comment.