wordpress-theme-framework icon indicating copy to clipboard operation
wordpress-theme-framework copied to clipboard

Singleton pattern no more working with php 8.1

Open jigar2002 opened this issue 3 years ago • 1 comments

Hello after updating PHP 8.1 we are fetching issues like not showing more custom taxonomy or CPTs because of the Singleton pattern no more working with PHP 8.1 so below is the solution for the same.

https://github.com/justcoded/wordpress-theme-framework/blob/34d1ac1157b19b287b77e2da076b01e32a866f39/framework/Objects/Singleton.php#L15

Replace this with below

public static function instance() { static $instance=[]; if (!isset($instance[static::class])) { $instance[static::class] = new static(); } return $instance[static::class]; }

jigar2002 avatar Nov 15 '22 02:11 jigar2002

Thanks for the report. We will check and merge if everything is fine

aprokopenko avatar Nov 23 '22 14:11 aprokopenko