定制 fredemmott/hack-error-suppressor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fredemmott/hack-error-suppressor

最新稳定版本:v1.0.1

Composer 安装命令:

composer require fredemmott/hack-error-suppressor

包简介

Suppress HHVM's automatic conversion of typechecker errors to fatals.

README 文档

README

THIS PROJECT IS NO LONGER ACTIVE; it is not needed with HHVM 3.25 and later.

Hack Error Suppressor Build Status

Unless the hhvm.hack.lang.look_for_typechecker ini setting is set to false, by default HHVM will try to run the typechecker when loading any Hack files, and raise a catchable runtime fatal error.

This is a PHP library that makes it convenient to temporarily disable this behavior.

When This Is Useful

HHVM's behavior is problematic when:

  • HHVM can't work out where the project root is - for example, if you're trying to run Hack code from a composer plugin
  • If your Hack code needs to operate on an incomplete project - for example, if you wish to write Hack code to fetch dependencies
  • If your Hack code needs to operate on known-bad projects - for example, when updating generated code, the code may be inconsistent while your codegen is in process

When You Shouldn't Use This

It's probably not appropriate if any of these are true:

  • it's used outside of a build/install or codegen process
  • it's used when using generated code
  • it's called during normal use of your software, rather than just by developers
  • it's used outside of the CLI

Typechecker errors are real problems with code, and mean that things are broken; ignoring enforcement is only a good idea if you are expecting your code to be running on a temporarily-broken codebase, and your code fixes it.

Installation

$ composer require fredemmott/hack-error-suppressor 

Usage

You must enable error suppression before any Hack code is loaded.

You can explicitly enable and disable the suppression:

<?php use FredEmmott\HackErrorSuppressor; $it = new HackErrorSuppressor(); $it->enable(); call_some_hack_code(); $it->disable();

You can also enable the suppression with a scope:

<?php use FredEmmott\ScopedHackErrorSuppressor; function do_unsafe_stuff() { $suppressor = new ScopedHackErrorSuppressor(); call_some_hack_code(); // this works } do_unsafe_stuff(); call_some_hack_code(); // this fails, as we're out of scope

Using Outside Of The CLI

This is disallowed by default; if you're absolutely certain you need to do this (keeping in mind that typechecker errors are real problems with your code, not just lint) you can disable the check:

FredEmmott\HackErrorSuppressor::allowRealRequestsAgainstBrokenCode();

fredemmott/hack-error-suppressor 适用场景与选型建议

fredemmott/hack-error-suppressor 是一款 基于 Hack 开发的 Composer 扩展包,目前已累计 505.73k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fredemmott/hack-error-suppressor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fredemmott/hack-error-suppressor 我们能提供哪些服务?
定制开发 / 二次开发

基于 fredemmott/hack-error-suppressor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 505.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 34
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: Hack

其他信息

  • 授权协议: ISC
  • 更新时间: 2026-01-04