Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
94fa32e
Added code for testing YAML samples
mnocon Apr 23, 2026
12d7b9c
Generated baseline
mnocon Apr 23, 2026
1639b92
Fixes - first batch
mnocon Apr 23, 2026
1948433
Fixes - batch 2
mnocon Apr 23, 2026
a975f81
fixup! Added code for testing YAML samples
mnocon Apr 23, 2026
6e147db
Selfreview
mnocon Apr 23, 2026
46fada1
Update tests/Markdown/MarkdownYamlExtractorTest.php
mnocon May 15, 2026
2ae328f
Fixes before next round of review
mnocon May 15, 2026
498fd99
Extract vale to a directory
mnocon May 15, 2026
003cd72
PHP & JS CS Fixes
mnocon May 15, 2026
164a415
Empty commit
mnocon May 16, 2026
a37e1de
Fixed Vale
mnocon May 16, 2026
44e472a
Added support for include_code
mnocon May 16, 2026
1d9b356
Verify baseline on hashes, not line numbers
mnocon May 16, 2026
c9a880c
Added continue on error
mnocon May 16, 2026
19ca290
Speed up code samples workflow
mnocon May 16, 2026
bc6e8c2
Added testing of PHP code samples (PHPStan, CS-Fixer, Deptrac)
mnocon May 16, 2026
84ab43c
Disabled validation for existing inline PHP snippets
mnocon May 17, 2026
25728d7
Make all checks pass
mnocon May 16, 2026
8250554
Revert "Disabled validation for existing inline PHP snippets"
mnocon May 16, 2026
67003fd
PHPStan green
mnocon May 17, 2026
16b2490
Run PHP-CS-Fixer
mnocon May 17, 2026
33e01a1
Added declare(strict_types=1) to extracted files
mnocon May 17, 2026
1684755
Use hash of file content for filenames
mnocon May 17, 2026
82b2b3d
fixup! Added declare(strict_types=1) to extracted files
mnocon May 17, 2026
870b843
fixup! Added declare(strict_types=1) to extracted files
mnocon May 17, 2026
51fd5c5
fixup! Added declare(strict_types=1) to extracted files
mnocon May 17, 2026
9150572
fixup! Use hash of file content for filenames
mnocon May 17, 2026
00f5fba
Run Rector
mnocon May 17, 2026
62625df
Code style & PHPStan
mnocon May 17, 2026
80a3324
Run deptrac
mnocon May 17, 2026
bb689a9
Fixed broken link
mnocon May 17, 2026
c52819a
Selfreview
mnocon May 17, 2026
4ca44ba
Selfreview
mnocon May 17, 2026
382f520
Self review: hl_lines
mnocon May 17, 2026
5150030
Use new skip-validation attribute
mnocon May 17, 2026
ab8123b
Added code for testing YAML samples
mnocon Apr 23, 2026
e4519ed
Generated baseline
mnocon Apr 23, 2026
3c2d6d2
Fixes - first batch
mnocon Apr 23, 2026
8c432df
Fixes - batch 2
mnocon Apr 23, 2026
d35302d
fixup! Added code for testing YAML samples
mnocon Apr 23, 2026
8389cc2
Selfreview
mnocon Apr 23, 2026
9e59216
Update tests/Markdown/MarkdownYamlExtractorTest.php
mnocon May 15, 2026
a5783f2
Fixes before next round of review
mnocon May 15, 2026
7ee4f90
Extract vale to a directory
mnocon May 15, 2026
0acddfb
PHP & JS CS Fixes
mnocon May 15, 2026
cc512a2
Empty commit
mnocon May 16, 2026
44fc3f2
Fixed Vale
mnocon May 16, 2026
6f3b223
Added support for include_code
mnocon May 16, 2026
8849d0f
Verify baseline on hashes, not line numbers
mnocon May 16, 2026
29573c4
Speed up code samples workflow
mnocon May 16, 2026
40fd04d
Rebase
mnocon Jun 23, 2026
24aad10
Merge remote-tracking branch 'origin/test-yamls' into fix-php-snippets
mnocon Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ jobs:
TOKEN: ${{ secrets.EZROBOT_PAT }}
run: |
curl -H "Authorization: token $TOKEN" -L https://github.com/ibexa/vale-styles/archive/refs/heads/main.zip -o vale.zip
unzip vale.zip
unzip vale.zip -d vale
rm vale.zip
mv vale-styles-main/* vale-styles-main/.vale.ini .
rm -rf vale/vale-styles-main/tests
mv vale/vale-styles-main/* vale/vale-styles-main/.vale.ini .
- name: Run Vale.sh
uses: vale-cli/vale-action@v2
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/code_samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ jobs:
continue-on-error: true
run: composer check-rector

- name: Run YAML snippet tests
id: check-yaml
continue-on-error: true
run: composer check-yaml

- name: Fail job if any check failed
if: always()
run: |
if [[ "${{ steps.phpstan.outcome }}" == "failure" || "${{ steps.deptrac.outcome }}" == "failure" || "${{ steps.rector.outcome }}" == "failure" ]]; then
echo "One or more checks failed: PHPStan=${{ steps.phpstan.outcome }}, Deptrac=${{ steps.deptrac.outcome }}, Rector=${{ steps.rector.outcome }}"
if [[ "${{ steps.phpstan.outcome }}" == "failure" || "${{ steps.deptrac.outcome }}" == "failure" || "${{ steps.rector.outcome }}" == "failure" || "${{ steps.check-yaml.outcome }}" == "failure" ]]; then
echo "One or more checks failed: PHPStan=${{ steps.phpstan.outcome }}, Deptrac=${{ steps.deptrac.outcome }}, Rector=${{ steps.rector.outcome }}, YAML=${{ steps.check-yaml.outcome }}"
exit 1
fi


code-samples-inclusion-check:
name: Check code samples inclusion
runs-on: ubuntu-latest
Expand All @@ -94,7 +100,7 @@ jobs:
- name: Log target branch code_samples usage
if: steps.list.outputs.CODE_SAMPLES_CHANGE != ''
run: |
git fetch origin
git fetch origin --depth=1 ${{ github.head_ref }}
git checkout origin/${{ github.head_ref }} -- tools/code_samples/code_samples_usage.php
php tools/code_samples/code_samples_usage.php ${{ steps.list.outputs.CODE_SAMPLES_CHANGE }} > $HOME/code_samples_usage_target.txt

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ auth.json
yarn.lock
docs/css/*.map
.deptrac.cache
.phpunit.result.cache
code_samples/_inline_php/
15 changes: 15 additions & 0 deletions .php-cs-fixer-factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;

$commonRules = [
'header_comment' => false,
];

return [new InternalConfigFactory(), $commonRules];
29 changes: 29 additions & 0 deletions .php-cs-fixer-inline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

/**
* PHP-CS-Fixer configuration for auto-generated inline snippets in code_samples/_inline_php/.
*
* Builds on top of the shared factory with additional rule overrides:
* - psr_autoloading is disabled: snippet files are named line_N.php and do not
* correspond to any class, so the filename≠class-name rule does not apply.
*/
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory->withRules(array_merge($commonRules, [
'psr_autoloading' => false,
'AdamWojs/phpdoc_force_fqcn_fixer' => false,
]));

return $configFactory
->buildConfig()
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/code_samples/_inline_php')
->files()->name('*.php')
);
8 changes: 3 additions & 5 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
*/
declare(strict_types=1);

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory = new InternalConfigFactory();
$configFactory->withRules([
'header_comment' => false,
]);
$configFactory->withRules($commonRules);

return $configFactory
->buildConfig()
Expand All @@ -23,5 +20,6 @@
__DIR__ . '/tests',
], 'is_dir')
)
->exclude('_inline_php') // handled separately by .php-cs-fixer-inline.php
->files()->name('*.php')
);
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ of the command.

## Testing the code samples

### YAML configuration

To test the YAML configuration, run the following commands:

``` bash
composer update
composer check-yaml
```

To add an error into a baseline, run `composer yaml-update-baseline` and commit the result.
Error added to the baseline are not reported again.

### markdownlint

This repository uses [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to check Markdown formatting, including table syntax.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
: 'The user is not assigned to the segment.'
));

$this->segmentationService->removeSegmentGroup($segmentGroup);

return self::SUCCESS;
}
}
1 change: 0 additions & 1 deletion code_samples/back_office/components/twig_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ibexa_twig_components:
priority: 0
arguments:
content: '<b>Hello world!</b>'
admin-ui-user-menu:
duplicated_user_menu:
type: menu
arguments:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ framework:
to:
- dropped

// ...
# ...

ibexa:
repositories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
$domain: <translation_domain>
tags:
- { name: ibexa.payment.payment_method.type, alias: new_payment_method_type }
services:

App\Payment\PaymentMethod\Voter\NewPaymentMethodTypeVoter:
tags:
- { name: ibexa.payment.payment_method.voter, type: new_payment_method_type }
- { name: ibexa.payment.payment_method.voter, type: new_payment_method_type }
2 changes: 1 addition & 1 deletion code_samples/mcp/config/packages/mcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ibexa:
discovery_cache: cache.tagaware.filesystem
session:
type: psr16
directory: cache.tagaware.filesystem
service: cache.tagaware.filesystem
system:
default:
mcp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ ibexa:
<scope>:
connector_raptor:
enabled: true
customer_id: ~ # Required
customer_id: "12345" # Required
tracking_type: client # One of: "client" or "server"

# Raptor Recommendations API key
recommendations_api_key: ~ # Required
recommendations_api_key: "your_api_key_here" # Required

# Raptor Recommendations API URL, optional, set by default
recommendations_api_url: '%ibexa.connector.raptor.recommendations.api_url%'
# Raptor Recommendations API URI, optional, set by default
recommendations_api_uri: '%ibexa.connector.raptor.recommendations.api_uri%'

# Cookie lifetime in days for server-side tracking identifier
# Default: 365 days. Minimum: 1 day.
Expand Down
49 changes: 41 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"type": "library",
"license": "GNU General Public License v2.0",
"autoload-dev": {
"psr-4": {
"Ibexa\\Tests\\Documentation\\": "tests/"
}
},
"repositories": [
{
Expand All @@ -15,6 +18,9 @@
"php": "^8.3"
},
"require-dev": {
"phpunit/phpunit": "^11.0",
"symfony/yaml": "^7.0",
"ibexa/connector-gemini": "5.0.x-dev",
"ibexa/automated-translation": "5.0.x-dev",
"ibexa/code-style": "~2.0.0",
"friendsofphp/php-cs-fixer": "^3.30",
Expand Down Expand Up @@ -52,7 +58,7 @@
"ibexa/page-builder": "5.0.x-dev",
"ibexa/order-management": "5.0.x-dev",
"ibexa/calendar": "5.0.x-dev",
"ibexa/payment": "5.0.x-dev",
"ibexa/payment": "~5.0.x-dev",
"ibexa/shipping": "5.0.x-dev",
"ibexa/fieldtype-matrix": "5.0.x-dev",
"ibexa/storefront": "5.0.x-dev",
Expand Down Expand Up @@ -86,21 +92,48 @@
"ibexa/cdp": "~5.0.x-dev",
"ibexa/connector-raptor": "~5.0.x-dev",
"ibexa/image-editor": "~5.0.x-dev",
"ibexa/integrated-help": "~5.0.x-dev"
"ibexa/integrated-help": "~5.0.x-dev",
"ibexa/site-context": "~5.0.x-dev",
"ibexa/fieldtype-richtext-rte": "~5.0.x-dev",
"ibexa/site-factory": "~5.0.x-dev",
"ibexa/ckeditor-premium": "~5.0.x-dev",
"ibexa/measurement": "~5.0.x-dev",
"ibexa/connector-actito": "~5.0.x-dev",
"ibexa/fastly": "~5.0.x-dev"
},
"scripts": {
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
"check-cs": "@fix-cs --dry-run",
"phpstan": "phpstan analyse",
"deptrac": "deptrac analyse",
"check-rector": "rector process --dry-run --ansi"
"fix-cs": [
"php tools/extract-inline-php.php",
"php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
"php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots",
"php tools/sync-inline-php-to-markdown.php"
],
"check-cs": [
"php tools/extract-inline-php.php",
"php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots --dry-run",
"php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots --dry-run"
],
"phpstan": "php tools/extract-inline-php.php && phpstan analyse",
"deptrac": "php tools/extract-inline-php.php && deptrac analyse",
"fix-rector": [
"php tools/extract-inline-php.php",
"rector process --ansi",
"php tools/sync-inline-php-to-markdown.php"
],
"check-rector": "php tools/extract-inline-php.php && rector process --dry-run --ansi",
"check-yaml": "phpunit --group yaml",
"phpunit": "phpunit --exclude-group=yaml",
"yaml-update-baseline": "php tests/generate-yaml-baseline.php"
},
"scripts-descriptions": {
"fix-cs": "Automatically fixes code style in all files",
"check-cs": "Run code style checker for all files",
"phpstan": "Run static code analysis",
"deptrac": "Run Deptrac architecture testing",
"check-rector": "Check for code refactoring opportunities"
"fix-rector": "Automatically applies Rector refactoring to code samples and syncs back to Markdown",
"check-rector": "Check for code refactoring opportunities",
"check-yaml": "Run PHPUnit tests (YAML validation)",
"yaml-update-baseline": "Regenerate tests/yaml-validation-baseline.yaml from current failures"
},
"config": {
"allow-plugins": false
Expand Down
26 changes: 26 additions & 0 deletions deptrac.baseline.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
deptrac:
skip_violations:
AcmeFeatureBundle:
- Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension
App\AutomatedTranslation\ImageFieldEncoder:
- Ibexa\Core\FieldType\Image\Value
App\Block\Listener\MyBlockListener:
Expand Down Expand Up @@ -92,6 +94,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RelationController:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RideController:
- Ibexa\Bundle\Core\Controller
- Ibexa\Core\MVC\Symfony\View\ContentView
App\Controller\SvgController:
- Ibexa\Core\Helper\TranslationHelper
- Ibexa\Core\IO\IOServiceInterface
Expand All @@ -117,6 +122,9 @@ deptrac:
- Ibexa\Discounts\Repository\DiscountRule\DiscountRuleFactoryInterface
App\Dispatcher\SomeClassThatSchedulesExecutionInTheBackground:
- Ibexa\Bundle\Messenger\Stamp\DeduplicateStamp
App\EventListener\InteractiveLoginListener:
- Ibexa\Core\MVC\Symfony\MVCEvents
- eIbexa\Core\MVC\Symfony\Event\InteractiveLoginEvent
App\EventListener\TextAnchorMenuTabListener:
- Ibexa\AdminUi\Menu\ContentEditAnchorMenuBuilder
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
Expand All @@ -130,13 +138,19 @@ deptrac:
- Ibexa\FormBuilder\Event\FormEvents
App\EventSubscriber\HelpMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
App\EventSubscriber\LoginFormViewSubscriber:
- Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent
- Ibexa\Core\MVC\Symfony\MVCEvents
- Ibexa\Core\MVC\Symfony\View\LoginFormView
App\EventSubscriber\MyMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
- Ibexa\AdminUi\Menu\MainMenuBuilder
App\EventSubscriber\NotificationScenarioSubscriber:
- Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock
- Ibexa\IntegratedHelp\ProductTour\Block\TextBlock
- Ibexa\IntegratedHelp\ProductTour\ProductTourStep
App\EventSubscriber\ResolveCampaginEventSubscriber:
- Ibexa\ConnectorActito\Campaign\Campaign
App\Event\RandomBlockListener:
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent
Expand Down Expand Up @@ -194,6 +208,8 @@ deptrac:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\Migrations\Step\ReplaceNameStepNormalizer:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\MyService:
- Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface
App\Notification\ListRenderer:
- Ibexa\Core\Notification\Renderer\NotificationRenderer
- Ibexa\Core\Notification\Renderer\TypedNotificationRendererInterface
Expand All @@ -212,6 +228,8 @@ deptrac:
App\QueryType\OptionsBasedLatestContentQueryType:
- Ibexa\Core\QueryType\OptionsResolverBasedQueryType
- Ibexa\Core\QueryType\QueryType
App\QueryType\RideQueryType:
- Ibexa\Core\QueryType\QueryType
App\Search\Model\Suggestion\ProductSuggestion:
- Ibexa\ProductCatalog\Local\Repository\Values\Product
App\Security\FormPolicyProvider:
Expand All @@ -236,6 +254,8 @@ deptrac:
- Ibexa\AdminUi\Limitation\LimitationValueMapperInterface
App\Security\MyPolicyProvider:
- Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider
App\Service\MyService:
- Ibexa\User\UserSetting\DateTimeFormat\FormatterInterface
App\Setting\Group\MyGroup:
- Ibexa\User\UserSetting\Group\AbstractGroup
App\Setting\Unit:
Expand All @@ -254,3 +274,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
AttributeTypeExtension:
- Ibexa\PageBuilder\Form\Type\Attribute\AttributeType
CustomRepositoryConfigParser:
- Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface
JohnDoeCanSelectMore:
- Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent
MyMapper:
- Ibexa\ContentForms\Form\Type\FieldType\CheckboxFieldType
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ declare(strict_types=1);

namespace App\Thumbnails;

use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail;
use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy;
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;

class FieldValueUrl implements FieldTypeBasedThumbnailStrategy
Expand Down
Loading
Loading