Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8121: Fixed code style for 5.0 #160

Merged
merged 3 commits into from
May 7, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/browser-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
name: "Richtext browser tests"
uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main
with:
php-image: ghcr.io/ibexa/docker/php:8.3-node18
project-edition: 'oss'
test-suite: '--profile=browser --suite=admin-ui --tags=@richtext'
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.3
coverage: none

- uses: ./.github/actions/composer-install
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dama/doctrine-test-bundle": "^6.7.5",
"ibexa/admin-ui": "~5.0.x-dev",
"ibexa/ci-scripts": "^0.2@dev",
"ibexa/code-style": "^1.0",
"ibexa/code-style": "~2.0.0",
"ibexa/design-engine": "~5.0.x-dev",
"ibexa/doctrine-schema": "~5.0.x-dev",
"ibexa/notifications": "~5.0.x-dev",
Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1080,31 +1080,16 @@ parameters:
count: 1
path: src/lib/RichText/Renderer.php

-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\RichText\\\\Renderer\\:\\:renderContentEmbed\\(\\) should return string but returns null\\.$#"
count: 5
path: src/lib/RichText/Renderer.php

-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\RichText\\\\Renderer\\:\\:renderLocationEmbed\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/RichText/Renderer.php

-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\RichText\\\\Renderer\\:\\:renderLocationEmbed\\(\\) should return string but returns null\\.$#"
count: 4
path: src/lib/RichText/Renderer.php

-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\RichText\\\\Renderer\\:\\:renderTemplate\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/RichText/Renderer.php

-
message: "#^Method Ibexa\\\\FieldTypeRichText\\\\RichText\\\\Renderer\\:\\:renderTemplate\\(\\) should return string but returns null\\.$#"
count: 2
path: src/lib/RichText/Renderer.php

-
message: "#^Parameter \\#1 \\$locationId of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\LocationService\\:\\:loadLocation\\(\\) expects int, int\\|string given\\.$#"
count: 1
Expand Down Expand Up @@ -2703,11 +2688,6 @@ parameters:
count: 1
path: tests/lib/RichText/RelationProcessorTest.php

-
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with string will always evaluate to false\\.$#"
count: 9
path: tests/lib/RichText/RendererTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:getContentMock\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
6 changes: 3 additions & 3 deletions src/contracts/RichText/RendererInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface RendererInterface
* @param array $parameters
* @param bool $isInline
*
* @return string
* @return string|null
*/
public function renderTemplate($name, $type, array $parameters, $isInline);

Expand All @@ -33,7 +33,7 @@ public function renderTemplate($name, $type, array $parameters, $isInline);
* @param array $parameters
* @param bool $isInline
*
* @return string
* @return string|null
*/
public function renderContentEmbed($contentId, $viewType, array $parameters, $isInline);

Expand All @@ -45,7 +45,7 @@ public function renderContentEmbed($contentId, $viewType, array $parameters, $is
* @param array $parameters
* @param bool $isInline
*
* @return string
* @return string|null
*/
public function renderLocationEmbed($locationId, $viewType, array $parameters, $isInline);
}
Expand Down
10 changes: 0 additions & 10 deletions src/lib/RichText/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,6 @@ public function renderLocationEmbed($locationId, $viewType, array $parameters, $
return $this->render($templateName, $parameters);
}

/**
* Renders template tag.
*
* @param string $name
* @param string $type
* @param array $parameters
* @param bool $isInline
*
* @return string
*/
public function renderTemplate($name, $type, array $parameters, $isInline)
{
switch ($type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function providerForTestProcessingCustomTagsConfiguration(): iterable
foreach ($finder as $file) {
$outputFilePath = self::OUTPUT_FIXTURES_DIR . $file->getFilename();
if (!file_exists($outputFilePath)) {
$this->markTestIncomplete("Missing output fixture: {$outputFilePath}");
self::markTestIncomplete("Missing output fixture: {$outputFilePath}");
}

$configs = [Yaml::parseFile($file->getPathname())];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testRichTextConfiguration(): void
$this->load($config);

// Validate Custom Tags
$this->assertTrue(
self::assertTrue(
$this->container->hasParameter(IbexaFieldTypeRichTextExtension::RICHTEXT_CUSTOM_TAGS_PARAMETER)
);
$expectedCustomTagsConfig = [
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testRichTextConfiguration(): void
],
];

$this->assertSame(
self::assertSame(
$expectedCustomTagsConfig,
$this->container->getParameter(IbexaFieldTypeRichTextExtension::RICHTEXT_CUSTOM_TAGS_PARAMETER)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testExtractId(string $input, ?string $expected): void
{
$subject = new YoutubeIdExtractorExtension();
$result = $subject->extractId($input);
$this->assertEquals($expected, $result);
self::assertEquals($expected, $result);
}

/**
Expand All @@ -62,9 +62,9 @@ public function testGetFunctions(): void
$subject = new YoutubeIdExtractorExtension();
/** @var \Twig\TwigFunction[] $result */
$result = $subject->getFunctions();
$this->assertIsArray($result);
$this->assertInstanceOf(TwigFunction::class, $result[0]);
$this->assertEquals('ibexa_richtext_youtube_extract_id', $result[0]->getName());
self::assertIsArray($result);
self::assertInstanceOf(TwigFunction::class, $result[0]);
self::assertEquals('ibexa_richtext_youtube_extract_id', $result[0]->getName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function getFieldName()
*/
public function assertFieldDataLoadedCorrect(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -316,7 +316,7 @@ public function getValidUpdateFieldData()
*/
public function assertUpdatedFieldDataLoadedCorrect(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -365,7 +365,7 @@ public function provideInvalidUpdateFieldData()
*/
public function assertCopiedFieldDataLoadedCorrectly(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -458,13 +458,13 @@ public function testFromHash($hash, $expectedValue = null)
->getFieldTypeService()
->getFieldType($this->getTypeName())
->fromHash($hash);
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$richTextValue
);
$this->assertInstanceOf('DOMDocument', $richTextValue->xml);
self::assertInstanceOf('DOMDocument', $richTextValue->xml);

$this->assertEquals($hash['xml'], (string)$richTextValue);
self::assertEquals($hash['xml'], (string)$richTextValue);
}

public function providerForTestIsEmptyValue()
Expand Down Expand Up @@ -632,7 +632,7 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected): void
[$locationService->newLocationCreateStruct($locationId)]
);

$this->assertEquals(
self::assertEquals(
str_replace('[ObjectId]', (string)$objectId, $expected),
$test->getField('description')->value->xml->saveXML()
);
Expand Down Expand Up @@ -1072,7 +1072,7 @@ private function getDocumentWithLocationLink(Location $location)
protected function checkSearchEngineSupport()
{
if ($this->getSetupFactory() instanceof SetupFactory\LegacySetupFactory) {
$this->markTestSkipped(
self::markTestSkipped(
"'ezrichtext' field type is not searchable with Legacy Search Engine"
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Configuration/Provider/AlloyEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ public function testGetConfiguration(): void
$provider = $this->createProvider();

$this->configResolver
->expects($this->any())
->expects(self::any())
->method('hasParameter')
->willReturn(false);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapCssClassesConfiguration')
->with([])
->willReturn(['class1', 'class2']);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapDataAttributesConfiguration')
->with([])
->willReturn(['attr1', 'attr2']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ final public function testGetConfiguration()
$tags = $this->getExpectedCustomTemplatesConfiguration();

$this->configResolver
->expects($this->once())
->expects(self::once())
->method('hasParameter')
->with($this->getCustomTemplateSiteAccessConfigParamName())
->willReturn(true);

$this->configResolver
->expects($this->once())
->expects(self::once())
->method('getParameter')
->with($this->getCustomTemplateSiteAccessConfigParamName())
->willReturn($tags);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapConfig')
->with($tags)
->willReturnArgument(0);
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Configuration/UI/Config/Mapper/CustomTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private function getTranslatorInterfaceMock(): MockObject
{
$translatorInterfaceMock = $this->createMock(TranslatorInterface::class);
$translatorInterfaceMock
->expects($this->any())
->expects(self::any())
->method('trans')
->withAnyParameters()
->willReturnArgument(0);
Expand All @@ -194,14 +194,14 @@ private function getTranslatorBagInterfaceMock(): MockObject
{
$catalogueMock = $this->createMock(MessageCatalogueInterface::class);
$catalogueMock
->expects($this->any())
->expects(self::any())
->method('has')
->withAnyParameters()
->willReturn(false);

$translatorBagInterfaceMock = $this->createMock(TranslatorBagInterface::class);
$translatorBagInterfaceMock
->expects($this->any())
->expects(self::any())
->method('getCatalogue')
->willReturn(
$catalogueMock
Expand All @@ -217,7 +217,7 @@ private function getPackagesMock(): MockObject
{
$packagesMock = $this->createMock(Packages::class);
$packagesMock
->expects($this->any())
->expects(self::any())
->method('getUrl')
->withAnyParameters()
->willReturnArgument(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setUp(): void
/** @var \Symfony\Contracts\Translation\TranslatorInterface $translatorMock */
$translatorMock = $this->createMock(TranslatorInterface::class);
$translatorMock
->expects($this->any())
->expects(self::any())
->method('trans')
->willReturnArgument(0);
$this->mapper = new OnlineEditor($translatorMock, 'online_editor');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testGetContentIds()

$gateway = $this->getStorageGateway();

$this->assertEquals(
self::assertEquals(
[
'f5c88a2209584891056f987fd965b0ba' => 4,
'faaeb9be3bd98ed09f606fc16d144eca' => 10,
Expand Down
Loading
Loading