Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make Factories final #8056

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions system/Config/Factories.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
* @method static Model|null models(string $alias, array $options = [], ?ConnectionInterface &$conn = null)
* @see \CodeIgniter\Config\FactoriesTest
*/
class Factories
final class Factories
{
/**
* Store of component-specific options, usually
* from CodeIgniter\Config\Factory.
*
* @var array<string, array<string, bool|string|null>>
*/
protected static $options = [];
private static $options = [];

/**
* Explicit options for the Config
Expand Down Expand Up @@ -65,7 +65,7 @@ class Factories
* @var array<string, array<string, string>>
* @phpstan-var array<string, array<string, class-string>>
*/
protected static $aliases = [];
private static $aliases = [];

/**
* Store for instances of any component that
Expand All @@ -79,7 +79,7 @@ class Factories
* @var array<string, array<string, object>>
* @phpstan-var array<string, array<class-string, object>>
*/
protected static $instances = [];
private static $instances = [];

/**
* Whether the component instances are updated?
Expand All @@ -88,7 +88,7 @@ class Factories
*
* @internal For caching only
*/
protected static $updated = [];
private static $updated = [];

/**
* Define the class to load. You can *override* the concrete class.
Expand Down Expand Up @@ -252,7 +252,7 @@ private static function isConfig(string $component): bool
* @param array $options The array of component-specific directives
* @param string $alias Class alias. See the $aliases property.
*/
protected static function locateClass(array $options, string $alias): ?string
private static function locateClass(array $options, string $alias): ?string
{
// Check for low-hanging fruit
if (
Expand Down Expand Up @@ -328,7 +328,7 @@ private static function isNamespaced(string $alias): bool
* @param array $options The array of component-specific directives
* @param string $alias Class alias. See the $aliases property.
*/
protected static function verifyPreferApp(array $options, string $alias): bool
private static function verifyPreferApp(array $options, string $alias): bool
{
// Anything without that restriction passes
if (! $options['preferApp']) {
Expand All @@ -349,7 +349,7 @@ protected static function verifyPreferApp(array $options, string $alias): bool
* @param array $options The array of component-specific directives
* @param string $alias Class alias. See the $aliases property.
*/
protected static function verifyInstanceOf(array $options, string $alias): bool
private static function verifyInstanceOf(array $options, string $alias): bool
{
// Anything without that restriction passes
if (! $options['instanceOf']) {
Expand Down
6 changes: 6 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Due to a bug fix, the behavior has changed so that options passed to the outer
``group()`` are merged with the options of the inner ``group()``.
See :ref:`Upgrading Guide <upgrade-450-nested-route-groups-and-options>` for details.

Factories class
---------------

:doc:`../concepts/factories` has been changed to a final class. It is a static
class, and even if it were extended, there is no way to replace it.

Others
------

Expand Down
7 changes: 7 additions & 0 deletions user_guide_src/source/installation/upgrade_450.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ has been removed.

If you extneds ``BaseModel``, implement the ``getIdValue()`` method in the child class.

Factories
=========

:doc:`../concepts/factories` has been changed to a final class.
In the unlikely event, you have inherited the Factories, stop inheriting and
copy the code into your Factories class.

Removed Deprecated Items
========================

Expand Down
Loading