xref: /PHP-8.4/ext/opcache/tests/bug75608.phpt (revision e9f783fc)
1--TEST--
2Bug #75608 ("Narrowing occurred during type inference" error)
3--EXTENSIONS--
4opcache
5--FILE--
6<?php
7class ReactionRatingService
8{
9    public function calculateBoostPoints()
10    {
11        while ($reaction = $reactions) {
12            $reactionRatings = $this->validFunction();
13
14            $totalWeight  = 0;
15            $runningScore = 0;
16            $queue        = [];
17            foreach ($reactionRatings as $ratingData) {
18                if ($runningScore != $reaction['Score']) {
19                    if ( ! $ratingData['BoostEarned']) {
20                        $queue[] = $ratingData['UserID'];
21                    }
22                } else {
23                    foreach ($queue as $userId) {
24                        $userBoostPointsRecalculate[$userId][] = $reaction['ID'];
25                    }
26                }
27                $totalWeight += $ratingData['Weight'];
28            }
29        }
30    }
31}
32?>
33OK
34--EXPECT--
35OK
36