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
42 changes: 18 additions & 24 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10608,18 +10608,6 @@ parameters:
count: 1
path: src/lib/FieldType/BinaryBase/Type.php

-
message: '#^Access to an undefined property Ibexa\\Core\\FieldType\\Value\:\:\$fileName\.$#'
identifier: property.notFound
count: 1
path: src/lib/FieldType/BinaryBase/Type.php

-
message: '#^Access to an undefined property Ibexa\\Core\\FieldType\\Value\:\:\$fileSize\.$#'
identifier: property.notFound
count: 1
path: src/lib/FieldType/BinaryBase/Type.php

-
message: '#^Method Ibexa\\Core\\FieldType\\BinaryBase\\Type\:\:checkValueStructure\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -10674,6 +10662,12 @@ parameters:
count: 1
path: src/lib/FieldType/BinaryBase/Type.php

-
message: '#^Property Ibexa\\Core\\FieldType\\BinaryBase\\Value\:\:\$fileSize \(int\|null\) does not accept int\<0, max\>\|false\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/FieldType/BinaryBase/Type.php

-
message: '#^Method Ibexa\\Core\\FieldType\\BinaryBase\\Value\:\:__construct\(\) has parameter \$fileData with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -12750,6 +12744,18 @@ parameters:
count: 1
path: src/lib/Helper/FieldsGroups/RepositoryConfigFieldsGroupsListFactory.php

-
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\:\:\$alwaysAvailable\.$#'
identifier: property.notFound
count: 1
path: src/lib/Helper/TranslationHelper.php

-
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\:\:\$mainLanguageCode\.$#'
identifier: property.notFound
count: 1
path: src/lib/Helper/TranslationHelper.php

-
message: '#^Method Ibexa\\Core\\Helper\\TranslationHelper\:\:__construct\(\) has parameter \$siteAccessesByLanguage with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -52584,12 +52590,6 @@ parameters:
count: 1
path: tests/lib/FieldType/ImageAssetTest.php

-
message: '#^Access to an undefined property Ibexa\\Tests\\Core\\FieldType\\ImageTest\:\:\$mimeTypeDetectorMock\.$#'
identifier: property.notFound
count: 1
path: tests/lib/FieldType/ImageTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\FieldType\\ImageTest\:\:getBlackListValidatorMock\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -53700,12 +53700,6 @@ parameters:
count: 1
path: tests/lib/FieldType/TimeTest.php

-
message: '#^Access to an undefined property Ibexa\\Tests\\Core\\FieldType\\Url\\Gateway\\DoctrineStorageTest\:\:\$storageGateway\.$#'
identifier: property.notFound
count: 1
path: tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\FieldType\\Url\\Gateway\\DoctrineStorageTest\:\:testGetIdUrlMap\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ includes:
parameters:
level: 8
treatPhpDocTypesAsCertain: false
checkDynamicProperties: true

ignoreErrors:
-
message: "#^Cannot call method (fetchOne|fetchColumn|fetchAllAssociative|fetchAssociative|fetchAllKeyValue|fetchFirstColumn|rowCount)\\(\\) on Doctrine\\\\DBAL\\\\ForwardCompatibility\\\\Result\\|int\\|string\\.$#"
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Core/Resources/config/templating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ services:
- { name: ibexa.view.render.strategy }

Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\ImageExtension:
class: Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\ImageExtension
autoconfigure: true
arguments:
- '@ibexa.field_type.ezimage.variation_service'
- '@Ibexa\Core\FieldType\ImageAsset\AssetMapper'
Expand Down
7 changes: 5 additions & 2 deletions src/lib/FieldType/Author/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function getFieldTypeIdentifier()
return 'ezauthor';
}

/**
* @param \Ibexa\Core\FieldType\Author\Value $value
*/
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
{
return $value->authors[0]->name ?? '';
Expand Down Expand Up @@ -103,11 +106,11 @@ protected function checkValueStructure(BaseValue $value)
}

/**
* {@inheritdoc}
* @param \Ibexa\Core\FieldType\Author\Value $value
*/
protected function getSortInfo(BaseValue $value)
{
if (empty($value->authors)) {
if (count($value->authors) === 0) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/BinaryBase/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function checkValueStructure(BaseValue $value)
/**
* Attempts to complete the data in $value.
*
* @param \Ibexa\Core\FieldType\BinaryBase\Value|\Ibexa\Core\FieldType\Value $value
* @param \Ibexa\Core\FieldType\BinaryBase\Value $value
*/
protected function completeValue(BaseValue $value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/ImageAsset/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function getFieldTypeIdentifier(): string
}

/**
* @param \Ibexa\Core\FieldType\ImageAsset\Value|\Ibexa\Contracts\Core\FieldType\Value $value
* @param \Ibexa\Core\FieldType\ImageAsset\Value $value
*/
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/Relation/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getFieldTypeIdentifier()
}

/**
* @param \Ibexa\Core\FieldType\Relation\Value|\Ibexa\Contracts\Core\FieldType\Value $value
* @param \Ibexa\Core\FieldType\Relation\Value $value
*/
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/RelationList/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function getFieldTypeIdentifier()
}

/**
* @param \Ibexa\Core\FieldType\RelationList\Value|\Ibexa\Contracts\Core\FieldType\Value $value
* @param \Ibexa\Core\FieldType\RelationList\Value $value
*/
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/Selection/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function getFieldTypeIdentifier()
}

/**
* @param \Ibexa\Core\FieldType\Selection\Value|\Ibexa\Contracts\Core\FieldType\Value $value
* @param \Ibexa\Core\FieldType\Selection\Value $value
*/
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/Validator/ImageValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function validateConstraints($constraints, ?FieldDefinition $fieldDefinit
}

/**
* {@inheritdoc}
* @param \Ibexa\Core\FieldType\Image\Value $value
*/
public function validate(Value $value, ?FieldDefinition $fieldDefinition = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
use Ibexa\Core\FieldType\ImageAsset\AssetMapper;
use Ibexa\Core\MVC\Exception\SourceImageNotFoundException;
use InvalidArgumentException;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class ImageExtension extends AbstractExtension
class ImageExtension extends AbstractExtension implements LoggerAwareInterface
{
use LoggerAwareTrait;

use DeprecationOptionsTrait;

/** @var \Ibexa\Contracts\Core\Variation\VariationHandler */
Expand Down
14 changes: 5 additions & 9 deletions tests/lib/FieldType/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,17 @@ class ImageTest extends FieldTypeTest
'pgif',
];

/** @var \Ibexa\Contracts\Core\IO\MimeTypeDetector&\PHPUnit\Framework\MockObject\MockObject */
private MimeTypeDetector $mimeTypeDetectorMock;

public function getImageInputPath()
{
return __DIR__ . '/../_fixtures/squirrel-developers.jpg';
}

/**
* @return \Ibexa\Contracts\Core\IO\MimeTypeDetector
*/
protected function getMimeTypeDetectorMock()
protected function getMimeTypeDetectorMock(): MimeTypeDetector
{
if (!isset($this->mimeTypeDetectorMock)) {
$this->mimeTypeDetectorMock = $this->createMock(MimeTypeDetector::class);
}

return $this->mimeTypeDetectorMock;
return $this->mimeTypeDetectorMock ??= $this->createMock(MimeTypeDetector::class);
}

/**
Expand Down
8 changes: 3 additions & 5 deletions tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
class DoctrineStorageTest extends TestCase
{
private DoctrineStorage $storageGateway;

/**
* @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::getIdUrlMap
*/
Expand Down Expand Up @@ -196,11 +198,7 @@ public function testUnlinkUrl()

protected function getStorageGateway(): Gateway
{
if (!isset($this->storageGateway)) {
$this->storageGateway = new DoctrineStorage($this->getDatabaseConnection());
}

return $this->storageGateway;
return $this->storageGateway ??= new DoctrineStorage($this->getDatabaseConnection());
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/Content/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function testMissingProperty()
$this->expectExceptionMessage('Property \'notDefined\' not found on class');

$language = new Language();
/** @phpstan-ignore-next-line property.notFound */
$value = $language->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/Content/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public function testMissingProperty(): void
$this->expectException(PropertyNotFoundException::class);

$location = new Location();
/** @phpstan-ignore-next-line property.notFound */
$value = $location->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/Content/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$section = new Section();
/** @phpstan-ignore-next-line property.notFound */
$value = $section->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/Content/TrashItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$trashItem = new TrashItem();
/** @phpstan-ignore-next-line property.notFound */
$value = $trashItem->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$objectStateGroup = new ObjectStateGroup();
/** @phpstan-ignore-next-line property.notFound */
$value = $objectStateGroup->notDefined;
$this->fail('Succeeded getting non existing property');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$objectState = new ObjectState();
/** @phpstan-ignore-next-line property.notFound */
$value = $objectState->notDefined;
$this->fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/User/PolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$policy = new Policy();
/** @phpstan-ignore-next-line property.notFound */
$value = $policy->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/User/RoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$role = new Role();
/** @phpstan-ignore-next-line property.notFound */
$value = $role->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/User/UserGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$userGroup = new UserGroup();
/** @phpstan-ignore-next-line property.notFound */
$value = $userGroup->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Values/User/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function testMissingProperty()
$this->expectException(PropertyNotFoundException::class);

$user = new User();
/** @phpstan-ignore-next-line property.notFound */
$value = $user->notDefined;
self::fail('Succeeded getting non existing property');
}
Expand Down
Loading