Skip to content

Commit

Permalink
Add option to suppress experimental notices
Browse files Browse the repository at this point in the history
This commit introduces a new RAYAOP_QUIET macro which, when set, suppresses experimental notices for the Ray.Aop PHP extension. The option to enable or disable it is included in the config.m4 file.
  • Loading branch information
koriym committed Jul 10, 2024
1 parent cbff49b commit acf14f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ if test "$PHP_RAYAOP" != "no"; then
dnl Add instruction to install header files
dnl link https://www.phpinternalsbook.com/build_system/build_system.html#php-install-headers
PHP_INSTALL_HEADERS([ext/rayaop], [php_rayaop.h])

PHP_ARG_ENABLE(rayaop-quiet, whether to suppress experimental notices,
[ --enable-rayaop-quiet Suppress experimental notices], no, yes)

if test "$PHP_RAYAOP_QUIET" != "no"; then
AC_DEFINE(RAYAOP_QUIET, 1, [Whether to suppress experimental notices])
fi
fi
8 changes: 8 additions & 0 deletions rayaop.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

#define PHP_RAYAOP_VERSION "0.1.0"

#ifndef RAYAOP_QUIET
#define RAYAOP_QUIET 0
#endif

#include "php_rayaop.h" /* Include header file for RayAOP extension */

/* Declaration of module global variables */
Expand Down Expand Up @@ -332,6 +336,10 @@ PHP_MINIT_FUNCTION(rayaop) {
php_rayaop_init_globals(&rayaop_globals); /* Initialize global variables in non-thread-safe mode */
#endif

#if PHP_RAYAOP_EXPERIMENTAL && !RAYAOP_QUIET
php_error_docref(NULL, E_NOTICE, "The Ray.Aop extension is experimental. Its functions may change or be removed in future releases.");
#endif

zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Ray\\Aop\\MethodInterceptorInterface", ray_aop_method_interceptor_interface_methods);
/* Initialize class entry */
Expand Down

0 comments on commit acf14f1

Please sign in to comment.