Skip to content

Return signatures of Autoloader's loaders should be void - #7747

Merged
paulbalandan merged 1 commit into
codeigniter4:4.4from
paulbalandan:autoloader-loader
Aug 2, 2023
Merged

paulbalandan merged 1 commit into
codeigniter4:4.4from
paulbalandan:autoloader-loader

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Ref: https://www.php.net/manual/en/function.spl-autoload-register.php

As a result of this change, this may be a potential BC break. I added this to the changelog. Also marked @internal those 2 callbacks.

Checklist:

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

@paulbalandan paulbalandan added bug Verified issues on the current code behavior or pull requests that will fix them breaking change Pull requests that may break existing functionalities labels Jul 29, 2023
Comment thread system/Autoloader/Autoloader.php Outdated
Comment thread system/Autoloader/Autoloader.php Outdated
Comment thread system/Autoloader/Autoloader.php Outdated
@kenjis

kenjis commented Jul 29, 2023

Copy link
Copy Markdown
Member

@paulbalandan I don't see the benefit. I don't think this is a bug.
Returning a value does not cause errors. I don't see that the callback return type must be void in PHP manual.
If you really want to change it, it is better to send to 4.4.

I think adding @internal is okay.

@kenjis kenjis added the stale Pull requests with conflicts label Jul 29, 2023
@paulbalandan

Copy link
Copy Markdown
Member Author

The signature is in the Parameters section:

callback
The autoload function being registered. If null, then the default implementation of spl_autoload() will be registered.

callback(string $class): void
The class will not contain the leading backslash of a fully-qualified identifier.

Okay, I'll send to 4.4

@paulbalandan
paulbalandan changed the base branch from develop to 4.4 July 30, 2023 11:35
@paulbalandan paulbalandan changed the title fix: return signatures of Autoloader's loaders should be void Return signatures of Autoloader's loaders should be void Jul 30, 2023
@paulbalandan paulbalandan removed bug Verified issues on the current code behavior or pull requests that will fix them stale Pull requests with conflicts labels Jul 30, 2023
@kenjis

kenjis commented Jul 31, 2023

Copy link
Copy Markdown
Member

@paulbalandan Okay, the callback return type should be void.

Comment thread tests/system/Autoloader/AutoloaderTest.php
@kenjis kenjis added 4.4 bug Verified issues on the current code behavior or pull requests that will fix them stale Pull requests with conflicts labels Jul 31, 2023
@kenjis kenjis removed the stale Pull requests with conflicts label Aug 2, 2023
@paulbalandan
paulbalandan merged commit fdd935d into codeigniter4:4.4 Aug 2, 2023
@paulbalandan
paulbalandan deleted the autoloader-loader branch August 2, 2023 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Pull requests that may break existing functionalities bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants