Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @keichinger @jesko-plitt
* @rafaelsouzaf @mangoischke
13 changes: 9 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-versions }} Testing
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -22,11 +22,16 @@ jobs:
- name: Composer Install
run: composer install

- name: Configure Composer Plugin Permissions
run: |
composer config allow-plugins.bamarni/composer-bin-plugin true
composer config allow-plugins.ergebnis/composer-normalize true

- name: Composer Plugins
run: composer global require ergebnis/composer-normalize bamarni/composer-bin-plugin php-coveralls/php-coveralls --no-interaction --prefer-dist --no-progress --no-suggest --no-suggest
run: composer require --dev ergebnis/composer-normalize bamarni/composer-bin-plugin --no-interaction --prefer-dist --no-progress

- name: Composer Vendor-Bin Dependencies
run: composer bin all install --no-interaction --prefer-dist --no-progress --no-suggest
run: composer bin all install --no-interaction --prefer-dist --no-progress

- name: Create Build Logs Directory
run: mkdir -p build/logs
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
9.0.0
=====

* (breaking) Minimum PHP version increased to 8.1.
* (breaking) All Doctrine ORM annotations converted to PHP 8 attributes.


8.6.1
=====

Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
8.x to 9.0
==========

* The minimum PHP version has been increased from **7.4** to **8.1**.
* All Doctrine ORM annotations have been converted to PHP 8 attributes.


7.x to 8.0
==========

Expand Down
30 changes: 17 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
],
"homepage": "https://github.com/Becklyn/rad",
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-json": "*",
"beberlei/doctrineextensions": "^1.3.0",
"becklyn/rad-bundles": "^1.1.0",
"doctrine/doctrine-bundle": "^2.3.2",
"doctrine/orm": "^2.10.3",
"doctrine/doctrine-bundle": "^2.5.6",
"doctrine/orm": "^2.11.1",
"psr/log": "^1.1.4",
"scienta/doctrine-json-functions": "^4.5.0 || ^5.0.0",
"symfony/config": "^5.4.3 || ^6.0.3",
"symfony/dependency-injection": "^5.4.3 || ^6.0.3",
"symfony/form": "^5.4.3 || ^6.0.3",
"symfony/http-kernel": "^5.4.3 || ^6.0.4",
"symfony/property-access": "^5.4.3 || ^6.0.3",
"symfony/translation-contracts": "^v2.5.0 || ^v3.0.0",
"symfony/validator": "^5.4.3 || ^6.0.3",
"twig/twig": "^v3.3.4"
"symfony/config": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/form": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/property-access": "^6.4",
"symfony/translation-contracts": "^3.0.0",
"symfony/validator": "^6.4",
"twig/twig": "^3.3.8"
},
"require-dev": {
"algolia/search-bundle": "^5.2.1 || ^6.0.0",
"roave/security-advisories": "dev-master",
"symfony/phpunit-bridge": "^5.4.3 || ^6.0.3",
"symfony/twig-bridge": "^5.4.3 || ^6.0.3"
"symfony/phpunit-bridge": "^6.4",
"symfony/twig-bridge": "^6.4"
},
"conflict": {
"becklyn/rad-bundle": "*"
Expand All @@ -51,6 +51,10 @@
}
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"ergebnis/composer-normalize": true
},
"sort-packages": true
},
"extra": {
Expand Down
19 changes: 4 additions & 15 deletions src/Ajax/AjaxResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,9 @@
*/
class AjaxResponseBuilder
{
/** @var TranslatorInterface */
protected $translator;
protected bool $ok;

/** @var UrlGeneratorInterface */
protected $urlGenerator;

/** @var bool */
protected $ok;

/** @var string */
protected $status;
protected ?string $status;

/** @var DeferredRoute|string|null */
protected $redirect;
Expand All @@ -51,8 +43,8 @@ class AjaxResponseBuilder
/**
*/
public function __construct (
TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator,
protected TranslatorInterface $translator,
protected UrlGeneratorInterface $urlGenerator,
bool $ok,
?string $status = null
)
Expand All @@ -61,9 +53,6 @@ public function __construct (
{
$status = $ok ? "ok" : "failed";
}

$this->urlGenerator = $urlGenerator;
$this->translator = $translator;
$this->ok = $ok;
$this->status = $status;
}
Expand Down
8 changes: 1 addition & 7 deletions src/Command/CommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@

class CommandHelper
{
private Profiler $profiler;
private EventManager $eventManager;


public function __construct (Profiler $profiler, EventManager $eventManager)
public function __construct(private readonly Profiler $profiler, private readonly EventManager $eventManager)
{
$this->profiler = $profiler;
$this->eventManager = $eventManager;
}


Expand Down
8 changes: 4 additions & 4 deletions src/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function getLogger () : LoggerInterface
*/
protected function getJsonRequestData (Request $request, bool $isRequired = true) : array
{
if ("json" !== $request->getContentType())
if ("json" !== $request->getContentTypeFormat())
{
if (!$isRequired)
{
Expand Down Expand Up @@ -121,12 +121,12 @@ protected function getJsonRequestData (Request $request, bool $isRequired = true

return $data;
}
catch (\JsonException $e)
catch (\JsonException $jsonException)
{
throw new InvalidJsonRequestException(
"Invalid JSON received, error: {$e->getMessage()}",
'Invalid JSON received, error: ' . $jsonException->getMessage(),
400,
$e
$jsonException
);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Entity/Interfaces/SortableEntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ interface SortableEntityInterface extends EntityInterface
{
/**
* Returns the sort order.
*
* @return int
*/
public function getSortOrder () : ?int;

Expand Down
17 changes: 6 additions & 11 deletions src/Entity/Tag/TagEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,17 @@

/**
* Base class for implementing tag entities
*
* @ORM\MappedSuperclass()
*
* @UniqueEntity(fields={"tag"}, message="becklyn.rad.tag.duplicate")
*/
#[ORM\MappedSuperclass]
#[UniqueEntity(fields: ['tag'], message: 'becklyn.rad.tag.duplicate')]
abstract class TagEntity implements EntityInterface, TagInterface
{
use IdTrait;

/**
* @ORM\Column(name="tag", type="string", length=254, unique=true)
*
* @Assert\NotNull()
* @Assert\Length(max="254")
* @Assert\Regex(pattern="~^[a-z0-9\-_., ]+$~i", message="becklyn.rad.tag.pattern")
*/
#[ORM\Column(name: 'tag', type: 'string', length: 254, unique: true)]
#[Assert\NotNull]
#[Assert\Length(max: 254)]
#[Assert\Regex(pattern: '~^[a-z0-9\\-_., ]+$~i', message: 'becklyn.rad.tag.pattern')]
private ?string $tag = null;


Expand Down
8 changes: 3 additions & 5 deletions src/Entity/Traits/IdTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
*/
trait IdTrait
{
/**
* @ORM\Id()
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(name="id", type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(name: 'id', type: 'integer')]
private ?int $id = null;


Expand Down
5 changes: 1 addition & 4 deletions src/Entity/Traits/SortOrderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
*/
trait SortOrderTrait
{
/**
* @ORM\Column(name="sort_order", type="integer")
*/
#[ORM\Column(name: 'sort_order', type: 'integer')]
private ?int $sortOrder = null;



/**
* @return int
*/
public function getSortOrder () : ?int
{
Expand Down
9 changes: 2 additions & 7 deletions src/Entity/Traits/TimestampsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
*/
trait TimestampsTrait
{
/**
* @ORM\Column(name="time_created", type="datetime_immutable")
*/
#[ORM\Column(name: 'time_created', type: 'datetime_immutable')]
private \DateTimeImmutable $timeCreated;


/**
* @ORM\Column(name="time_modified", type="datetime_immutable", nullable=true)
*/
#[ORM\Column(name: 'time_modified', type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $timeModified = null;


Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Controller/InvalidJsonRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

final class InvalidJsonRequestException extends \RuntimeException implements HttpExceptionInterface
{
private int $statusCode;
private readonly int $statusCode;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/EntityRemovalBlockedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class EntityRemovalBlockedException extends \InvalidArgumentException implements RadException
{
/** @var object[] */
private array $entities;
private readonly array $entities;


/**
Expand Down
8 changes: 2 additions & 6 deletions src/Exception/LabeledEntityRemovalBlockedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
*/
class LabeledEntityRemovalBlockedException extends EntityRemovalBlockedException implements LabeledExceptionInterface
{
/** @var string */
private $frontendMessage;

/**
* {@inheritdoc}
*
Expand All @@ -18,15 +15,14 @@ class LabeledEntityRemovalBlockedException extends EntityRemovalBlockedException
* @param object|object[] $entities
* @param string $frontendMessage the #TranslationKey to use
*/
public function __construct ($entities, string $message, string $frontendMessage, ?\Throwable $previous = null)
public function __construct ($entities, string $message, private readonly string $frontendMessage, ?\Throwable $previous = null)
{
parent::__construct($entities, $message, $previous);
$this->frontendMessage = $frontendMessage;
}

/**
*/
public function getFrontendMessage ()
public function getFrontendMessage () : string
{
return $this->frontendMessage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/UnexpectedTypeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct ($value, string $expectedType)
parent::__construct(\sprintf(
'Expected argument of type %s, "%s" given',
$expectedType,
\is_object($value) ? \get_class($value) : \gettype($value)
\get_debug_type($value)
));
}
}
11 changes: 1 addition & 10 deletions src/Form/DeferredForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@
*/
final class DeferredForm
{
private string $type;
private array $options;


/**
*/
public function __construct (string $type, array $options = [])
public function __construct(private readonly string $type, private array $options = [])
{
$this->type = $type;
$this->options = $options;
}


Expand All @@ -39,9 +33,6 @@ public function getOptions () : array
}


/**
* @return static
*/
public function withOptions (array $options) : self
{
$modified = clone $this;
Expand Down
7 changes: 1 addition & 6 deletions src/Form/Extension/ChoicePlaceholderFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
*/
class ChoicePlaceholderFormExtension extends AbstractTypeExtension
{
private TranslatorInterface $translator;

/**
*/
public function __construct (TranslatorInterface $translator)
public function __construct(private readonly TranslatorInterface $translator)
{
$this->translator = $translator;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function buildForm (FormBuilderInterface $builder, array $options) : void
{
$builder->setAttribute($label, $options[$label]);
}

$builder->setAttribute("allow_sort", $options["allow_sort"]);
}

Expand All @@ -34,6 +35,7 @@ public function buildView (FormView $view, FormInterface $form, array $options)
{
$view->vars[$label] = $form->getConfig()->getAttribute($label);
}

$view->vars["allow_sort"] = $form->getConfig()->getAttribute("allow_sort");
}

Expand Down
Loading