Skip to content

Commit 75ed264

Browse files
authored
ci: fix pipeline (#320)
1 parent ab5289f commit 75ed264

File tree

9 files changed

+30
-33
lines changed

9 files changed

+30
-33
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,26 @@ jobs:
6464
- name: Cache LLVM and Clang
6565
id: cache-llvm
6666
uses: actions/cache@v3
67-
if: "!contains(matrix.os, 'windows')"
67+
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
68+
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
6869
with:
6970
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
7071
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
7172
- name: Setup LLVM & Clang
7273
id: clang
73-
uses: KyleMayes/install-llvm-action@v1
74-
if: "!contains(matrix.os, 'windows')"
74+
uses: KyleMayes/install-llvm-action@v2
75+
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
76+
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
7577
with:
7678
version: ${{ matrix.clang }}
7779
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
78-
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
7980
- name: Configure Clang
80-
if: "!contains(matrix.os, 'windows')"
81+
# Macos build doesn't work with clang < 18. As a build for version 18 is not available, we skip the setup
82+
if: "!contains(matrix.os, 'windows') && !contains(matrix.os, 'macos')"
8183
run: |
8284
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/lib" >> $GITHUB_ENV
8385
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
8486
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config" >> $GITHUB_ENV
85-
- name: Configure Clang (macOS only)
86-
if: "contains(matrix.os, 'macos')"
87-
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
8887
# Build
8988
- name: Build
9089
env:

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
230230

231231
const PHP_83_API_VER: u32 = 20230831;
232232

233+
println!("cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php_zts, php_debug, docs)");
233234
println!("cargo:rustc-cfg=php80");
234235

235236
if (PHP_81_API_VER..PHP_82_API_VER).contains(&version) {

crates/cli/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ impl Remove {
329329
.read(true)
330330
.write(true)
331331
.create(true)
332+
.truncate(false)
332333
.open(php_ini)
333334
.with_context(|| "Failed to open `php.ini`")?;
334335

crates/macros/src/method.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ pub enum Arg {
1818
Typed(function::Arg),
1919
}
2020

21-
#[derive(Debug)]
22-
pub struct AttrArgs {
23-
pub defaults: HashMap<String, Lit>,
24-
pub optional: Option<String>,
25-
pub visibility: Visibility,
26-
}
27-
2821
#[derive(Debug, Clone)]
2922
pub struct Method {
3023
/// Method name
@@ -51,7 +44,7 @@ pub struct ParsedMethod {
5144

5245
#[derive(Debug, Clone, Copy)]
5346
pub enum MethodType {
54-
Receiver { mutable: bool },
47+
Receiver,
5548
ReceiverClassObject,
5649
Static,
5750
}
@@ -176,7 +169,7 @@ pub fn parser(
176169
}
177170
} else {
178171
let this = match method_type {
179-
MethodType::Receiver { .. } => quote! { this. },
172+
MethodType::Receiver => quote! { this. },
180173
MethodType::ReceiverClassObject | MethodType::Static => quote! { Self:: },
181174
};
182175

@@ -309,9 +302,7 @@ fn build_args(
309302
if receiver.reference.is_none() {
310303
bail!("`self` parameter must be a reference.");
311304
}
312-
Ok(Arg::Receiver(MethodType::Receiver {
313-
mutable: receiver.mutability.is_some(),
314-
}))
305+
Ok(Arg::Receiver(MethodType::Receiver))
315306
}
316307
FnArg::Typed(ty) => {
317308
let mut this = false;

src/builders/class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ impl ClassBuilder {
153153
///
154154
/// * `T` - The type which will override the Zend object. Must implement
155155
/// [`RegisteredClass`]
156-
/// which can be derived using the [`php_class`](crate::php_class) attribute
157-
/// macro.
156+
/// which can be derived using the [`php_class`](crate::php_class) attribute
157+
/// macro.
158158
///
159159
/// # Panics
160160
///

src/class.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ impl<T> ClassMetadata<T> {
108108
}
109109
}
110110

111+
impl<T> Default for ClassMetadata<T> {
112+
fn default() -> Self {
113+
Self::new()
114+
}
115+
}
116+
111117
impl<T: RegisteredClass> ClassMetadata<T> {
112118
/// Returns an immutable reference to the object handlers contained inside
113119
/// the class metadata.

src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub use ext_php_rs_derive::php_extern;
153153
///
154154
/// - Most primitive integers ([`i8`], [`i16`], [`i32`], [`i64`], [`u8`],
155155
/// [`u16`], [`u32`], [`u64`],
156-
/// [`usize`], [`isize`])
156+
/// [`usize`], [`isize`])
157157
/// - Double-precision floating point numbers ([`f64`])
158158
/// - [`bool`]
159159
/// - [`String`]
@@ -164,9 +164,9 @@ pub use ext_php_rs_derive::php_extern;
164164
/// values.
165165
/// - [`Option<T>`] where `T: FromZval`. When used as a parameter, the parameter
166166
/// will be
167-
/// deemed nullable, and will contain [`None`] when `null` is passed. When used
168-
/// as a return type, if [`None`] is returned the [`Zval`] will be set to null.
169-
/// Optional parameters *must* be of the type [`Option<T>`].
167+
/// deemed nullable, and will contain [`None`] when `null` is passed. When used
168+
/// as a return type, if [`None`] is returned the [`Zval`] will be set to null.
169+
/// Optional parameters *must* be of the type [`Option<T>`].
170170
///
171171
/// Additionally, you are able to return a variant of [`Result<T, E>`]. `T` must
172172
/// implement [`IntoZval`] and `E` must implement `Into<PhpException>`. If an
@@ -324,14 +324,14 @@ pub use ext_php_rs_derive::php_function;
324324
///
325325
/// - `#[defaults(key = value, ...)]` for setting defaults of method variables,
326326
/// similar to the
327-
/// function macro. Arguments with defaults need to be optional.
327+
/// function macro. Arguments with defaults need to be optional.
328328
/// - `#[optional(key)]` for setting `key` as an optional argument (and
329329
/// therefore the rest of the
330-
/// arguments).
330+
/// arguments).
331331
/// - `#[public]`, `#[protected]` and `#[private]` for setting the visibility of
332332
/// the method,
333-
/// defaulting to public. The Rust visibility has no effect on the PHP
334-
/// visibility.
333+
/// defaulting to public. The Rust visibility has no effect on the PHP
334+
/// visibility.
335335
///
336336
/// Methods can take a immutable or a mutable reference to `self`, but cannot
337337
/// consume `self`. They can also take no reference to `self` which indicates a

src/types/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::{
77
ffi::CString,
88
fmt::{Debug, Display},
99
iter::FromIterator,
10-
u64,
1110
};
1211

1312
use crate::{

tests/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
120120
#[cfg(test)]
121121
mod integration {
122122
use std::env;
123-
use std::path::PathBuf;
123+
124124
use std::process::Command;
125125
use std::sync::Once;
126126

@@ -139,7 +139,7 @@ mod integration {
139139

140140
pub fn run_php(file: &str) -> bool {
141141
setup();
142-
let mut path = PathBuf::from(env::current_dir().expect("Could not get cwd"));
142+
let mut path = env::current_dir().expect("Could not get cwd");
143143
path.pop();
144144
path.push("target");
145145
path.push("debug");

0 commit comments

Comments
 (0)