Skip to content

refactor: make BaseService and BaseCollector abstract - #10531

Merged
samsonasik merged 4 commits into
codeigniter4:4.8from
samsonasik:refactor-base-abstract
Sep 12, 2026
Merged

refactor: make BaseService and BaseCollector abstract#10531
samsonasik merged 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.*$/'))

applied with single command:

vendor/bin/structarmed analyze --fix

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.

@paulbalandan

Copy link
Copy Markdown
Member

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.

If this would work, then let's have it.

@samsonasik

Copy link
Copy Markdown
Member Author

@paulbalandan is it mergeable or should we wait a little bit for another opinion?

@paulbalandan

Copy link
Copy Markdown
Member

Yes, let's merge.

@samsonasik

Copy link
Copy Markdown
Member Author

Thank you @neznaika0 @michalsn @paulbalandan for the review, let's merge 👍

@samsonasik
samsonasik merged commit 4f9d165 into codeigniter4:4.8 Sep 12, 2026
61 of 62 checks passed
@samsonasik
samsonasik deleted the refactor-base-abstract branch September 12, 2026 13:00
@samsonasik

Copy link
Copy Markdown
Member Author

Ref PR to develop for backport structarmed.php to develop branch and use baseline config

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