Skip to content

refactor: make BaseService and BaseCollector abstract - #10531

Open
samsonasik wants to merge 4 commits into
codeigniter4:4.8from
samsonasik:refactor-base-abstract
Open

refactor: make BaseService and BaseCollector abstract#10531
samsonasik wants to merge 4 commits into
codeigniter4:4.8from
samsonasik:refactor-base-abstract

Conversation

@samsonasik

@samsonasik samsonasik commented Sep 7, 2026

Copy link
Copy Markdown
Member

Description

This PR target to 4.8, change 2 files:

  • system/Config/BaseService.php
  • system/Debug/Toolbar/Collectors/BaseCollector.php

in the system or tests, they never instantiated, only extended, verified with structarmed ExtendedClassMustBeAbstractOrInstantiatedRule for future new Base+ prefix classes to be abstract.

->rule('base_classes.must_be_abstract', new ExtendedClassMustBeAbstractOrInstantiatedRule('Source', '/^CodeIgniter\\\\.*Base.*$/'))

If you want to only apply the changes class change only to easier for back and forth develop and 4.8 branch, just let me know ;)

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik samsonasik added refactor Pull requests that refactor code breaking change Pull requests that may break existing functionalities 4.8 PRs that target the `4.8` branch. labels Sep 7, 2026
@samsonasik

Copy link
Copy Markdown
Member Author

Ready for review 👍

@neznaika0 neznaika0 left a comment

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.

I didn’t find a direct call to BaseConfig — should you change it as well?

@samsonasik

Copy link
Copy Markdown
Member Author

That's mark as instantiated, due to new static usage as a factory process, which skipped on purpose

$obj = new static();

@samsonasik

Copy link
Copy Markdown
Member Author

I've updated with clean up to directly filter classNamePattern in its constructor itself so no need additional layer just to filter base classes 👍

@samsonasik

samsonasik commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

For note: I think If this merged, the structarmed.php can be backported to develop branch, then generate structarmed-baseline.php to ignore violation notice and register to baseline config as in develop branch, the base classes stil not abstract, so no need dealing with git conflict for skip the rule in develop.

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

Labels

4.8 PRs that target the `4.8` branch. breaking change Pull requests that may break existing functionalities refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants