Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
934f7cb
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
808779b
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
aedab71
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
271d559
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
b54dc92
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
f78974b
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
470f03d
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
d375501
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
28e821e
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
444adeb
Added missing type hints to Ibexa\Contracts\Core\Repository\Values\Co…
adamwojs Jun 4, 2025
9e47b75
[PHPStan] Resolved phpstan issues
adamwojs Jun 4, 2025
72df86c
[Tests] Updated Ibexa\Tests\Core\Repository\Service\Mock\ContentTest …
adamwojs Jun 4, 2025
a2a163e
[Tests] Updated Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\Id\…
adamwojs Jun 4, 2025
0053ade
[Tests] Updated Ibexa\Tests\Core\Helper\FieldsGroups\ArrayTranslatorF…
adamwojs Jun 4, 2025
d3bcdd6
[Tests] Dropped redundant Ibexa\Tests\Core\Repository\Values\ContentT…
adamwojs Jun 4, 2025
df65a49
[Tests] Dropped redundant Ibexa\Tests\Core\Repository\Values\ContentT…
adamwojs Jun 4, 2025
3734350
[Tests] Updated Ibexa\Tests\Integration\Core\Repository\ContentTypeSe…
adamwojs Jun 4, 2025
f3d40a1
[PHPStan] Updated phpstan baseline
adamwojs Jun 4, 2025
43c5d04
[Tests] Updated Ibexa\Tests\Core\MVC\Symfony\Templating\Twig\Extensio…
adamwojs Jun 5, 2025
ca47fe6
[Tests] Fixed caching field type identifier by content type id
alongosz Jun 6, 2025
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
82 changes: 14 additions & 68 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6234,30 +6234,6 @@ parameters:
count: 1
path: src/contracts/Repository/Values/Content/URLWildcard/SearchResult.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$descriptions type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/ContentTypeCreateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$names type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/ContentTypeCreateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeUpdateStruct\:\:\$descriptions type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/ContentTypeUpdateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeUpdateStruct\:\:\$names type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/ContentTypeUpdateStruct.php

-
message: '#^Class Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition has PHPDoc tag @property\-read for property \$fieldSettings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -6294,30 +6270,6 @@ parameters:
count: 1
path: src/contracts/Repository/Values/ContentType/FieldDefinitionCollection.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinitionCreateStruct\:\:\$descriptions type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/FieldDefinitionCreateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinitionCreateStruct\:\:\$names type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/FieldDefinitionCreateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinitionUpdateStruct\:\:\$descriptions type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/FieldDefinitionUpdateStruct.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinitionUpdateStruct\:\:\$names type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/contracts/Repository/Values/ContentType/FieldDefinitionUpdateStruct.php

-
message: '#^Method Ibexa\\Contracts\\Core\\Repository\\Values\\Filter\\Filter\:\:__construct\(\) has parameter \$sortClauses with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -19293,42 +19245,42 @@ parameters:
-
message: '#^PHPDoc tag @var has invalid value \(\$fieldType \\Ibexa\\Contracts\\Core\\FieldType\\FieldType\)\: Unexpected token "\$fieldType", expected type at offset 9 on line 1$#'
identifier: phpDoc.parseError
count: 2
count: 1
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$descriptions \(array\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
message: '#^Parameter \#1 \$fieldDefinitionIdentifier of method Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:hasFieldDefinition\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$isContainer \(bool\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
message: '#^Parameter \#1 \$fieldTypeIdentifier of method Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\:\:hasFieldDefinitionOfType\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$nameSchema \(string\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
count: 1
message: '#^Parameter \#1 \$identifier of method Ibexa\\Core\\FieldType\\FieldTypeRegistry\:\:getFieldType\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 2
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeCreateStruct\:\:\$urlAliasSchema \(string\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
message: '#^Parameter \#1 \$languageCode of method Ibexa\\Contracts\\Core\\Repository\\LanguageService\:\:loadLanguage\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeUpdateStruct\:\:\$descriptions \(array\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
message: '#^Parameter \#3 \$mainLanguageCode of method Ibexa\\Core\\Repository\\Mapper\\ContentTypeDomainMapper\:\:buildSPIFieldDefinitionFromCreateStruct\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: src/lib/Repository/ContentTypeService.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentTypeUpdateStruct\:\:\$names \(array\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinitionCreateStruct\:\:\$names \(array\<string, string\>\) does not accept array\<string, bool\|string\>\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Repository/ContentTypeService.php

Expand Down Expand Up @@ -63732,12 +63684,6 @@ parameters:
count: 1
path: tests/lib/Repository/Values/Content/TrashItemTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ContentType\\ContentTypeDraftTest\:\:testObjectProperties\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: tests/lib/Repository/Values/ContentType/ContentTypeDraftTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ContentType\\FieldDefinitionCollectionTest\:\:createFieldDefinitions\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
68 changes: 22 additions & 46 deletions src/contracts/Repository/Values/ContentType/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace Ibexa\Contracts\Core\Repository\Values\ContentType;

use DateTimeInterface;
use Ibexa\Contracts\Core\Repository\Values\Content\Location;
use Ibexa\Contracts\Core\Repository\Values\MultiLanguageDescription;
use Ibexa\Contracts\Core\Repository\Values\MultiLanguageName;
use Ibexa\Contracts\Core\Repository\Values\ValueObject;
Expand Down Expand Up @@ -36,78 +38,62 @@
abstract class ContentType extends ValueObject implements MultiLanguageName, MultiLanguageDescription
{
/** @var int Status constant for defined (aka "published") Type */
public const STATUS_DEFINED = 0;
public const int STATUS_DEFINED = 0;

/** @var int Status constant for draft (aka "temporary") Type */
public const STATUS_DRAFT = 1;
public const int STATUS_DRAFT = 1;

/** @var int Status constant for modified (aka "deferred for publishing") Type */
public const STATUS_MODIFIED = 2;
public const int STATUS_MODIFIED = 2;

/**
* Content type ID.
*
* @var mixed
*/
protected $id;
protected int $id;

/**
* The status of the content type.
*
* @var int One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED
*/
protected $status;
protected int $status;

/**
* String identifier of a content type.
*
* @var string
*/
protected $identifier;
protected string $identifier;

/**
* Creation date of the content type.
*
* @var \DateTime
*/
protected $creationDate;
protected DateTimeInterface $creationDate;

/**
* Modification date of the content type.
*
* @var \DateTime
*/
protected $modificationDate;
protected DateTimeInterface $modificationDate;

/**
* Creator user id of the content type.
*
* @var mixed
*/
protected $creatorId;
protected int $creatorId;

/**
* Modifier user id of the content type.
*
* @var mixed
*/
protected $modifierId;
protected int $modifierId;

/**
* Unique remote ID of the content type.
*
* @var string
*/
protected $remoteId;
protected string $remoteId;

/**
* URL alias schema.
*
* If nothing is provided, $nameSchema will be used instead.
*
* @var string
*/
protected $urlAliasSchema;
protected string $urlAliasSchema;

/**
* Name schema.
Expand All @@ -117,58 +103,48 @@ abstract class ContentType extends ValueObject implements MultiLanguageName, Mul
* An OR condition can be used :
* <field_def|other_field_def>
* In this example, field_def will be used if available. If not, other_field_def will be used for content name generation
*
* @var string
*/
protected $nameSchema;
protected string $nameSchema;

/**
* A flag used to hint if content of this type may have children or not. It is highly recommended to respect this flag and not create/move content below non-containers.
* But this flag is not considered as part of the content model and the API will not in any way enforce this flag to be respected.
*
* @var bool
*/
protected $isContainer;
protected bool $isContainer = false;

/**
* If an instance of a content type is created the always available flag is set
* by default to this value.
*
* @var bool
*/
protected $defaultAlwaysAvailable = true;
protected bool $defaultAlwaysAvailable = true;

/**
* Specifies which property the child locations should be sorted on by default when created.
*
* Valid values are found at {@link Location::SORT_FIELD_*}
*
* @var int
*/
protected $defaultSortField;
protected int $defaultSortField = Location::SORT_FIELD_PUBLISHED;

/**
* Specifies whether the sort order should be ascending or descending by default when created.
*
* Valid values are {@link Location::SORT_ORDER_*}
*
* @var int
*/
protected $defaultSortOrder;
protected int $defaultSortOrder = Location::SORT_ORDER_DESC;

/**
* List of language codes used by translations.
*
* @var string[]
*/
protected $languageCodes;
protected array $languageCodes = [];

/**
* This method returns the content type groups this content type is assigned to.
*
* @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[]
*/
abstract public function getContentTypeGroups();
abstract public function getContentTypeGroups(): array;

/**
* This method returns the content type field definitions from this type.
Expand All @@ -187,7 +163,7 @@ public function getIdentifier(): string
*
* @return \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition|null
*/
public function getFieldDefinition($fieldDefinitionIdentifier): ?FieldDefinition
public function getFieldDefinition(string $fieldDefinitionIdentifier): ?FieldDefinition
{
if ($this->hasFieldDefinition($fieldDefinitionIdentifier)) {
return $this->getFieldDefinitions()->get($fieldDefinitionIdentifier);
Expand Down
Loading
Loading