From 1383c2515ea431a1fd0157b66832a0743a328686 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 4 Aug 2021 11:41:24 +0200
Subject: [PATCH 1/3] don't track these

---
 .gitignore   |   4 +
 configure.ac | 215 ---------------------------------------------------
 2 files changed, 4 insertions(+), 215 deletions(-)
 delete mode 100644 configure.ac

diff --git a/.gitignore b/.gitignore
index c198adb..c0dd937 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 *.lo
 *.swp
 .deps
+*.dep
 .libs
 Makefile
 Makefile.fragments
@@ -14,16 +15,19 @@ build
 config.guess
 config.h
 config.h.in
+config.h.in~
 config.log
 config.nice
 config.status
 config.sub
 configure
 configure.in
+configure.ac
 include
 install-sh
 libtool
 ltmain.sh
+ltmain.sh.backup
 missing
 mkinstalldirs
 modules
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index cdd0e12..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,215 +0,0 @@
-dnl This file becomes configure.ac for self-contained extensions.
-
-dnl Include external macro definitions before the AC_INIT to also remove
-dnl comments starting with # and empty newlines from the included files.
-m4_include([build/ax_check_compile_flag.m4])
-m4_include([build/ax_gcc_func_attribute.m4])
-m4_include([build/libtool.m4])
-m4_include([build/php_cxx_compile_stdcxx.m4])
-m4_include([build/php.m4])
-m4_include([build/pkg.m4])
-
-AC_PREREQ([2.68])
-AC_INIT
-AC_CONFIG_SRCDIR([config.m4])
-AC_CONFIG_AUX_DIR([build])
-AC_PRESERVE_HELP_ORDER
-
-PHP_CONFIG_NICE(config.nice)
-
-AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl
-AC_DEFUN([PHP_EXT_DIR],[""])dnl
-AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl
-AC_DEFUN([PHP_ALWAYS_SHARED],[
-  ext_output="yes, shared"
-  ext_shared=yes
-  test "[$]$1" = "no" && $1=yes
-])dnl
-
-test -z "$CFLAGS" && auto_cflags=1
-
-abs_srcdir=`(cd $srcdir && pwd)`
-abs_builddir=`pwd`
-
-PKG_PROG_PKG_CONFIG
-AC_PROG_CC([cc gcc])
-PHP_DETECT_ICC
-PHP_DETECT_SUNCC
-
-dnl Support systems with system libraries in e.g. /usr/lib64.
-PHP_ARG_WITH([libdir],
-  [for system library directory],
-  [AS_HELP_STRING([--with-libdir=NAME],
-    [Look for libraries in .../NAME rather than .../lib])],
-  [lib],
-  [no])
-
-PHP_RUNPATH_SWITCH
-PHP_SHLIB_SUFFIX_NAMES
-
-dnl Find php-config script.
-PHP_ARG_WITH([php-config],,
-  [AS_HELP_STRING([--with-php-config=PATH],
-    [Path to php-config [php-config]])],
-  [php-config],
-  [no])
-
-dnl For BC.
-PHP_CONFIG=$PHP_PHP_CONFIG
-prefix=`$PHP_CONFIG --prefix 2>/dev/null`
-phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null`
-INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
-EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`
-PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null`
-
-if test -z "$prefix"; then
-  AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH])
-fi
-
-php_shtool=$srcdir/build/shtool
-PHP_INIT_BUILD_SYSTEM
-
-AC_MSG_CHECKING([for PHP prefix])
-AC_MSG_RESULT([$prefix])
-AC_MSG_CHECKING([for PHP includes])
-AC_MSG_RESULT([$INCLUDES])
-AC_MSG_CHECKING([for PHP extension directory])
-AC_MSG_RESULT([$EXTENSION_DIR])
-AC_MSG_CHECKING([for PHP installed headers prefix])
-AC_MSG_RESULT([$phpincludedir])
-
-dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS.
-AC_MSG_CHECKING([if debug is enabled])
-old_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="-I$phpincludedir"
-AC_EGREP_CPP(php_debug_is_enabled,[
-#include <main/php_config.h>
-#if ZEND_DEBUG
-php_debug_is_enabled
-#endif
-],[
-  PHP_DEBUG=yes
-],[
-  PHP_DEBUG=no
-])
-CPPFLAGS=$old_CPPFLAGS
-AC_MSG_RESULT([$PHP_DEBUG])
-
-AC_MSG_CHECKING([if zts is enabled])
-old_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="-I$phpincludedir"
-AC_EGREP_CPP(php_zts_is_enabled,[
-#include <main/php_config.h>
-#if ZTS
-php_zts_is_enabled
-#endif
-],[
-  PHP_THREAD_SAFETY=yes
-],[
-  PHP_THREAD_SAFETY=no
-])
-CPPFLAGS=$old_CPPFLAGS
-AC_MSG_RESULT([$PHP_THREAD_SAFETY])
-
-dnl Discard optimization flags when debugging is enabled.
-if test "$PHP_DEBUG" = "yes"; then
-  PHP_DEBUG=1
-  ZEND_DEBUG=yes
-  changequote({,})
-  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
-  CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
-  changequote([,])
-  dnl Add -O0 only if GCC or ICC is used.
-  if test "$GCC" = "yes" || test "$ICC" = "yes"; then
-    CFLAGS="$CFLAGS -O0"
-    CXXFLAGS="$CXXFLAGS -g -O0"
-  fi
-  if test "$SUNCC" = "yes"; then
-    if test -n "$auto_cflags"; then
-      CFLAGS="-g"
-      CXXFLAGS="-g"
-    else
-      CFLAGS="$CFLAGS -g"
-      CXXFLAGS="$CFLAGS -g"
-    fi
-  fi
-else
-  PHP_DEBUG=0
-  ZEND_DEBUG=no
-fi
-
-dnl Always shared.
-PHP_BUILD_SHARED
-
-dnl Required programs.
-PHP_PROG_AWK
-
-sinclude(config.m4)
-
-enable_static=no
-enable_shared=yes
-
-dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by
-dnl PHP_REQUIRE_CXX). Otherwise AC_PROG_LIBTOOL fails if there is no working C++
-dnl compiler.
-AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
-  undefine([AC_PROG_CXX])
-  AC_DEFUN([AC_PROG_CXX], [])
-  undefine([AC_PROG_CXXCPP])
-  AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
-])
-AC_PROG_LIBTOOL
-
-all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
-install_targets="install-modules install-headers"
-phplibdir="`pwd`/modules"
-CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
-CFLAGS_CLEAN='$(CFLAGS)'
-CXXFLAGS_CLEAN='$(CXXFLAGS)'
-
-test "$prefix" = "NONE" && prefix="/usr/local"
-test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
-
-PHP_SUBST(PHP_MODULES)
-PHP_SUBST(PHP_ZEND_EX)
-
-PHP_SUBST(all_targets)
-PHP_SUBST(install_targets)
-
-PHP_SUBST(prefix)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(libdir)
-PHP_SUBST(prefix)
-PHP_SUBST(phplibdir)
-PHP_SUBST(phpincludedir)
-
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CFLAGS_CLEAN)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(CXXFLAGS)
-PHP_SUBST(CXXFLAGS_CLEAN)
-PHP_SUBST(EXTENSION_DIR)
-PHP_SUBST(PHP_EXECUTABLE)
-PHP_SUBST(EXTRA_LDFLAGS)
-PHP_SUBST(EXTRA_LIBS)
-PHP_SUBST(INCLUDES)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(LDFLAGS)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(SHELL)
-PHP_SUBST(INSTALL_HEADERS)
-
-PHP_GEN_BUILD_DIRS
-PHP_GEN_GLOBAL_MAKEFILE
-
-test -d modules || $php_shtool mkdir modules
-
-AC_CONFIG_HEADERS([config.h])
-
-AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([config.h.in])])
-
-AC_OUTPUT

From c5c97dc6750057807db318a6e587a62e3c751c97 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 4 Aug 2021 11:41:50 +0200
Subject: [PATCH 2/3] fix proto for 8.1.0beta2

---
 metadata_collection.c         | 8 +++++++-
 metadata_collection.stub.php  | 8 ++++----
 metadata_collection_arginfo.h | 7 ++++---
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/metadata_collection.c b/metadata_collection.c
index 3af8357..c3b086a 100644
--- a/metadata_collection.c
+++ b/metadata_collection.c
@@ -39,9 +39,15 @@
 #include "php_simple_kafka_client_int.h"
 #include "ext/spl/spl_iterators.h"
 #include "Zend/zend_interfaces.h"
-#include "metadata_collection_arginfo.h"
 #include "Zend/zend_exceptions.h"
 
+#if PHP_VERSION_ID < 80100
+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+        ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
+#endif
+
+#include "metadata_collection_arginfo.h"
+
 typedef struct _object_intern {
     zval                             zmetadata;
     const void                       *items;
diff --git a/metadata_collection.stub.php b/metadata_collection.stub.php
index 6771a13..9aeaec9 100644
--- a/metadata_collection.stub.php
+++ b/metadata_collection.stub.php
@@ -10,13 +10,13 @@ public function count(): int {}
 
     public function rewind(): void {}
 
-    /** @return mixed */
-    public function current() {}
+    /** @tentative-return-type */
+    public function current(): mixed {}
 
     public function key(): int {}
 
-    /** @return mixed */
-    public function next() {}
+    /** @tentative-return-type */
+    public function next(): void {}
 
     public function valid(): bool {}
 }
diff --git a/metadata_collection_arginfo.h b/metadata_collection_arginfo.h
index ce1df7e..7da4de4 100644
--- a/metadata_collection_arginfo.h
+++ b/metadata_collection_arginfo.h
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 925cbd1dcf14595ae437c111d3f99f767a665006 */
+ * Stub hash: c130cfc464b41b677ecde96328b3417797b5176d */
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_count, 0, 0, IS_LONG, 0)
 ZEND_END_ARG_INFO()
@@ -7,12 +7,13 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_rewind, 0, 0, IS_VOID, 0)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_current, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_current, 0, 0, IS_MIXED, 0)
 ZEND_END_ARG_INFO()
 
 #define arginfo_class_SimpleKafkaClient_Metadata_Collection_key arginfo_class_SimpleKafkaClient_Metadata_Collection_count
 
-#define arginfo_class_SimpleKafkaClient_Metadata_Collection_next arginfo_class_SimpleKafkaClient_Metadata_Collection_current
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SimpleKafkaClient_Metadata_Collection_valid, 0, 0, _IS_BOOL, 0)
 ZEND_END_ARG_INFO()

From 9fc3134129fc48c4839abd57a1e851ca685f847a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 4 Aug 2021 11:51:19 +0200
Subject: [PATCH 3/3] add stub to pecl archive

---
 package.xml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package.xml b/package.xml
index 935f9cf..263b0f0 100644
--- a/package.xml
+++ b/package.xml
@@ -38,34 +38,48 @@
    <file role="src" name="config.w32"/>
    <file role="src" name="configuration.c"/>
    <file role="src" name="configuration_arginfo.h"/>
+   <file role="src" name="configuration.stub.php"/>
    <file role="src" name="consumer.c"/>
    <file role="src" name="consumer_arginfo.h"/>
+   <file role="src" name="consumer.stub.php"/>
    <file role="src" name="functions.c"/>
    <file role="src" name="functions_arginfo.h"/>
+   <file role="src" name="functions.stub.php"/>
    <file role="src" name="simple_kafka_client.c"/>
    <file role="src" name="simple_kafka_client_arginfo.h"/>
+   <file role="src" name="simple_kafka_client.stub.php"/>
    <file role="src" name="kafka_exception.c"/>
    <file role="src" name="kafka_exception_arginfo.h"/>
+   <file role="src" name="kafka_exception.stub.php"/>
    <file role="src" name="message.c"/>
    <file role="src" name="message_arginfo.h"/>
+   <file role="src" name="message.stub.php"/>
    <file role="src" name="metadata.c"/>
    <file role="src" name="metadata_arginfo.h"/>
+   <file role="src" name="metadata.stub.php"/>
    <file role="src" name="metadata_broker.c"/>
    <file role="src" name="metadata_broker_arginfo.h"/>
+   <file role="src" name="metadata_broker.stub.php"/>
    <file role="src" name="metadata_collection.c"/>
    <file role="src" name="metadata_collection_arginfo.h"/>
+   <file role="src" name="metadata_collection.stub.php"/>
    <file role="src" name="metadata_partition.c"/>
    <file role="src" name="metadata_partition_arginfo.h"/>
+   <file role="src" name="metadata_partition.stub.php"/>
    <file role="src" name="metadata_topic.c"/>
    <file role="src" name="metadata_topic_arginfo.h"/>
+   <file role="src" name="metadata_topic.stub.php"/>
    <file role="src" name="php_simple_kafka_client_int.h"/>
    <file role="src" name="producer.c"/>
    <file role="src" name="producer_arginfo.h"/>
+   <file role="src" name="producer.stub.php"/>
    <file role="src" name="simple_kafka_client.c"/>
    <file role="src" name="topic.c"/>
    <file role="src" name="topic_arginfo.h"/>
+   <file role="src" name="topic.stub.php"/>
    <file role="src" name="topic_partition.c"/>
    <file role="src" name="topic_partition_arginfo.h"/>
+   <file role="src" name="topic_partition.stub.php"/>
    <dir name="tests">
     <file role="test" name="allow_null_payload.phpt"/>
     <file role="test" name="allow_null_payload_and_key.phpt"/>