Skip to content

Transform the IPF Classlibrary to PSR-4 and PHP 8.2 - #1701

Draft
fiammybe wants to merge 100 commits into
ImpressCMS:mainfrom
fiammybe:ipf-to-psr4
Draft

Transform the IPF Classlibrary to PSR-4 and PHP 8.2#1701
fiammybe wants to merge 100 commits into
ImpressCMS:mainfrom
fiammybe:ipf-to-psr4

Conversation

@fiammybe

@fiammybe fiammybe commented Jul 26, 2026

Copy link
Copy Markdown
Member

Transform the existing classlibrary to PSR-4 structure and PHP 8.2+.

  • 'Object' classes are renamed to 'Entity' due to a PHP 7.2 language restriction
  • The 'icms' folder is renamed to Icms (with a capital 'I') to conform PSR4 specs and the fact that the class names start with a capital
  • Pass by reference is removed in function definitions, following current PHP recommendations.
  • Every PSR-4 class has an alias that points to the old classname. This should maintain complete backward-compatibility in modules that haven't yet converted to using namespaces.

This builds on the changes in https://github.com/fiammybe/impresscms/tree/ipf-to-composer

fiammybe and others added 30 commits January 4, 2025 19:34
…omposer, but that is not yet implemented for HTMLPurifier
Co-authored-by: Raimondas Rimkevičius <github@mekdrop.name>
…unused dev dependencies, and clean up scripts
Use === to compare $entry against '.' and '..' to avoid type
coercion and ensure exact string matches.
Return success from copyRecursive and add a recursive flag to
getFileCount.
When validating vendor copies, verify autoload.php SHA-1 and compare
recursive file counts; remove partial copies and return a descriptive
error
if verification fails.
Apply coding-style cleanup (short array syntax, spacing,
brace placement, normalized quotes) and replace the legacy
SIMPLEPIE_LOCATOR_NONE with \SimplePie\SimplePie::LOCATOR_NONE.
Determine protocol from HTTPS, default HTTP_HOST to 'localhost' when
absent, and examine PHP_SELF, REQUEST_URI (path only), and SCRIPT_NAME
for the script path. Sanitize values with htmlentities and fall back to
an empty base if no path info is available.
@fiammybe

Copy link
Copy Markdown
Member Author

I'm doing a separate push of every part of the library, one folder at a time. Every part should also have associated tests to verify that the alias exists and the legacy code should keep working.

@skenow

skenow commented Jul 30, 2026

Copy link
Copy Markdown
Member

This is a lot of work! I have been scrolling through the file differences and it all seems quite solid. As we move forward with this, there is a nagging consideration - file systems that are case sensitive will see all these as new folders and files and there will be a lot of cleanup to do.

@fiammybe

Copy link
Copy Markdown
Member Author

Thanks! It is quite mechanical work, but I want to verify everything manually and not let AI handle this all alone.
I also thought about the case-sensitive aspect. The best final scenario would be to move the IPF classes to a separate composer library, which means removing them from the /libraries/icms folder into composer-managed folders. Until we are there, we could rename 'icms' to 'Icms' upon upgrade I guess?

@skenow

skenow commented Aug 1, 2026

Copy link
Copy Markdown
Member

Renaming icms to Icms would be part of the process - also would need to rename all the folders and files beneath it. Maybe it would be easier to rename the existing folder to icms_legacy (or something similar) and add everything in a new Icms folder

Oh - and thank you for putting your expertise ahead of AI!

@fiammybe

fiammybe commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

going from icms to icms_legacy also means renaming folders, which is the tricky thing we're trying to avoid if possible. Perhaps keep all the original files as legacy, with only the class alias in them? And the PSR-4 transformed files would go into a composer library from the start, or a group of composer libraries, depending on how we structure this

@skenow

skenow commented Aug 2, 2026

Copy link
Copy Markdown
Member

Maybe I'm not looking at it properly. In the list of changes for this PR, files and folders are being removed from /icms/ and added to /Icms/, which is the desired result. Where the challenge will be is on a non-case-sensitive operating system and being able to determine what you're dealing with during an upgrade.

@fiammybe

fiammybe commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

I believe that is how Git interprets a rename of a folder : remove and add again of the files in those folders, as Git only stores the content of files. A folder without a file in it can't be managed by Git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants