Skip to content

Fixed code samples after latest Rector release - #3338

Merged
mnocon merged 4 commits into
5.0from
fix-code-samples
Aug 4, 2026
Merged

Fixed code samples after latest Rector release#3338
mnocon merged 4 commits into
5.0from
fix-code-samples

Conversation

@mnocon

@mnocon mnocon commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Target: 4.6, 5.0, 6.0

For 4.6, only the change in the update notes should be cherry-picked

Should be possible to review this by commits.

I've used this opportunity to add the missing Symfony rules and run the refactoring.

CI failure in https://github.com/ibexa/documentation-developer/actions/runs/30838488540/job/91769459101?pr=3339 :

Error: Unknown parameter $strictBooleans in call to method Rector\Configuration\RectorConfigBuilder::withPreparedSets().
 ------ ----------------------------------------------------------------------- 
  Line   _inline_php/update_and_migration/from_4.6/update_to_5.0/20a5c589183c1  
         b8ee4f67c7a0c9352320eb7349e3f06f89c61e245ea4b7f585f.php                
 ------ ----------------------------------------------------------------------- 
  44     Unknown parameter $strictBooleans in call to method                    
         Rector\Configuration\RectorConfigBuilder::withPreparedSets().          
         🪪  argument.unknown                                                   
 ------ --------------------------------

Another error:

 Error: Access to constant ANNOTATIONS_TO_ATTRIBUTES on an unknown class Rector\Symfony\Set\SensiolabsSetList.
 ------ ----------------------------------------------------------------------- 
  Line   _inline_php/update_and_migration/from_4.6/update_to_5.0/317d4528e219c  
         00c0d1909bec8d7ba870d6a5ca9af0df1e54b7b0a6cbe9aa948.php                
 ------ ----------------------------------------------------------------------- 
  29     Access to constant ANNOTATIONS_TO_ATTRIBUTES on an unknown class       
         Rector\Symfony\Set\SensiolabsSetList.                                  
         🪪  class.notFound                                                     
         💡  Learn more at https://phpstan.org/user-guide/discovering-symbols   

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Preview of modified files

Preview of modified Markdown:

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 736648
🔗 Unique 14766
✅ Successful 6195
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 730453
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Full Github Actions output

@mnocon
mnocon force-pushed the fix-code-samples branch from 6ef9805 to 761617e Compare August 4, 2026 08:23
@mnocon
mnocon marked this pull request as ready for review August 4, 2026 08:24
@mnocon
mnocon requested a review from a team August 4, 2026 08:25
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team August 4, 2026 08:25
Comment thread rector.php
Comment on lines +28 to +29
SymfonySetList::SYMFONY_73,
SymfonySetList::SYMFONY_74,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/back_office/images/src/SvgExtension.php

docs/content_management/images/images.md@223:``` php
docs/content_management/images/images.md@224:[[= include_code('code_samples/back_office/images/src/SvgExtension.php') =]]
docs/content_management/images/images.md@225:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Twig;
006⫶
007⫶use Symfony\Component\Routing\RouterInterface;

code_samples/back_office/images/src/SvgExtension.php

docs/content_management/images/images.md@223:``` php
docs/content_management/images/images.md@224:[[= include_code('code_samples/back_office/images/src/SvgExtension.php') =]]
docs/content_management/images/images.md@225:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Twig;
006⫶
007⫶use Symfony\Component\Routing\RouterInterface;
008⫶use Twig\Extension\AbstractExtension;
009⫶use Twig\TwigFunction;
010⫶
011⫶class SvgExtension extends AbstractExtension
012⫶{
013⫶ /**
014⫶ * SvgExtension constructor.
015⫶ */
016⫶ public function __construct(protected RouterInterface $router)
017⫶ {
018⫶ }
019⫶
020⫶ /**
021⫶ * @return \Twig\TwigFunction[]
022⫶ */
023⫶ #[\Override]
024⫶ public function getFunctions(): array
025⫶ {
026⫶ return [
027⫶ new TwigFunction('ibexa_svg_link', $this->generateLink(...)),
028⫶ ];
029⫶ }
030⫶
031⫶ public function generateLink(int $contentId, string $fieldIdentifier, string $filename): string
032⫶ {
033⫶ return $this->router->generate('app.svg_download', [
034⫶ 'contentId' => $contentId,
035⫶ 'fieldIdentifier' => $fieldIdentifier,
036⫶ 'filename' => $filename,
037⫶ ]);
038⫶ }
039⫶}
008⫶use Twig\Attribute\AsTwigFunction;
009⫶
010⫶class SvgExtension
011⫶{
012⫶ /**
013⫶ * SvgExtension constructor.
014⫶ */
015⫶ public function __construct(protected RouterInterface $router)
016⫶ {
017⫶ }
018⫶
019⫶ #[AsTwigFunction(name: 'ibexa_svg_link')]
020⫶ public function generateLink(int $contentId, string $fieldIdentifier, string $filename): string
021⫶ {
022⫶ return $this->router->generate('app.svg_download', [
023⫶ 'contentId' => $contentId,
024⫶ 'fieldIdentifier' => $fieldIdentifier,
025⫶ 'filename' => $filename,
026⫶ ]);
027⫶ }
028⫶}


Download colorized diff

@mnocon
mnocon merged commit e766acf into 5.0 Aug 4, 2026
11 checks passed
@mnocon
mnocon deleted the fix-code-samples branch August 4, 2026 09:39
mnocon added a commit that referenced this pull request Aug 4, 2026
* Removed strictBooleans

* Run SF 7.3, 7.4 rules

* Removed SensioLabSetList

* PHP-CS-Fixer
mnocon added a commit that referenced this pull request Aug 4, 2026
* Removed strictBooleans

* Run SF 7.3, 7.4 rules

* Removed SensioLabSetList

* PHP-CS-Fixer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants