On Wed, August 13, 2025 at 16:20 Theodore Brown wrote:

> I analyzed the top 1500 Composer packages to find and categorize usages of the
> `__sleep` and `__wakeup` methods. There are a total of 250 `__sleep` methods
> and 259 `__wakeup` methods in these packages (509 total).
> 
> Of these, 108 are empty methods containing no code. Most of these are stubs
> in the jetbrains\phpstorm-stubs package.
> 
> Another 152 of the methods contain only a single throw statement.
> 
> This leaves 160 `__sleep` methods and 89 `__wakeup` methods (249 total) which 
> do
> something else. 150 of these (over 60%) exist in just 9 packages:
> 
> * doctrine\orm - 14
> * drupal\core - 38
> * laminas\laminas-server - 7
> * maatwebsite\excel - 7
> * magento\zend-db - 7
> * pdepend\pdepend - 31
> * roots\wordpress-no-content - 6
> * symfony\mime - 8
> * symfony\symfony - 32
> 
> Outside of the above packages, `__sleep` and `__wakup` methods generally seem 
> to
> be few and far between.
> 
> I created a Google Sheet to view the per-package statistics:
> https://docs.google.com/spreadsheets/d/1i7GINJdTjXk4lj012vwd7ipZTxuucduYh-JyYm6V6Y8/edit?usp=sharing
> 
> The raw code for each `__sleep` and `__wakeup` method can be viewed here:
> https://gist.github.com/theodorejb/965633b9787475dfe64cc53dc941bc49


Update: it looks like nearly all the Symfony usages have already been fixed for 
Symfony 8.

I re-downloaded and analyzed the top 1500 packages again this afternoon, and 
now there
are a total of 159 `__sleep` methods and 207 `__wakeup` methods in 65 distinct 
packages,
a significant drop from when I did the analysis yesterday.

107 of the methods are empty, and 65 only contain a single throw statement.
Over 62% of the remaining methods exist in just 9 packages:

* doctrine\orm - 14
* drupal\core - 36
* johnpbloch\wordpress-core - 6
* laminas\laminas-server - 7
* maatwebsite\excel - 7
* magento\zend-db - 6
* pdepend\pdepend - 32
* swiftmailer\swiftmailer - 7
* typo3\cms-extbase - 6

I updated the above gist and Google Sheet links with the data from today.

Kind regards,
Theodore

Reply via email to