I have a class with the following structure:
/**
 * @property int ticket_id
 */
class Test {
    public function __construct( $ticket_id ) {
        $this->ticket_id = $ticket_id;
        $this->register();
    }
    /**
     * Register all hooks
     */
    public function register(): void {
        add_action( 'wp_ajax_ping', array( $this, 'ping' ) );
    }
    public function ping(): void {
        require_once('ping.php');
    }
}
In my ping.php I've tried using my parameter $this->ticket_id but I got an error that $this is not available in non object context:
error_log($this->ticket_id);
And yes, I'm creating a new object from my class:
new Test('123');
Why? I thought I can use it inside any required file too.