xref: /PHP-7.4/ext/opcache/tests/bug75608.phpt (revision 75bc3446)
1--TEST--
2Bug #75608 ("Narrowing occurred during type inference" error)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
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