(22) “When Joseph reached full maturity, We granted him sound judgment and knowledge. Thus do We reward those who excel in goodness.”
That is, when Joseph “reached full maturity”—when his mental and physical strength had become complete and he was ready to bear the weighty burdens of prophethood and the divine message—“We granted him sound judgment and knowledge.” In other words, We made him a prophet and messenger and a godly scholar. “Thus do We reward those who excel in goodness”: those who strive earnestly and sincerely in worshipping the Creator and who benefit Allah’s servants and treat them with kindness. As part of the reward for their excellence, We grant them ⦗396⦘ beneficial knowledge.
This indicates that Joseph fully attained the station of excellence, so Allah granted him authority to judge among people, abundant knowledge, and prophethood.