Skip to content

Commit

Permalink
Merge pull request #8056 from kenjis/make-Factories-final
Browse files Browse the repository at this point in the history
fix: make Factories final
  • Loading branch information
kenjis authored Oct 21, 2023
2 parents c3bdcc9 + effc82c commit 45b1d68
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
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

0 comments on commit 45b1d68

Please sign in to comment.