Skip to content

Commit 4855ea3

Browse files
committed
2 parents 5d986da + 4c723e6 commit 4855ea3

File tree

28 files changed

+72
-96
lines changed

28 files changed

+72
-96
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"require-dev": {
6565
"behat/behat": "^3.6.1",
6666
"friends-of-behat/mink-extension": "^2.4",
67-
"ibexa/code-style": "~2.0.0",
67+
"ibexa/code-style": "~2.1.0",
6868
"ibexa/rector": "~5.0.x-dev",
6969
"jenner/simple_fork": "^1.2",
7070
"matthiasnoback/symfony-dependency-injection-test": "^5.0",
@@ -77,6 +77,7 @@
7777
},
7878
"conflict": {
7979
"doctrine/dbal": "2.7.0",
80+
"doctrine/orm": "2.20.7",
8081
"ezsystems/ezplatform-kernel": "*",
8182
"ezsystems/ezpublish-legacy": "*",
8283
"friendsofphp/php-cs-fixer": "3.5.0",

phpstan-baseline.neon

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6138,18 +6138,6 @@ parameters:
61386138
count: 1
61396139
path: src/lib/FieldType/BinaryBase/Type.php
61406140

6141-
-
6142-
message: '#^Access to an undefined property Ibexa\\Core\\FieldType\\Value\:\:\$fileName\.$#'
6143-
identifier: property.notFound
6144-
count: 1
6145-
path: src/lib/FieldType/BinaryBase/Type.php
6146-
6147-
-
6148-
message: '#^Access to an undefined property Ibexa\\Core\\FieldType\\Value\:\:\$fileSize\.$#'
6149-
identifier: property.notFound
6150-
count: 1
6151-
path: src/lib/FieldType/BinaryBase/Type.php
6152-
61536141
-
61546142
message: '#^Method Ibexa\\Core\\FieldType\\BinaryBase\\Type\:\:checkValueStructure\(\) has no return type specified\.$#'
61556143
identifier: missingType.return
@@ -7830,6 +7818,18 @@ parameters:
78307818
count: 1
78317819
path: src/lib/Helper/FieldsGroups/FieldsGroupsList.php
78327820

7821+
-
7822+
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\:\:\$alwaysAvailable\.$#'
7823+
identifier: property.notFound
7824+
count: 1
7825+
path: src/lib/Helper/TranslationHelper.php
7826+
7827+
-
7828+
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\:\:\$mainLanguageCode\.$#'
7829+
identifier: property.notFound
7830+
count: 1
7831+
path: src/lib/Helper/TranslationHelper.php
7832+
78337833
-
78347834
message: '#^Method Ibexa\\Core\\Helper\\TranslationHelper\:\:__construct\(\) has parameter \$siteAccessesByLanguage with no value type specified in iterable type array\.$#'
78357835
identifier: missingType.iterableValue
@@ -59868,12 +59868,6 @@ parameters:
5986859868
count: 1
5986959869
path: tests/lib/Repository/Validator/TargetContentValidatorTest.php
5987059870

59871-
-
59872-
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\:\:\$notDefined\.$#'
59873-
identifier: property.notFound
59874-
count: 1
59875-
path: tests/lib/Repository/Values/Content/LanguageTest.php
59876-
5987759871
-
5987859872
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\Content\\LanguageTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
5987959873
identifier: missingType.return
@@ -59904,12 +59898,6 @@ parameters:
5990459898
count: 1
5990559899
path: tests/lib/Repository/Values/Content/LanguageTest.php
5990659900

59907-
-
59908-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\Content\\Location\:\:\$notDefined\.$#'
59909-
identifier: property.notFound
59910-
count: 1
59911-
path: tests/lib/Repository/Values/Content/LocationTest.php
59912-
5991359901
-
5991459902
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
5991559903
identifier: staticMethod.alreadyNarrowedType
@@ -59934,12 +59922,6 @@ parameters:
5993459922
count: 1
5993559923
path: tests/lib/Repository/Values/Content/Query/Criterion/DateMetadataTest.php
5993659924

59937-
-
59938-
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Section\:\:\$notDefined\.$#'
59939-
identifier: property.notFound
59940-
count: 1
59941-
path: tests/lib/Repository/Values/Content/SectionTest.php
59942-
5994359925
-
5994459926
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
5994559927
identifier: staticMethod.alreadyNarrowedType
@@ -59982,12 +59964,6 @@ parameters:
5998259964
count: 1
5998359965
path: tests/lib/Repository/Values/Content/SectionTest.php
5998459966

59985-
-
59986-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\Content\\TrashItem\:\:\$notDefined\.$#'
59987-
identifier: property.notFound
59988-
count: 1
59989-
path: tests/lib/Repository/Values/Content/TrashItemTest.php
59990-
5999159967
-
5999259968
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
5999359969
identifier: staticMethod.alreadyNarrowedType
@@ -60078,12 +60054,6 @@ parameters:
6007860054
count: 1
6007960055
path: tests/lib/Repository/Values/Filter/FilterTest.php
6008060056

60081-
-
60082-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectStateGroup\:\:\$notDefined\.$#'
60083-
identifier: property.notFound
60084-
count: 1
60085-
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
60086-
6008760057
-
6008860058
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#'
6008960059
identifier: staticMethod.alreadyNarrowedType
@@ -60156,12 +60126,6 @@ parameters:
6015660126
count: 1
6015760127
path: tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php
6015860128

60159-
-
60160-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\ObjectState\\ObjectState\:\:\$notDefined\.$#'
60161-
identifier: property.notFound
60162-
count: 1
60163-
path: tests/lib/Repository/Values/ObjectState/ObjectStateTest.php
60164-
6016560129
-
6016660130
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\ObjectState\\ObjectStateTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
6016760131
identifier: missingType.return
@@ -60222,12 +60186,6 @@ parameters:
6022260186
count: 1
6022360187
path: tests/lib/Repository/Values/ObjectState/ObjectStateTest.php
6022460188

60225-
-
60226-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\Policy\:\:\$notDefined\.$#'
60227-
identifier: property.notFound
60228-
count: 1
60229-
path: tests/lib/Repository/Values/User/PolicyTest.php
60230-
6023160189
-
6023260190
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\PolicyTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
6023360191
identifier: missingType.return
@@ -60264,24 +60222,12 @@ parameters:
6026460222
count: 1
6026560223
path: tests/lib/Repository/Values/User/PolicyTest.php
6026660224

60267-
-
60268-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\Role\:\:\$notDefined\.$#'
60269-
identifier: property.notFound
60270-
count: 1
60271-
path: tests/lib/Repository/Values/User/RoleTest.php
60272-
6027360225
-
6027460226
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\RoleTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
6027560227
identifier: missingType.return
6027660228
count: 1
6027760229
path: tests/lib/Repository/Values/User/RoleTest.php
6027860230

60279-
-
60280-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\UserGroup\:\:\$notDefined\.$#'
60281-
identifier: property.notFound
60282-
count: 1
60283-
path: tests/lib/Repository/Values/User/UserGroupTest.php
60284-
6028560231
-
6028660232
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\UserGroupTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
6028760233
identifier: missingType.return
@@ -60330,12 +60276,6 @@ parameters:
6033060276
count: 1
6033160277
path: tests/lib/Repository/Values/User/UserGroupTest.php
6033260278

60333-
-
60334-
message: '#^Access to an undefined property Ibexa\\Core\\Repository\\Values\\User\\User\:\:\$notDefined\.$#'
60335-
identifier: property.notFound
60336-
count: 1
60337-
path: tests/lib/Repository/Values/User/UserTest.php
60338-
6033960279
-
6034060280
message: '#^Method Ibexa\\Tests\\Core\\Repository\\Values\\User\\UserTest\:\:assertPropertiesCorrect\(\) has no return type specified\.$#'
6034160281
identifier: missingType.return

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ includes:
77
parameters:
88
level: 8
99
treatPhpDocTypesAsCertain: false
10+
checkDynamicProperties: true
11+
1012
ignoreErrors:
1113
-
1214
message: "#^Cannot call method warning\\(\\) on Psr\\\\Log\\\\LoggerInterface\\|null\\.$#"

src/bundle/Core/Resources/config/templating.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ services:
190190
- { name: ibexa.view.render.strategy }
191191

192192
Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\ImageExtension:
193-
class: Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\ImageExtension
193+
autoconfigure: true
194194
arguments:
195195
- '@ibexa.field_type.ibexa_image.variation_service'
196196
- '@Ibexa\Core\FieldType\ImageAsset\AssetMapper'

src/lib/FieldType/Author/Type.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public function getFieldTypeIdentifier(): string
5555
return 'ibexa_author';
5656
}
5757

58+
/**
59+
* @param \Ibexa\Core\FieldType\Author\Value $value
60+
*/
5861
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
5962
{
6063
return $value->authors[0]->name ?? '';
@@ -106,11 +109,11 @@ protected function checkValueStructure(BaseValue $value)
106109
}
107110

108111
/**
109-
* {@inheritdoc}
112+
* @param \Ibexa\Core\FieldType\Author\Value $value
110113
*/
111114
protected function getSortInfo(BaseValue $value)
112115
{
113-
if (empty($value->authors)) {
116+
if (count($value->authors) === 0) {
114117
return false;
115118
}
116119

src/lib/FieldType/BinaryBase/Type.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\Contracts\Core\FieldType\Value as SPIValue;
1212
use Ibexa\Contracts\Core\Persistence\Content\FieldValue as PersistenceValue;
1313
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
14+
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
1415
use Ibexa\Core\Base\Exceptions\InvalidArgumentValue;
1516
use Ibexa\Core\FieldType\FieldType;
1617
use Ibexa\Core\FieldType\Media\Value;
@@ -149,7 +150,9 @@ protected function checkValueStructure(BaseValue $value)
149150
/**
150151
* Attempts to complete the data in $value.
151152
*
152-
* @param \Ibexa\Core\FieldType\BinaryBase\Value|\Ibexa\Core\FieldType\Value $value
153+
* @param \Ibexa\Core\FieldType\BinaryBase\Value $value
154+
*
155+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
153156
*/
154157
protected function completeValue(BaseValue $value)
155158
{
@@ -163,7 +166,14 @@ protected function completeValue(BaseValue $value)
163166
}
164167

165168
if (!isset($value->fileSize)) {
166-
$value->fileSize = filesize($value->inputUri);
169+
$fileSize = filesize($value->inputUri);
170+
if (false === $fileSize) {
171+
throw new InvalidArgumentException(
172+
'$value->inputUri',
173+
'Could not determine file size of ' . $value->inputUri
174+
);
175+
}
176+
$value->fileSize = $fileSize;
167177
}
168178
}
169179

src/lib/FieldType/ImageAsset/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getFieldTypeIdentifier(): string
102102
}
103103

104104
/**
105-
* @param \Ibexa\Core\FieldType\ImageAsset\Value|\Ibexa\Contracts\Core\FieldType\Value $value
105+
* @param \Ibexa\Core\FieldType\ImageAsset\Value $value
106106
*/
107107
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
108108
{

src/lib/FieldType/Relation/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function getFieldTypeIdentifier(): string
153153
}
154154

155155
/**
156-
* @param \Ibexa\Core\FieldType\Relation\Value|\Ibexa\Contracts\Core\FieldType\Value $value
156+
* @param \Ibexa\Core\FieldType\Relation\Value $value
157157
*/
158158
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
159159
{

src/lib/FieldType/RelationList/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public function getFieldTypeIdentifier(): string
303303
}
304304

305305
/**
306-
* @param \Ibexa\Core\FieldType\RelationList\Value|\Ibexa\Contracts\Core\FieldType\Value $value
306+
* @param \Ibexa\Core\FieldType\RelationList\Value $value
307307
*/
308308
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
309309
{

src/lib/FieldType/Selection/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function getFieldTypeIdentifier(): string
127127
}
128128

129129
/**
130-
* @param \Ibexa\Core\FieldType\Selection\Value|\Ibexa\Contracts\Core\FieldType\Value $value
130+
* @param \Ibexa\Core\FieldType\Selection\Value $value
131131
*/
132132
public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string
133133
{

0 commit comments

Comments
 (0)