repo
stringlengths
5
53
pr_number
int32
1
321k
task_type
stringclasses
2 values
issue_text
stringlengths
0
81.2k
pr_title
stringlengths
1
319
pr_body
stringlengths
0
105k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
gold_diff
stringlengths
0
202M
changed_files
listlengths
0
100
review_threads
listlengths
0
100
test_patch
stringlengths
0
23.4M
merged
bool
1 class
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The zero-length filtering is what makes statically-loaded artifacts return an empty result, but the added tests only cover freshly compiled sys modules and a v8 module. Add coverage for a static-artifact-load path so this public contract does not regress if function lengths start being populated or the filtering change...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "The zero-length filtering is what makes statically-loaded artifacts return an empty result, but the added tests only cover freshly compiled sys modules and a v8 module. Add coverage for a static-artifact-load path so this public contract does not regress if function lengths start being populated o...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
This test is asserting the wrong behavior for `Module::serialize()`/`Module::deserialize()`: those bytes are recognized as a Wasmer engine artifact and `Artifact::deserialize` re-allocates the function bodies via `from_parts`, which populates real function lengths. The result should therefore contain extents, so this a...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/tests/module.rs b/lib/api/tests/module.rs index df286eb3ee78..7824eb070015 100644 --- a/lib/api/tests/module.rs +++ b/lib/api/tests/module.rs @@ -296,6 +296,106 @@ fn module_custom_sections() -> Result<(), String> { Ok(()) } +#[cfg(all( + not(target_arch = "wasm32"), + any(feature = "...
[ "lib/api/tests/module.rs" ]
[ { "comment": "This test is asserting the wrong behavior for `Module::serialize()`/`Module::deserialize()`: those bytes are recognized as a Wasmer engine artifact and `Artifact::deserialize` re-allocates the function bodies via `from_parts`, which populates real function lengths. The result should therefore cont...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
I think the more logical place for the functionality would be an `Instance` rather than `Module`? Please also take into account a pretty similar functionality:https://github.com/wasmerio/wasmer/blob/6b056173758413c6b6817300df78da545d6442ce/lib/compiler/src/engine/inner.rs#L550-L591 I thought we might want to communic...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/src/backend/sys/entities/module.rs b/lib/api/src/backend/sys/entities/module.rs index 4e6ae276fa1d..2ce2b9dc4e02 100644 --- a/lib/api/src/backend/sys/entities/module.rs +++ b/lib/api/src/backend/sys/entities/module.rs @@ -287,4 +287,21 @@ impl crate::Module { _ => panic!("Not a `sys` m...
[ "lib/api/src/backend/sys/entities/module.rs" ]
[ { "comment": "I think the more logical place for the functionality would be an `Instance` rather than `Module`?\n\nPlease also take into account a pretty similar functionality:https://github.com/wasmerio/wasmer/blob/6b056173758413c6b6817300df78da545d6442ce/lib/compiler/src/engine/inner.rs#L550-L591\n\nI thought...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Zipping `finished_functions.iter()` with `finished_function_lengths.values()` will silently truncate to the shorter iterator if the two collections ever diverge in length (e.g., corrupted/partial artifacts), dropping extents without any signal. Prefer iterating by index and looking up the corresponding length (or itera...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "Zipping `finished_functions.iter()` with `finished_function_lengths.values()` will silently truncate to the shorter iterator if the two collections ever diverge in length (e.g., corrupted/partial artifacts), dropping extents without any signal. Prefer iterating by index and looking up the correspo...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
There are two consecutive `#[test]` attributes on the same function. This is redundant and should be reduced to a single `#[test]`.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/tests/module.rs b/lib/api/tests/module.rs index df286eb3ee78..7824eb070015 100644 --- a/lib/api/tests/module.rs +++ b/lib/api/tests/module.rs @@ -296,6 +296,106 @@ fn module_custom_sections() -> Result<(), String> { Ok(()) } +#[cfg(all( + not(target_arch = "wasm32"), + any(feature = "...
[ "lib/api/tests/module.rs" ]
[ { "comment": "There are two consecutive `#[test]` attributes on the same function. This is redundant and should be reduced to a single `#[test]`.\n", "path": "lib/api/tests/module.rs", "hunk": "@@ -296,6 +296,103 @@ fn module_custom_sections() -> Result<(), String> {\n Ok(())\n }\n \n+/// Returns a ...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Returning `&Arc<Artifact>` exposes the ownership wrapper in the public API and makes it harder to change internal ownership later. Consider returning `&Artifact` instead (by dereferencing the stored `Arc`) or adding a narrower API (e.g., a `finished_function_extents()` method on `Module`) to avoid exposing the full `Ar...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/src/backend/sys/entities/module.rs b/lib/api/src/backend/sys/entities/module.rs index 4e6ae276fa1d..2ce2b9dc4e02 100644 --- a/lib/api/src/backend/sys/entities/module.rs +++ b/lib/api/src/backend/sys/entities/module.rs @@ -287,4 +287,21 @@ impl crate::Module { _ => panic!("Not a `sys` m...
[ "lib/api/src/backend/sys/entities/module.rs" ]
[ { "comment": "Returning `&Arc<Artifact>` exposes the ownership wrapper in the public API and makes it harder to change internal ownership later. Consider returning `&Artifact` instead (by dereferencing the stored `Arc`) or adding a narrower API (e.g., a `finished_function_extents()` method on `Module`) to avoid...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
`artifact()` calls `as_sys()` which panics when the module is not a `sys` module. Since this is a public method on `crate::Module`, please either (a) make the API non-panicking (e.g., return `Option<&Artifact>`/`Result<&Artifact, _>`), or (b) explicitly document the panic condition in the doc comment (e.g., `# Panics` ...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/src/backend/sys/entities/module.rs b/lib/api/src/backend/sys/entities/module.rs index 4e6ae276fa1d..2ce2b9dc4e02 100644 --- a/lib/api/src/backend/sys/entities/module.rs +++ b/lib/api/src/backend/sys/entities/module.rs @@ -287,4 +287,21 @@ impl crate::Module { _ => panic!("Not a `sys` m...
[ "lib/api/src/backend/sys/entities/module.rs" ]
[ { "comment": "`artifact()` calls `as_sys()` which panics when the module is not a `sys` module. Since this is a public method on `crate::Module`, please either (a) make the API non-panicking (e.g., return `Option<&Artifact>`/`Result<&Artifact, _>`), or (b) explicitly document the panic condition in the doc comm...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The test constructs a raw pointer from an integer address. This can be problematic under stricter provenance models / when running under tools like Miri. Prefer creating a clearly non-null, non-dereferenced pointer via a safer pattern (e.g., using `NonNull::<VMFunctionBody>::dangling().as_ptr()` and casting to `*const ...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "The test constructs a raw pointer from an integer address. This can be problematic under stricter provenance models / when running under tools like Miri. Prefer creating a clearly non-null, non-dereferenced pointer via a safer pattern (e.g., using `NonNull::<VMFunctionBody>::dangling().as_ptr()` a...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The same `#[cfg(all(...))]` condition is duplicated on `sys_store()` and each test. To reduce duplication and keep the conditions in sync, consider wrapping `sys_store` + these tests in a single `#[cfg(all(...))] mod function_extents_tests { ... }` and applying the cfg once at the module level.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/tests/module.rs b/lib/api/tests/module.rs index df286eb3ee78..7824eb070015 100644 --- a/lib/api/tests/module.rs +++ b/lib/api/tests/module.rs @@ -296,6 +296,106 @@ fn module_custom_sections() -> Result<(), String> { Ok(()) } +#[cfg(all( + not(target_arch = "wasm32"), + any(feature = "...
[ "lib/api/tests/module.rs" ]
[ { "comment": "The same `#[cfg(all(...))]` condition is duplicated on `sys_store()` and each test. To reduce duplication and keep the conditions in sync, consider wrapping `sys_store` + these tests in a single `#[cfg(all(...))] mod function_extents_tests { ... }` and applying the cfg once at the module level.", ...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Using `assert_eq!` here can panic in release builds if the artifact state is inconsistent/corrupted (e.g., from deserialization), which is a reliability/DoS footgun for a public-facing accessor. Prefer making this non-panicking: use `debug_assert_eq!` plus a release-path fallback (e.g., iterate up to the min length / z...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "Using `assert_eq!` here can panic in release builds if the artifact state is inconsistent/corrupted (e.g., from deserialization), which is a reliability/DoS footgun for a public-facing accessor. Prefer making this non-panicking: use `debug_assert_eq!` plus a release-path fallback (e.g., iterate up...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
This builds a `FunctionExtent` for every entry and then filters; you can avoid that extra work by using `filter_map` and only constructing `FunctionExtent` when `length > 0`. If this accessor is expected to be called frequently, consider an API that avoids allocating a new `Vec` each call (e.g., returning an iterator/v...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "This builds a `FunctionExtent` for every entry and then filters; you can avoid that extra work by using `filter_map` and only constructing `FunctionExtent` when `length > 0`. If this accessor is expected to be called frequently, consider an API that avoids allocating a new `Vec` each call (e.g., r...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
In release builds, a mismatch between `finished_functions` and `finished_function_lengths` will be silently masked by `unwrap_or(0)`, causing missing/incorrect extents. Consider making the release behavior explicit: either return `vec![]` when lengths don’t match, or use `get(index).expect(...)` (and/or a non-debug `as...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "In release builds, a mismatch between `finished_functions` and `finished_function_lengths` will be silently masked by `unwrap_or(0)`, causing missing/incorrect extents. Consider making the release behavior explicit: either return `vec![]` when lengths don’t match, or use `get(index).expect(...)` (...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The doc comment explains the empty-vec behavior for statically-loaded artifacts, but the function also returns an empty vec when `self.allocated` is `None` (e.g., cross-compilation targets). Consider documenting this second case explicitly so callers understand why they might get no extents.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "The doc comment explains the empty-vec behavior for statically-loaded artifacts, but the function also returns an empty vec when `self.allocated` is `None` (e.g., cross-compilation targets). Consider documenting this second case explicitly so callers understand why they might get no extents.", ...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Using `unwrap()` here will panic without much context if the test ever runs with a non-`sys` backend module. Using `expect(\"...\")` would make failures more actionable (e.g., `expect(\"expected sys-backend module artifact\")`).
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/tests/module.rs b/lib/api/tests/module.rs index df286eb3ee78..7824eb070015 100644 --- a/lib/api/tests/module.rs +++ b/lib/api/tests/module.rs @@ -296,6 +296,106 @@ fn module_custom_sections() -> Result<(), String> { Ok(()) } +#[cfg(all( + not(target_arch = "wasm32"), + any(feature = "...
[ "lib/api/tests/module.rs" ]
[ { "comment": "Using `unwrap()` here will panic without much context if the test ever runs with a non-`sys` backend module. Using `expect(\\\"...\\\")` would make failures more actionable (e.g., `expect(\\\"expected sys-backend module artifact\\\")`).", "path": "lib/api/tests/module.rs", "hunk": "@@ -296...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Adding `artifact()` directly on `crate::Module` exposes a sys-specific API on the primary module type (when the sys backend is enabled), which can encourage non-portable usage across backends. Consider moving this accessor to a sys-specific type/extension trait (e.g., under `wasmer::sys`), or rename it to make the back...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/src/backend/sys/entities/module.rs b/lib/api/src/backend/sys/entities/module.rs index 4e6ae276fa1d..2ce2b9dc4e02 100644 --- a/lib/api/src/backend/sys/entities/module.rs +++ b/lib/api/src/backend/sys/entities/module.rs @@ -287,4 +287,21 @@ impl crate::Module { _ => panic!("Not a `sys` m...
[ "lib/api/src/backend/sys/entities/module.rs" ]
[ { "comment": "Adding `artifact()` directly on `crate::Module` exposes a sys-specific API on the primary module type (when the sys backend is enabled), which can encourage non-portable usage across backends. Consider moving this accessor to a sys-specific type/extension trait (e.g., under `wasmer::sys`), or rena...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
On internal-state inconsistency, this falls back to returning an empty vector in release builds, which can silently mask artifact corruption/bugs and make production diagnosis difficult. Consider returning a `Result<_, _>` (or at least emitting a `tracing::warn!`/`log::warn!` before returning) so callers and operators ...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "On internal-state inconsistency, this falls back to returning an empty vector in release builds, which can silently mask artifact corruption/bugs and make production diagnosis difficult. Consider returning a `Result<_, _>` (or at least emitting a `tracing::warn!`/`log::warn!` before returning) so ...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
This always allocates and collects a new `Vec`, which could be noticeable if used in hot paths (profiling/introspection loops). If this is expected to be called frequently, consider offering a non-allocating alternative (e.g., an iterator-returning method) or pre-allocating with `Vec::with_capacity(allocated.finished_f...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "This always allocates and collects a new `Vec`, which could be noticeable if used in hot paths (profiling/introspection loops). If this is expected to be called frequently, consider offering a non-allocating alternative (e.g., an iterator-returning method) or pre-allocating with `Vec::with_capacit...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The method currently relies on a global length equality check to ensure `allocated.finished_function_lengths[index]` can’t panic, and duplicates the invariant check in both `debug_assert_eq!` and a runtime `if`. Consider making the iteration robust to mismatches by using a safe lookup (e.g., `get(index)`) and filtering...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "The method currently relies on a global length equality check to ensure `allocated.finished_function_lengths[index]` can’t panic, and duplicates the invariant check in both `debug_assert_eq!` and a runtime `if`. Consider making the iteration robust to mismatches by using a safe lookup (e.g., `get(...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
`Artifact` now becomes straightforward to reach from the public API, and `Artifact::finished_function_extents()` exposes raw code addresses via `FunctionExtent`. Exposing process memory addresses can be sensitive (e.g., ASLR/addr disclosure) in scenarios where library consumers might pass these values across trust boun...
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/api/src/backend/sys/entities/module.rs b/lib/api/src/backend/sys/entities/module.rs index 4e6ae276fa1d..2ce2b9dc4e02 100644 --- a/lib/api/src/backend/sys/entities/module.rs +++ b/lib/api/src/backend/sys/entities/module.rs @@ -287,4 +287,21 @@ impl crate::Module { _ => panic!("Not a `sys` m...
[ "lib/api/src/backend/sys/entities/module.rs" ]
[ { "comment": "`Artifact` now becomes straightforward to reach from the public API, and `Artifact::finished_function_extents()` exposes raw code addresses via `FunctionExtent`. Exposing process memory addresses can be sensitive (e.g., ASLR/addr disclosure) in scenarios where library consumers might pass these va...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
The signature should be `Option<Vec<..>>`, where None is returned for cross-compiled functions.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "The signature should be `Option<Vec<..>>`, where None is returned for cross-compiled functions.", "path": "lib/compiler/src/engine/artifact.rs", "hunk": "@@ -786,6 +786,40 @@ impl Artifact {\n .finished_functions\n }\n \n+ /// Returns the start address and byte length of...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
I would drop the part: `or statically-loaded artifacts /// (where function lengths are not recorded), and also when the artifact's /// internal state is inconsistent.`
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "I would drop the part:\n`or statically-loaded artifacts\n /// (where function lengths are not recorded), and also when the artifact's\n /// internal state is inconsistent.`", "path": "lib/compiler/src/engine/artifact.rs", "hunk": "@@ -786,6 +786,40 @@ impl Artifact {\n .f...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
I would make it `assert_eq` and drop the `if` following the assert.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "I would make it `assert_eq` and drop the `if` following the assert.", "path": "lib/compiler/src/engine/artifact.rs", "hunk": "@@ -786,6 +786,40 @@ impl Artifact {\n .finished_functions\n }\n \n+ /// Returns the start address and byte length of each locally-defined\n+ ...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Let's return all finished functions, do not filter out some. I think the `length == 0` should not be reachable.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "Let's return all finished functions, do not filter out some. I think the `length == 0` should not be reachable.", "path": "lib/compiler/src/engine/artifact.rs", "hunk": "@@ -786,6 +786,40 @@ impl Artifact {\n .finished_functions\n }\n \n+ /// Returns the start address an...
true
wasmerio/wasmer
6,603
comment_to_fix
Add `Artifact::finished_function_extents()` to expose compiled function body locations
Don't like this artificially built `ArtifactBuild`, please drop this tests.
4263a29798a884562904cb8a9e8643358957bfae
6e1c967952fa549a1d16c56a2995c202ff2b15d5
diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 9c03a0ec9956..f2be6afe9d49 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -786,6 +786,38 @@ impl Artifact { .finished_functions } + /// Returns the start add...
[ "lib/compiler/src/engine/artifact.rs" ]
[ { "comment": "Don't like this artificially built `ArtifactBuild`, please drop this tests.", "path": "lib/compiler/src/engine/artifact.rs", "hunk": "@@ -1302,3 +1336,88 @@ impl Artifact {\n }\n }\n }\n+\n+#[cfg(test)]", "resolving_sha": "6e1c967952fa549a1d16c56a2995c202ff2b15d5", "res...
true
wasmerio/wasmer
6,633
issue_to_patch
fix(wasix): Don't log error on HostInterrupt as it's expected behaviour
We've introduced new `HostInterrupt` behaviour a few weeks ago and currently we are almost hitting rate limits in Sentry in Edge. I think we should simply silence that as it's totally normal behavour Fixes https://linear.app/wasmer/issue/EDGE-1775/sentry-runtimeerror-interrupted-by-host
e453321650ba2843d2070458c92cddb6971a8a41
a1edfe3241475d56b615641ad8d223bccb9a7c7c
diff --git a/lib/wasix/src/bin_factory/exec.rs b/lib/wasix/src/bin_factory/exec.rs index d1a75ba35a6a..76b938aeceaf 100644 --- a/lib/wasix/src/bin_factory/exec.rs +++ b/lib/wasix/src/bin_factory/exec.rs @@ -381,8 +381,16 @@ fn call_module( Some(s) => s, None => { let err_displ...
[ "lib/wasix/src/bin_factory/exec.rs", "lib/wasix/src/syscalls/wasix/thread_spawn.rs" ]
[]
true
wasmerio/wasmer
6,632
issue_to_patch
chore: unify registry setting for the CLI int. tests (and enable them)
# Description - reenabled integration tests - added explicit registry URL var for tests - gitignore `.env`
e6cf863f4198a4d40254ebe754fc2635a552f1ce
edb89d89faa282fc82783830a0852531d98b303a
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6b19276e787b..d4e2e10412ab 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -609,9 +609,8 @@ jobs: make: "test-wasmer-cli" - description: "Examples" make: "test-examples" - ...
[ ".github/workflows/test.yaml", ".gitignore", "tests/integration/cli/src/util.rs", "tests/integration/cli/tests/config.rs", "tests/integration/cli/tests/create.rs", "tests/integration/cli/tests/create_exe.rs", "tests/integration/cli/tests/deploy.rs", "tests/integration/cli/tests/gen_c_header.rs", "te...
[]
diff --git a/tests/integration/cli/src/util.rs b/tests/integration/cli/src/util.rs index 5fd438660855..de3445a5ff1e 100644 --- a/tests/integration/cli/src/util.rs +++ b/tests/integration/cli/src/util.rs @@ -2,6 +2,23 @@ use anyhow::bail; use std::path::Path; use std::process::Command; +use crate::assets::get_wasmer...
true
webmozarts/assert
357
issue_to_patch
Psalm refactoring
Various psalm-related fixes: - Turn all @psalm-param and @psalm-return annotations into @param and @return annotations (this avoids issues where @psalm- annotations are treated as second-class and forgotten about, and thus proper types aren't even mentioned in some cases). All major IDEs already support Psalm syntax...
ea4ed4b68148a0b1572e3f61ad6505287be1ebba
dc7536482a1375741c6a33aed4c0d62832b51679
diff --git a/README.md b/README.md index d8f414f1..fef4eda5 100644 --- a/README.md +++ b/README.md @@ -271,7 +271,14 @@ Overriding the following methods in your assertion class allows you to change th ## Static analysis support Where applicable, assertion functions are annotated to support Psalm's -[Assertion synta...
[ "README.md", "bin/generate.php", "bin/src/MixinGenerator.php", "bin/src/StaticAnalysisNonReturnGenerator.php", "composer.json", "psalm.xml", "src/Assert.php", "src/HasAssert.php", "src/Mixin.php", "src/PsalmPlugin.php", "tests/ProjectCodeTest.php", "tests/static-analysis/assert-alnum.php", "...
[ { "comment": "Why?", "path": "bin/src/MixinGenerator.php", "hunk": "@@ -351,7 +393,13 @@ private function reduceParameterType(ReflectionType $type): string\n return \\implode('|', \\array_map([$this, 'reduceParameterType'], $type->getTypes()));\n }\n \n- $type = Assert::isInst...
diff --git a/tests/ProjectCodeTest.php b/tests/ProjectCodeTest.php index 1afb7286..a7b2a2d7 100644 --- a/tests/ProjectCodeTest.php +++ b/tests/ProjectCodeTest.php @@ -11,6 +11,7 @@ use ReflectionClass; use ReflectionMethod; use Webmozart\Assert\Bin\MixinGenerator; +use Webmozart\Assert\Bin\StaticAnalysisNonReturnGen...
true
webmozarts/assert
357
comment_to_fix
Psalm refactoring
Why?
ea4ed4b68148a0b1572e3f61ad6505287be1ebba
dc7536482a1375741c6a33aed4c0d62832b51679
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index aa82e65e..61b3d880 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -56,6 +56,35 @@ final class MixinGenerator 'allNullOrNotNull', // meaningless ]; + /** + * @var array<string, bool> + *...
[ "bin/src/MixinGenerator.php" ]
[ { "comment": "Why?", "path": "bin/src/MixinGenerator.php", "hunk": "@@ -351,7 +393,13 @@ private function reduceParameterType(ReflectionType $type): string\n return \\implode('|', \\array_map([$this, 'reduceParameterType'], $type->getTypes()));\n }\n \n- $type = Assert::isInst...
true
webmozarts/assert
357
comment_to_fix
Psalm refactoring
This should be part of the test-specific composer.json, not the primary one.
ea4ed4b68148a0b1572e3f61ad6505287be1ebba
dc7536482a1375741c6a33aed4c0d62832b51679
diff --git a/composer.json b/composer.json index 18f625ce..6c816f63 100644 --- a/composer.json +++ b/composer.json @@ -40,8 +40,12 @@ } }, "extra": { + "psalm": { + "pluginClass": "Webmozart\\Assert\\PsalmPlugin" + }, "branch-alias": { - "dev-feature/2-0":...
[ "composer.json" ]
[ { "comment": "This should be part of the test-specific composer.json, not the primary one.", "path": "composer.json", "hunk": "@@ -63,5 +67,8 @@\n \"cs-fix\": \"./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix\",\n \"static-analysis\": \"./tools/psalm/vendor/bin/psalm --threads=4 --root=...
true
webmozarts/assert
358
issue_to_patch
Fix PHPDoc generics for isInstanceOfAny
Originally, the method used `@param T $value`, which already implied the asserted type and therefore did not provide any type narrowing through `@psalm-assert`. By changing the parameter type to `mixed` and typing `$classes` param, static analyzers can now correctly understand and infer the asserted object type. Ori...
adfc4bf43c1f6c348d8c9bb4526d65d429c8321f
cf711fabd11c7aa8a7034645cb90bbec32c0e8fe
diff --git a/src/Assert.php b/src/Assert.php index 9a484c8f..d1047282 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -592,7 +592,8 @@ public static function notInstanceOf(mixed $value, mixed $class, string|callable * * @psalm-assert T $value * - * @param T $value + * @param mixed $value +...
[ "src/Assert.php", "src/Mixin.php" ]
[]
true
webmozarts/assert
353
issue_to_patch
Add support for lazy messages On some occasions, in order to provide a helpful error message, more processing is required to provide a helpful message: ```php $message = $createMessage(...); // heavy stuff happening there Assert::smth(..., $message); ``` Maybe it would be cool to have support for `$message`...
Add support for lazy assertion messages
Closes #265 ## Summary This PR adds support for lazy assertion messages by allowing `$message` to be either a string or a callable returning a string. The callable is only executed when the assertion fails, avoiding unnecessary computation in the success case. ## Changes - Allow `string|callable():string` fo...
b843ecf58ae8f3e7c170cab4052792001da5d2c5
570f2c8eebb76b3ba41138e1f3dc92c3669e2cf1
diff --git a/README.md b/README.md index c809ea08..9b9dea13 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,16 @@ Assert::nullOrString($middleName, 'The middle name must be a string or null. Got The `Assert` class comes with a few methods, which can be overridden to change the class behaviour. You can also exten...
[ "README.md", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php" ]
[ { "comment": "```suggestion\n if ($args === []) {\n```", "path": "tests/AssertTest.php", "hunk": "@@ -661,6 +669,101 @@ public function testAssert(string $method, array $args, bool $success, bool $mul\n $this->assertSame($args[array_key_first($args)], $result);\n }\n \n+ #[DataProv...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 1d1c816a..6c947c5b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -38,6 +38,13 @@ class AssertTest extends TestCase 'isInitialized', ]; + private const SKIP_CUSTOM_MESSAGE_TESTS = [ + 'isAOf', + 'isAnyOf', +...
true
webmozarts/assert
353
comment_to_fix
Add support for lazy assertion messages
```suggestion if ($args === []) { ```
b843ecf58ae8f3e7c170cab4052792001da5d2c5
570f2c8eebb76b3ba41138e1f3dc92c3669e2cf1
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 1d1c816a..6c947c5b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -38,6 +38,13 @@ class AssertTest extends TestCase 'isInitialized', ]; + private const SKIP_CUSTOM_MESSAGE_TESTS = [ + 'isAOf', + 'isAnyOf', +...
[ "tests/AssertTest.php" ]
[ { "comment": "```suggestion\n if ($args === []) {\n```", "path": "tests/AssertTest.php", "hunk": "@@ -661,6 +669,101 @@ public function testAssert(string $method, array $args, bool $success, bool $mul\n $this->assertSame($args[array_key_first($args)], $result);\n }\n \n+ #[DataProv...
true
webmozarts/assert
353
comment_to_fix
Add support for lazy assertion messages
```suggestion if ($args === []) { ```
b843ecf58ae8f3e7c170cab4052792001da5d2c5
570f2c8eebb76b3ba41138e1f3dc92c3669e2cf1
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 1d1c816a..6c947c5b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -38,6 +38,13 @@ class AssertTest extends TestCase 'isInitialized', ]; + private const SKIP_CUSTOM_MESSAGE_TESTS = [ + 'isAOf', + 'isAnyOf', +...
[ "tests/AssertTest.php" ]
[ { "comment": "```suggestion\n if ($args === []) {\n```", "path": "tests/AssertTest.php", "hunk": "@@ -661,6 +669,101 @@ public function testAssert(string $method, array $args, bool $success, bool $mul\n $this->assertSame($args[array_key_first($args)], $result);\n }\n \n+ #[DataProv...
true
webmozarts/assert
353
comment_to_fix
Add support for lazy assertion messages
I think it would be possible to do this by using named parameters instead: ```php $args['message'] = static fn () => 'Custom assertion message'; Assert::$method(...$args); ```
b843ecf58ae8f3e7c170cab4052792001da5d2c5
570f2c8eebb76b3ba41138e1f3dc92c3669e2cf1
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 1d1c816a..6c947c5b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -38,6 +38,13 @@ class AssertTest extends TestCase 'isInitialized', ]; + private const SKIP_CUSTOM_MESSAGE_TESTS = [ + 'isAOf', + 'isAnyOf', +...
[ "tests/AssertTest.php" ]
[ { "comment": "I think it would be possible to do this by using named parameters instead:\n\n```php\n$args['message'] = static fn () => 'Custom assertion message';\n\nAssert::$method(...$args);\n```", "path": "tests/AssertTest.php", "hunk": "@@ -661,6 +669,101 @@ public function testAssert(string $method...
true
webmozarts/assert
354
issue_to_patch
Add tests for object comparison behavior and clarify uniqueValues() documentation
This PR adds test coverage for object comparison behavior across several assertions and clarifies the documentation of `uniqueValues()`. ## Details ### 1. Additional test cases Added tests to explicitly document how assertions behave when working with objects: - `eq()` uses non-strict comparison (`==`) - `...
1b99650e7ffcad232624a260bc7fbdec2ffc407c
3a64079f9a5cce63b6d67d8573d73b9382ae1fa4
diff --git a/src/Assert.php b/src/Assert.php index 8c090400..30a1b82c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -889,6 +889,7 @@ public static function email(mixed $value, string $message = ''): string /** * Does non-strict comparisons on the items, so ['3', 3] will not pass the assertion. + ...
[ "src/Assert.php", "tests/AssertTest.php" ]
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 4a13641f..1d1c816a 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -53,6 +53,10 @@ public static function getTests(): array $normalList = ['foo' => 'b', 3]; unset($normalList['foo']); + $a = new ToStringClass('test...
true
webmozarts/assert
352
issue_to_patch
Missing `notInstanceOfAny` Thre is a method for checking if the value is instance of at least one class on the array of classes ``` isInstanceOfAny($value, array $classes, $message = '') ``` But no method that checks if the value is NOT an instance of at least one class on the array of classes. Missing: ``` i...
Add isNotInstanceOfAny assertion
Fix #270
ff31ad6efc62e66e518fbab1cde3453d389bcdc8
163587fb60af68a5c1628fe3e253ae5a472cf43f
diff --git a/README.md b/README.md index 7c10111b..c809ea08 100644 --- a/README.md +++ b/README.md @@ -82,36 +82,37 @@ The [`Assert`] class provides the following assertions: ### Type Assertions -Method | Description ------------------------------------------------...
[ "README.md", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/static-analysis/assert-isNotInstanceOfAny.php" ]
[ { "comment": "I don't believe this is correct, because there is no reason that `$value` has to be an object at all. For instance:\r\n\r\n```php\r\nAssert::isNotInstanceOfAny(null, ['stdClass']); // true\r\nAssert::isNotInstanceOfAny([42], ['stdClass']); // true\r\nAssert::isNotInstanceOfAny(false, ['stdClass'])...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 8fefdbcc..4a13641f 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -196,6 +196,11 @@ public static function getTests(): array ['isInstanceOfAny', [new Exception(), ['ArrayAccess', 'Countable']], false], ['isInstance...
true
webmozarts/assert
352
comment_to_fix
Add isNotInstanceOfAny assertion
I don't believe this is correct, because there is no reason that `$value` has to be an object at all. For instance: ```php Assert::isNotInstanceOfAny(null, ['stdClass']); // true Assert::isNotInstanceOfAny([42], ['stdClass']); // true Assert::isNotInstanceOfAny(false, ['stdClass']); // true ```
ff31ad6efc62e66e518fbab1cde3453d389bcdc8
163587fb60af68a5c1628fe3e253ae5a472cf43f
diff --git a/src/Assert.php b/src/Assert.php index 6b9825e7..8c090400 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -552,6 +552,36 @@ public static function isInstanceOfAny(mixed $value, mixed $classes, string $mes )); } + /** + * @template T + * + * @psalm-assert T $value + * +...
[ "src/Assert.php" ]
[ { "comment": "I don't believe this is correct, because there is no reason that `$value` has to be an object at all. For instance:\r\n\r\n```php\r\nAssert::isNotInstanceOfAny(null, ['stdClass']); // true\r\nAssert::isNotInstanceOfAny([42], ['stdClass']); // true\r\nAssert::isNotInstanceOfAny(false, ['stdClass'])...
true
webmozarts/assert
333
issue_to_patch
Rename .php_cs to .php-cs-fixer.php in export-ignore
It seems to have been an oversight during the change https://github.com/webmozarts/assert/commits/master/.php-cs-fixer.php
ac2f3652536f4dfbd6f7ea92d51a137f904b6a29
4b6e6dfd58fda4dfad24526432323b514c58dcd4
diff --git a/.gitattributes b/.gitattributes index c22d5658..20443cce 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,7 @@ /.gitattributes export-ignore /.gitignore export-ignore /.github export-ignore -/.php_cs export-ignore +/.php-cs-fixer.php export-ignore ...
[ ".gitattributes" ]
[]
true
webmozarts/assert
351
issue_to_patch
fix list methods so psalm doesn't see it as list<never>
In version 2.1.3 annotations for all ``list`` methods have been changed to use ``@template T``, ``@psalm-return list<T>`` and ``@psalm-assert list<T> $array`` (or something similar). This causes Psalm to sometimes think that an array is ``list<never>``, see example https://psalm.dev/r/a999572021 and the test that I add...
79155f94852fa27e2f73b459f6503f5e87e2c188
0e725d8bd8aa75375c5c4bfd84a97cd0a5cc854e
diff --git a/src/Assert.php b/src/Assert.php index 24f9c1ac..6b9825e7 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string /** * @psalm-pure * - * @psalm-assert list<T> $array + * @psalm-assert l...
[ "src/Assert.php", "src/Mixin.php", "tests/static-analysis/assert-isNonEmptyList.php" ]
[ { "comment": "This is correct, appreciate the fix.", "path": "src/Assert.php", "hunk": "@@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string\n /**\n * @psalm-pure\n *\n- * @psalm-assert list<T> $array\n+ * @psalm-assert list<mixed>...
diff --git a/tests/static-analysis/assert-isNonEmptyList.php b/tests/static-analysis/assert-isNonEmptyList.php index 027e0c12..61325674 100644 --- a/tests/static-analysis/assert-isNonEmptyList.php +++ b/tests/static-analysis/assert-isNonEmptyList.php @@ -20,6 +20,18 @@ function isNonEmptyList(mixed $value): array ...
true
webmozarts/assert
351
comment_to_fix
fix list methods so psalm doesn't see it as list<never>
This is correct, appreciate the fix.
79155f94852fa27e2f73b459f6503f5e87e2c188
0e725d8bd8aa75375c5c4bfd84a97cd0a5cc854e
diff --git a/src/Assert.php b/src/Assert.php index 24f9c1ac..6b9825e7 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string /** * @psalm-pure * - * @psalm-assert list<T> $array + * @psalm-assert l...
[ "src/Assert.php" ]
[ { "comment": "This is correct, appreciate the fix.", "path": "src/Assert.php", "hunk": "@@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string\n /**\n * @psalm-pure\n *\n- * @psalm-assert list<T> $array\n+ * @psalm-assert list<mixed>...
true
webmozarts/assert
351
comment_to_fix
fix list methods so psalm doesn't see it as list<never>
I don't think this is correct. What we actually want is: ```suggestion * @param T $array * @return T * @template T ``` This actually applies across all methods. What you put in, is what you get out, and along the way `@psalm-assert` is satisfied.
79155f94852fa27e2f73b459f6503f5e87e2c188
0e725d8bd8aa75375c5c4bfd84a97cd0a5cc854e
diff --git a/src/Assert.php b/src/Assert.php index 24f9c1ac..6b9825e7 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1986,11 +1986,9 @@ public static function countBetween(mixed $array, mixed $min, mixed $max, string /** * @psalm-pure * - * @psalm-assert list<T> $array + * @psalm-assert l...
[ "src/Assert.php" ]
[ { "comment": "I don't think this is correct. What we actually want is:\n\n```suggestion\n * @param T $array \n * @return T\n * @template T\n```\n\nThis actually applies across all methods. What you put in, is what you get out, and along the way `@psalm-assert` is satisfied.", "path": "src/A...
true
webmozarts/assert
348
issue_to_patch
IsInstanceOf changed in 2.1.3 check with static::object check added I've updated from 2.1.2 to 2.13 and there is a change in my messages. For example : ` Assert::isInstanceOf($myObject, MyClass::class, 'Not a valid object'); ` With version 2.1.2 it will return Not a valid object With version 2.1.3 it will return Ex...
Use custom message for object checks
Fixes #347 Adds tests to prevent future regressions.
6976757ba8dd70bf8cbaea0914ad84d8b51a9f46
ed94498963b984d87ce3784f4ddbf0d753e86927
diff --git a/CHANGELOG.md b/CHANGELOG.md index f8092f1e..538c8463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## 2.1.4 + +### Fixed + +- Use custom message for more internal calls + ## 2.1.3 ### Fixed diff --git a/src/Assert.php b/src/Assert.php index 4c5c8d37..65a45a98 10...
[ "CHANGELOG.md", "src/Assert.php", "tests/AssertTest.php" ]
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 104d3936..5b3d0a39 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -943,6 +943,31 @@ public static function getMethodsThatUseOtherMethods(): array 'args' => [111, 'test', 'Value must be an array without key test. Got: %s'], ...
true
webmozarts/assert
350
issue_to_patch
`Assert::isInstanceOf()` exception message changed in v2.1.3 Starting with `v2.1.3` the exception message for `Assert::isInstanceOf()` changed. For example, the following assertion ```php use App\Some\Thing; Assert::isInstanceOf($thing, Thing::class); ``` would return the following in `v2.1.2` ``` Expected an ins...
Ensure helpful message for instanceof checks
Fixes #349 cc @PHLAK
b39f1870fc7c3e9e4a26106df5053354b9260a33
f234aa04ff640c850365603d0b68d7e3ad3d817f
diff --git a/CHANGELOG.md b/CHANGELOG.md index 538c8463..2449ee4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## 2.1.5 + +### Fixed + +- Fixed regression of `instanceOf` messages + ## 2.1.4 ### Fixed diff --git a/src/Assert.php b/src/Assert.php index 65a45a98..24f9c1ac 100...
[ "CHANGELOG.md", "src/Assert.php", "tests/AssertTest.php" ]
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 5b3d0a39..8fefdbcc 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -188,7 +188,9 @@ public static function getTests(): array ['isInstanceOf', [null, 'stdClass'], false], ['notInstanceOf', [new stdClass(), 'stdClass'...
true
webmozarts/assert
346
issue_to_patch
`Assert::isAOf()` requires `class-string` input in v2.x, breaking validation use case In version 2.0.0, the `@param` annotation for `isAOf()` was changed from `object|string` to `ExpectedType|class-string<ExpectedType>`, breaking the ability to validate uncertain strings. **Example use case:** ```php public fu...
Correct docblocks for isAOf and related
Fixes #341
90ab582cb4a5350390e8dea40a60600b11b57a54
bad8da887d57dea4498549d2903a14880ee6817f
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0854f36c..fb4b24fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changelog ### Fixed - Corrected `isList` type documentation +- Corrected `isAOf` type documentation ## 2.1.2 diff --git a/src/Assert.php b/src/Assert.php index 6834e5c4..4c5c8d37 10064...
[ "CHANGELOG.md", "src/Assert.php", "src/Mixin.php", "tests/static-analysis/assert-isInstanceOfAny.php", "tests/static-analysis/assert-notInstanceOf.php" ]
[]
diff --git a/tests/static-analysis/assert-isInstanceOfAny.php b/tests/static-analysis/assert-isInstanceOfAny.php index f4823462..5274b72e 100644 --- a/tests/static-analysis/assert-isInstanceOfAny.php +++ b/tests/static-analysis/assert-isInstanceOfAny.php @@ -7,8 +7,6 @@ use Webmozart\Assert\Assert; /** - * @psalm-p...
true
webmozarts/assert
345
issue_to_patch
Always use global sprintf
2654493a5c4c8fef583fcaec1a130d17d05e11ca
bea19572b786d6d864760d8fdfef7579cea7b6db
diff --git a/src/Assert.php b/src/Assert.php index c87fbf4f..6834e5c4 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -571,7 +571,7 @@ public static function isAOf(mixed $value, mixed $class, string $message = ''): static::string($class, 'Expected class as a string. Got: %s'); if (!\is_a($value,...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
343
issue_to_patch
Use correct syntax for static calls
Using `[static::class, 'foo']` is deprecated by PHP and no longer necessary.
b428c3f6f5e49b3edbe5514135f0615ca88821f6
b7b55e1777f2bb69a4b6c41ded1ae1703c6a2ba7
diff --git a/src/Assert.php b/src/Assert.php index a03e2a27..f82ee5b8 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -548,7 +548,7 @@ public static function isInstanceOfAny(mixed $value, mixed $classes, string $mes static::reportInvalidArgument(\sprintf( $message ?: 'Expected an instance of a...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
344
issue_to_patch
Verify the return of class_implements()
It MAY return `false`.
fb831dd2b74af8336b977d3dd40508b0d1cda45c
ec844556dca08baaf21c03b7cf88027c997d349b
diff --git a/src/Assert.php b/src/Assert.php index f82ee5b8..c87fbf4f 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1740,7 +1740,11 @@ public static function implementsInterface(mixed $value, mixed $interface, strin { static::objectish($value); - if (!\in_array($interface, \class_implement...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
342
issue_to_patch
Correct isList type documentation
Also adds missing import for `Throwable` in Mixin.
a518094e17f3bd533265b1193b9aa3a40c1cf21b
7dc5844195d62ccd426f52e14349b1656ee0d82d
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3243f8c8..0854f36c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## 2.1.3 + +### Fixed + +- Corrected `isList` type documentation + ## 2.1.2 ### Fixed diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index 40...
[ "CHANGELOG.md", "bin/src/MixinGenerator.php", "src/Assert.php", "src/Mixin.php" ]
[ { "comment": "The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 492...
true
webmozarts/assert
342
comment_to_fix
Correct isList type documentation
The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOr...
a518094e17f3bd533265b1193b9aa3a40c1cf21b
7dc5844195d62ccd426f52e14349b1656ee0d82d
diff --git a/src/Mixin.php b/src/Mixin.php index 8c475b42..31acc8e1 100644 --- a/src/Mixin.php +++ b/src/Mixin.php @@ -6,6 +6,7 @@ use ArrayAccess; use Countable; +use Throwable; /** * This trait provides nullOr*, all* and allNullOr* variants of assertion base methods. @@ -4781,9 +4782,10 @@ public static func...
[ "src/Mixin.php" ]
[ { "comment": "The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 492...
true
webmozarts/assert
342
comment_to_fix
Correct isList type documentation
The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOr...
a518094e17f3bd533265b1193b9aa3a40c1cf21b
7dc5844195d62ccd426f52e14349b1656ee0d82d
diff --git a/src/Mixin.php b/src/Mixin.php index 8c475b42..31acc8e1 100644 --- a/src/Mixin.php +++ b/src/Mixin.php @@ -6,6 +6,7 @@ use ArrayAccess; use Countable; +use Throwable; /** * This trait provides nullOr*, all* and allNullOr* variants of assertion base methods. @@ -4781,9 +4782,10 @@ public static func...
[ "src/Mixin.php" ]
[ { "comment": "The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 492...
true
webmozarts/assert
340
issue_to_patch
Use of 'static' in callable is deprecated
See https://www.php.net/manual/en/migration82.deprecated.php
512486501c83e24f87ac4243a41e056c9770d665
969f0b71c054ee80c2ba2e2bd91b6800e5c739ce
diff --git a/src/Assert.php b/src/Assert.php index a667b13c..07cc1410 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1111,7 +1111,7 @@ public static function notInArray(mixed $value, mixed $values, string $message = static::reportInvalidArgument(\sprintf( $message ?: '%2$s was not ex...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
339
issue_to_patch
Bump phpunit/phpunit from 11.5.46 to 11.5.50 in /tools/phpunit
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.5.46 to 11.5.50. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/sebastianbergmann/phpunit/releases">phpunit/phpunit's releases</a>.</em></p> <blockquote> <h2>PHPUnit 11.5.50</h2> <h3>Changed</h3> <u...
ce6a2f100c404b2d32a1dd1270f9b59ad4f57649
f4a5386253b00f06e1830e5c112d06e8d907a4f2
diff --git a/tools/phpunit/composer.lock b/tools/phpunit/composer.lock index a8c0f1fd..622b9dfa 100644 --- a/tools/phpunit/composer.lock +++ b/tools/phpunit/composer.lock @@ -580,16 +580,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.46", + "version": "11.5...
[ "tools/phpunit/composer.lock" ]
[]
true
webmozarts/assert
338
issue_to_patch
Fixed iterable methods (all* + allNullOr*) types (return and $value parameter).
This should make all `$value` parameters back to `mixed` (like in v1) for methods `all*` and `allNullOr*`, and `iterable` return types coherent for methods `allNullOr*`.
bdbabc199a7ba9965484e4725d66170e5711323b
ec873a9202cff94f549e151ee8d42f94fbb5e658
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index 4d9591f4..40b12c03 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -216,6 +216,7 @@ private function assertion(ReflectionMethod $method, string $methodNameTemplate, /** @var array<string, string> $parameterTy...
[ "bin/src/MixinGenerator.php", "src/Mixin.php" ]
[]
true
webmozarts/assert
336
issue_to_patch
Use notSame instead of notEq for stringNotEmpty
Optimization for stringNotEmpty - use strict comparator ($value === '') instead of $value == ''.
b01be90dceff69c88c7b36c30ee45c9fd9107f7f
f0716fe086f818bc31ef5e1626c6ec93bba5a291
diff --git a/src/Assert.php b/src/Assert.php index 31405813..a667b13c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -65,7 +65,7 @@ public static function string(mixed $value, string $message = ''): string public static function stringNotEmpty(mixed $value, string $message = ''): string { static...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
335
issue_to_patch
Pass message from methods to integer assertion inside
Previously in v1, `positiveInteger` was using `!(\is_int($value) && $value > 0)` condition. If custom message was passed, it worked correctly. Now before comparing to 0, `self::integer` is called, but message is not passed to that call. In my opinion, it is wrong, that's why I created this PR. I think the same sh...
6bfce1b45d060c2ec9e35eebe32332e395c174f3
6f04cf4aecaeb9e281a95aaf9f1d78d63544132e
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e414182..14de35ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========= +## [Unreleased] + +### Changed + +- Pass custom message argument to assertions called inside + ## 2.1.0 ### Fixed diff --git a/src/Assert.php b/src/Assert.php inde...
[ "CHANGELOG.md", "src/Assert.php", "tests/AssertTest.php" ]
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 7ec8c6fe..104d3936 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -855,6 +855,96 @@ public function testEnumAssertionErrorMessage(): void Assert::null(DummyEnum::CaseName, 'Expected null. Got: %s'); } + + #[DataProvider('...
true
webmozarts/assert
331
issue_to_patch
Fix parameter type for `Assert::isMap()`
`isMap` should accept `mixed` or `array<array-key, T>`, not `array<string, T>`. If the input was `array<string, T>`, we wouldn't need to use `Assert::isMap()`.
a632bc7d8a28a3378d4d83ec6249d673b23fdcc2
8ab4b95f7ae160d07fe1f5beaa292cdcd1f0a7e2
diff --git a/src/Assert.php b/src/Assert.php index 09b7e165..20116cc1 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -2025,7 +2025,7 @@ public static function isNonEmptyList(mixed $array, string $message = ''): array * * @psalm-assert array<string, T> $array * - * @param array<string, T> $arr...
[ "src/Assert.php", "src/Mixin.php" ]
[ { "comment": "I think this should just be `mixed`. As in, remove the `@param` declaration because the actual type is already `mixed $array`.", "path": "src/Assert.php", "hunk": "@@ -2025,7 +2025,7 @@ public static function isNonEmptyList(mixed $array, string $message = ''): array\n *\n * @psal...
true
webmozarts/assert
332
issue_to_patch
Bump composer/composer from 2.9.1 to 2.9.3 in /tools/roave-bc-check
Bumps [composer/composer](https://github.com/composer/composer) from 2.9.1 to 2.9.3. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/composer/composer/releases">composer/composer's releases</a>.</em></p> <blockquote> <h2>2.9.3</h2> <ul> <li>Security: Fixed ANSI sequence inject...
a632bc7d8a28a3378d4d83ec6249d673b23fdcc2
ce01c27eed8b0dd4902affee96bd03548ec5d88c
diff --git a/tools/roave-bc-check/composer.lock b/tools/roave-bc-check/composer.lock index 82282b1e..339a4674 100644 --- a/tools/roave-bc-check/composer.lock +++ b/tools/roave-bc-check/composer.lock @@ -150,16 +150,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.5.9", ...
[ "tools/roave-bc-check/composer.lock" ]
[]
true
webmozarts/assert
330
issue_to_patch
Add changelog entry for declare(strict_types=1)
Not mention in the changelog but it was also added `declare(strict_types=1)`, why it may has not a lot of effects as most values are mixed. Stringables which may are used as `$message` are not longer auto converted to strings.
1b34b004e35a164bc5bb6ebd33c844b2d8069a54
6d36f30a3a08de85c211993e2972a720724fc1e1
diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a4655e..c80de679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog - **BREAKING** Minimum PHP version is now 8.2 (was 7.2). - **BREAKING** Remove deprecated `isTraversable`, use `isIterable` or `isInstanceOf` instead. +- **BREAKING** Added `decla...
[ "CHANGELOG.md" ]
[]
true
webmozarts/assert
329
issue_to_patch
Clean up new isStatic/notStatic
Refs #310
9b07f70f8b16faf30eff69a2348158a5e12edaf1
a9c661916ea55f1064af71ec3d8a3c4f95f5a609
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa0ac11..f0cafb43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,8 @@ Changelog - All assertion methods now return the checked value. - Added `notInArray` and `notOneOf`. - Added `isInitialized`, to check if a class property is initialized. -- Added `notNega...
[ "CHANGELOG.md", "src/Assert.php", "src/Mixin.php", "tests/static-analysis/assert-isStatic.php", "tests/static-analysis/assert-notStatic.php" ]
[ { "comment": "Corrected capitalization of 'closure' to 'Closure' in return type annotation.\n```suggestion\n * @return Closure|callable-string\n```", "path": "src/Assert.php", "hunk": "@@ -2172,6 +2174,24 @@ public static function throws(mixed $expression, string $class = Throwable::clas\n )...
diff --git a/tests/static-analysis/assert-isStatic.php b/tests/static-analysis/assert-isStatic.php index d24cf024..d0520884 100644 --- a/tests/static-analysis/assert-isStatic.php +++ b/tests/static-analysis/assert-isStatic.php @@ -5,9 +5,10 @@ use Closure; use Webmozart\Assert\Assert; -function isStatic(Closure $cl...
true
webmozarts/assert
329
comment_to_fix
Clean up new isStatic/notStatic
Corrected capitalization of 'closure' to 'Closure' in return type annotation. ```suggestion * @return Closure|callable-string ```
9b07f70f8b16faf30eff69a2348158a5e12edaf1
a9c661916ea55f1064af71ec3d8a3c4f95f5a609
diff --git a/src/Assert.php b/src/Assert.php index 6a7e3459..09b7e165 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -2045,20 +2045,21 @@ public static function isMap(mixed $array, string $message = ''): array } /** - * @param Closure $closure + * @psalm-assert callable $callable * - ...
[ "src/Assert.php" ]
[ { "comment": "Corrected capitalization of 'closure' to 'Closure' in return type annotation.\n```suggestion\n * @return Closure|callable-string\n```", "path": "src/Assert.php", "hunk": "@@ -2172,6 +2174,24 @@ public static function throws(mixed $expression, string $class = Throwable::clas\n )...
true
webmozarts/assert
329
comment_to_fix
Clean up new isStatic/notStatic
The error message 'Closure is not static.' is misleading since the method now accepts any callable type, not just closures. Consider changing to 'Callable is static.' to match the actual parameter type. ```suggestion $message ?: 'Callable is static.' ```
9b07f70f8b16faf30eff69a2348158a5e12edaf1
a9c661916ea55f1064af71ec3d8a3c4f95f5a609
diff --git a/src/Assert.php b/src/Assert.php index 6a7e3459..09b7e165 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -2045,20 +2045,21 @@ public static function isMap(mixed $array, string $message = ''): array } /** - * @param Closure $closure + * @psalm-assert callable $callable * - ...
[ "src/Assert.php" ]
[ { "comment": "The error message 'Closure is not static.' is misleading since the method now accepts any callable type, not just closures. Consider changing to 'Callable is static.' to match the actual parameter type.\n```suggestion\n $message ?: 'Callable is static.'\n```", "path": "src/Asser...
true
webmozarts/assert
329
comment_to_fix
Clean up new isStatic/notStatic
The error message 'Closure is not static.' should be updated to reflect that the method now accepts any callable type. Consider changing to 'Callable is not static.' to accurately describe what is being validated. ```suggestion $message ?: 'Callable is not static.' ```
9b07f70f8b16faf30eff69a2348158a5e12edaf1
a9c661916ea55f1064af71ec3d8a3c4f95f5a609
diff --git a/src/Assert.php b/src/Assert.php index 6a7e3459..09b7e165 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -2045,20 +2045,21 @@ public static function isMap(mixed $array, string $message = ''): array } /** - * @param Closure $closure + * @psalm-assert callable $callable * - ...
[ "src/Assert.php" ]
[ { "comment": "The error message 'Closure is not static.' should be updated to reflect that the method now accepts any callable type. Consider changing to 'Callable is not static.' to accurately describe what is being validated.\n```suggestion\n $message ?: 'Callable is not static.'\n```", "pa...
true
webmozarts/assert
310
issue_to_patch
adds isStatic and isNotStatic
# Changes - Adds the assertions `isStatic` and `isNotStatic`. - Adds tests. - Updates the readme docs. # Why This can be useful in some libraries where you want to make sure that the end user hasn't provided a static function as an argument. ```php Assert::isStatic($closure, $message = ''); Assert::isNo...
911bf981c82d89a7305f95f0887ea53008eaacd0
e327f6c83955b439f8b883bb3b7288d0ffcee281
diff --git a/README.md b/README.md index bbfac0a0..7c10111b 100644 --- a/README.md +++ b/README.md @@ -212,9 +212,11 @@ Method | Description ### Function Assertions -Method | Description -------------------------------------------- | ...
[ "README.md", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/static-analysis/assert-isStatic.php", "tests/static-analysis/assert-notStatic.php" ]
[ { "comment": "This is not type safe, because:\r\n\r\n- The argument `$closure` is not typed, except with a docblock\r\n- The docblock says `Closure`, but is enforced with `isCallable`\r\n- The assertion `isCallable` uses `is_callable()`, which has type `callable|mixed`\r\n- But ReflectionFunction accepts `Closu...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 4e801ebe..7ec8c6fe 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -621,6 +621,10 @@ public static function getTests(): array ['uniqueValues', [['qwerty', 'qwerty']], false], ['uniqueValues', [['asdfg', 'qwerty']], ...
true
webmozarts/assert
310
comment_to_fix
adds isStatic and isNotStatic
This is not type safe, because: - The argument `$closure` is not typed, except with a docblock - The docblock says `Closure`, but is enforced with `isCallable` - The assertion `isCallable` uses `is_callable()`, which has type `callable|mixed` - But ReflectionFunction accepts `Closure|string` End result, the in...
911bf981c82d89a7305f95f0887ea53008eaacd0
e327f6c83955b439f8b883bb3b7288d0ffcee281
diff --git a/src/Assert.php b/src/Assert.php index d585aa4c..6a7e3459 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -14,9 +14,11 @@ namespace Webmozart\Assert; use ArrayAccess; +use Closure; use Countable; use DateTime; use DateTimeImmutable; +use ReflectionFunction; use ReflectionProperty; use Throwable...
[ "src/Assert.php" ]
[ { "comment": "This is not type safe, because:\r\n\r\n- The argument `$closure` is not typed, except with a docblock\r\n- The docblock says `Closure`, but is enforced with `isCallable`\r\n- The assertion `isCallable` uses `is_callable()`, which has type `callable|mixed`\r\n- But ReflectionFunction accepts `Closu...
true
webmozarts/assert
310
comment_to_fix
adds isStatic and isNotStatic
I missed this before, but for consistency with other methods, this should be called `notStatic` (drop the `is`).
911bf981c82d89a7305f95f0887ea53008eaacd0
e327f6c83955b439f8b883bb3b7288d0ffcee281
diff --git a/src/Assert.php b/src/Assert.php index d585aa4c..6a7e3459 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -14,9 +14,11 @@ namespace Webmozart\Assert; use ArrayAccess; +use Closure; use Countable; use DateTime; use DateTimeImmutable; +use ReflectionFunction; use ReflectionProperty; use Throwable...
[ "src/Assert.php" ]
[ { "comment": "I missed this before, but for consistency with other methods, this should be called `notStatic` (drop the `is`).", "path": "src/Assert.php", "hunk": "@@ -2042,6 +2045,44 @@ public static function isMap(mixed $array, string $message = ''): array\n return $array;\n }\n \n+ /**...
true
webmozarts/assert
310
comment_to_fix
adds isStatic and isNotStatic
No need for this, it matches the code. Also missing `@psalm-assert` docs.
911bf981c82d89a7305f95f0887ea53008eaacd0
e327f6c83955b439f8b883bb3b7288d0ffcee281
diff --git a/src/Assert.php b/src/Assert.php index d585aa4c..6a7e3459 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -14,9 +14,11 @@ namespace Webmozart\Assert; use ArrayAccess; +use Closure; use Countable; use DateTime; use DateTimeImmutable; +use ReflectionFunction; use ReflectionProperty; use Throwable...
[ "src/Assert.php" ]
[ { "comment": "No need for this, it matches the code.\n\nAlso missing `@psalm-assert` docs.", "path": "src/Assert.php", "hunk": "@@ -2042,6 +2045,44 @@ public static function isMap(mixed $array, string $message = ''): array\n return $array;\n }\n \n+ /**\n+ * @param Closure $closure\n+...
true
webmozarts/assert
301
issue_to_patch
Add isNegativeInteger and notNegativeInteger
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/CHANGELOG.md b/CHANGELOG.md index cbdda208..9fa0ac11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Changelog - All assertion methods now return the checked value. - Added `notInArray` and `notOneOf`. - Added `isInitialized`, to check if a class property is initialized. +- Added `notNega...
[ "CHANGELOG.md", "README.md", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/static-analysis/assert-negativeInteger.php", "tests/static-analysis/assert-notNegativeInteger.php" ]
[ { "comment": "```suggestion\r\n self::integer($value);\r\n \r\n if ($value < 0) {\r\n```", "path": "src/Assert.php", "hunk": "@@ -127,6 +127,46 @@ public static function positiveInteger(mixed $value, string $message = ''): int\n return $value;\n }\n \n+ /**\n+ * @...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 4b0e9eb5..4e801ebe 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -79,6 +79,26 @@ public static function getTests(): array ['positiveInteger', ['0'], false], ['positiveInteger', [1.0], false], ['positi...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
```suggestion self::integer($value); if ($value < 0) { ```
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/src/Assert.php b/src/Assert.php index 5a46c9bd..d585aa4c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -117,7 +117,9 @@ public static function integerish(mixed $value, string $message = ''): int|float */ public static function positiveInteger(mixed $value, string $message = ''): int {...
[ "src/Assert.php" ]
[ { "comment": "```suggestion\r\n self::integer($value);\r\n \r\n if ($value < 0) {\r\n```", "path": "src/Assert.php", "hunk": "@@ -127,6 +127,46 @@ public static function positiveInteger(mixed $value, string $message = ''): int\n return $value;\n }\n \n+ /**\n+ * @...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
```suggestion self::integer($value) if ($value >= 0) { ```
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/src/Assert.php b/src/Assert.php index 5a46c9bd..d585aa4c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -117,7 +117,9 @@ public static function integerish(mixed $value, string $message = ''): int|float */ public static function positiveInteger(mixed $value, string $message = ''): int {...
[ "src/Assert.php" ]
[ { "comment": "```suggestion\r\n self::integer($value)\r\n\r\n if ($value >= 0) {\r\n```", "path": "src/Assert.php", "hunk": "@@ -127,6 +127,46 @@ public static function positiveInteger(mixed $value, string $message = ''): int\n return $value;\n }\n \n+ /**\n+ * @psalm-pu...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
Strange that this wasn't caught by static analysis. 😬
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/src/Assert.php b/src/Assert.php index 5a46c9bd..d585aa4c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -117,7 +117,9 @@ public static function integerish(mixed $value, string $message = ''): int|float */ public static function positiveInteger(mixed $value, string $message = ''): int {...
[ "src/Assert.php" ]
[ { "comment": "Strange that this wasn't caught by static analysis. 😬 ", "path": "src/Assert.php", "hunk": "@@ -1741,7 +1781,7 @@ public static function propertyNotExists(mixed $classOrObject, mixed $property,\n ));\n }\n \n- return $value;\n+ return $classOrObject;", ...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
This should go under the `Added` block, 12 lines down.
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/CHANGELOG.md b/CHANGELOG.md index cbdda208..9fa0ac11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Changelog - All assertion methods now return the checked value. - Added `notInArray` and `notOneOf`. - Added `isInitialized`, to check if a class property is initialized. +- Added `notNega...
[ "CHANGELOG.md" ]
[ { "comment": "This should go under the `Added` block, 12 lines down.", "path": "CHANGELOG.md", "hunk": "@@ -2,6 +2,7 @@ Changelog\n =========\n \n ## 2.0.0 (UNRELEASED)\n+* Added `Assert::nonNegativeInteger()` and `Assert::negativeInteger()`", "resolving_sha": "60f7b21ec64258a438334e4933ef1d684ad52e...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
For consistency with other methods, I think this should be called `notNegativeInteger`.
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/src/Assert.php b/src/Assert.php index 5a46c9bd..d585aa4c 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -117,7 +117,9 @@ public static function integerish(mixed $value, string $message = ''): int|float */ public static function positiveInteger(mixed $value, string $message = ''): int {...
[ "src/Assert.php" ]
[ { "comment": "For consistency with other methods, I think this should be called `notNegativeInteger`.", "path": "src/Assert.php", "hunk": "@@ -127,6 +127,46 @@ public static function positiveInteger(mixed $value, string $message = ''): int\n return $value;\n }\n \n+ /**\n+ * @psalm-pu...
true
webmozarts/assert
301
comment_to_fix
Add isNegativeInteger and notNegativeInteger
This should be placed at the end, similar to other lines. (Do not include `Assert::`)
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
60f7b21ec64258a438334e4933ef1d684ad52e76
diff --git a/CHANGELOG.md b/CHANGELOG.md index cbdda208..9fa0ac11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Changelog - All assertion methods now return the checked value. - Added `notInArray` and `notOneOf`. - Added `isInitialized`, to check if a class property is initialized. +- Added `notNega...
[ "CHANGELOG.md" ]
[ { "comment": "This should be placed at the end, similar to other lines. (Do not include `Assert::`)", "path": "CHANGELOG.md", "hunk": "@@ -13,6 +13,7 @@ Changelog\n \n ### Added\n \n+- Added `Assert::notNegativeInteger()` and `Assert::negativeInteger()`", "resolving_sha": "60f7b21ec64258a438334e4933...
true
webmozarts/assert
327
issue_to_patch
Fix invalid return
Refs #301
41b8ea16ae333173e0a2ecf9f12a414fd92cb8ab
6754fb4de5d1b808cf23c24d7bc50096e5316a5a
diff --git a/src/Assert.php b/src/Assert.php index 5a46c9bd..bf4e91a6 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -1741,7 +1741,7 @@ public static function propertyNotExists(mixed $classOrObject, mixed $property, )); } - return $value; + return $classOrObject; } ...
[ "src/Assert.php" ]
[]
true
webmozarts/assert
325
issue_to_patch
[FR] Assert property initialized Would it make sense to add a new assertion that would check that property [is initialized](https://www.php.net/manual/en/reflectionproperty.isinitialized.php)?
Add Assert isInitialized.
Closes #218.
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/README.md b/README.md index f49240fd..e81d0885 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Method | Description `object($value, $message = '')` | Check that a value is an object `objectish($value, $message = '')` ...
[ "README.md", "bin/generate.php", "bin/src/MixinGenerator.php", "composer.json", "src/Assert.php", "tests/AssertTest.php", "tests/ProjectCodeTest.php", "tests/static-analysis/assert-isInitialized.php" ]
[ { "comment": "Return type is `object`?", "path": "src/Assert.php", "hunk": "@@ -302,6 +303,29 @@ public static function resource(mixed $value, ?string $type = null, string $mess\n return $value;\n }\n \n+ /**\n+ * @psalm-pure\n+ *\n+ * @psalm-assert object $value\n+ *\n+ ...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index ac85a09d..baa9dcc9 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -34,6 +34,10 @@ */ class AssertTest extends TestCase { + private const SKIP_MIXIN_ASSERTION_TESTS = array( + 'isInitialized', + ); + public static funct...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
Return type is `object`?
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/src/Assert.php b/src/Assert.php index 9b15c62d..56fdf5fb 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,6 +17,7 @@ use Countable; use DateTime; use DateTimeImmutable; +use ReflectionProperty; use Throwable; use Traversable; @@ -302,6 +303,29 @@ public static function resource(mixed $value, ...
[ "src/Assert.php" ]
[ { "comment": "Return type is `object`?", "path": "src/Assert.php", "hunk": "@@ -302,6 +303,29 @@ public static function resource(mixed $value, ?string $type = null, string $mess\n return $value;\n }\n \n+ /**\n+ * @psalm-pure\n+ *\n+ * @psalm-assert object $value\n+ *\n+ ...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
???
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/tests/static-analysis/assert-isInitialized.php b/tests/static-analysis/assert-isInitialized.php new file mode 100644 index 00000000..bc89240d --- /dev/null +++ b/tests/static-analysis/assert-isInitialized.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Webmozart\Assert\Tests\StaticAnal...
[ "tests/static-analysis/assert-isInitialized.php" ]
[ { "comment": "???", "path": "tests/static-analysis/assert-isInitialized.php", "hunk": "@@ -0,0 +1,19 @@\n+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Webmozart\\Assert\\Tests\\StaticAnalysis;\n+\n+use Webmozart\\Assert\\Assert;\n+\n+/**\n+ * @psalm-pure\n+ *\n+ * @param object $value\n+ */\n+func...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
This didn't need to change. Revert it please.
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index acd005d5..34a53058 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -42,6 +42,10 @@ final class MixinGenerator 'allIsNonEmptyMap', // not supported by psalm (https://github.com/vimeo/psalm/issues/3444) ...
[ "bin/src/MixinGenerator.php" ]
[ { "comment": "This didn't need to change. Revert it please.", "path": "bin/src/MixinGenerator.php", "hunk": "@@ -26,7 +26,7 @@ final class MixinGenerator\n *\n * @var string[]\n */\n- private $unsupportedMethods = [\n+ private array $psalmPhpdocUnsupportedMethods = [", "resolvin...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
Needs `/** @var string[] */` docblock
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index acd005d5..34a53058 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -42,6 +42,10 @@ final class MixinGenerator 'allIsNonEmptyMap', // not supported by psalm (https://github.com/vimeo/psalm/issues/3444) ...
[ "bin/src/MixinGenerator.php" ]
[ { "comment": "Needs `/** @var string[] */` docblock", "path": "bin/src/MixinGenerator.php", "hunk": "@@ -42,6 +42,10 @@ final class MixinGenerator\n 'allIsNonEmptyMap', // not supported by psalm (https://github.com/vimeo/psalm/issues/3444)\n ];\n \n+ private array $skipGenerateForMeth...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
Good with this 👍🏼
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/bin/generate.php b/bin/generate.php index 03f98304..5bf628c8 100644 --- a/bin/generate.php +++ b/bin/generate.php @@ -12,3 +12,5 @@ require_once __DIR__.'/../vendor/autoload.php'; file_put_contents(__DIR__.'/../src/Mixin.php', (new MixinGenerator())->generate()); + +echo "Done.";
[ "bin/generate.php" ]
[ { "comment": "Good with this 👍🏼 ", "path": "bin/generate.php", "hunk": "@@ -12,3 +12,5 @@\n require_once __DIR__.'/../vendor/autoload.php';\n \n file_put_contents(__DIR__.'/../src/Mixin.php', (new MixinGenerator())->generate());\n+\n+echo \"Done.\";", "resolving_sha": "1070620c80cb7d0a5f40132a6924...
true
webmozarts/assert
325
comment_to_fix
Add Assert isInitialized.
👍🏼 could just be `generate-mixin` too.
193aad6cfc0895666ed6225f49aa78957aef00a6
1070620c80cb7d0a5f40132a6924d871e1ae7774
diff --git a/composer.json b/composer.json index 3a39c073..18f625ce 100644 --- a/composer.json +++ b/composer.json @@ -57,6 +57,7 @@ "composer --working-dir=tools/psalm update", "composer --working-dir=tools/roave-bc-check update" ], + "generate-mixin": "php bin/generate.php", ...
[ "composer.json" ]
[ { "comment": "👍🏼 could just be `generate-mixin` too.", "path": "composer.json", "hunk": "@@ -57,6 +57,7 @@\n \"composer --working-dir=tools/psalm update\",\n \"composer --working-dir=tools/roave-bc-check update\"\n ],\n+ \"generate-mixin-file\": \"php bin/generat...
true
webmozarts/assert
323
issue_to_patch
Adds notInArray and notOneOf.
These functions are negations of inArray and oneOf. The negations did not previously exist for these two functions. These are mostly just copypastes of the existing ones.
718571b0a3ead59c85a922bcc9925f509a801518
da343212994d17eee2318b7b3479e063fd42c009
diff --git a/README.md b/README.md index 699ffbc6..b019b97f 100644 --- a/README.md +++ b/README.md @@ -111,26 +111,28 @@ Method | Description ### Comparison Assertions -Method | Description ----------------------------------...
[ "README.md", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/static-analysis/assert-notInArray.php", "tests/static-analysis/assert-notOneOf.php" ]
[ { "comment": "This would be the description, so the bloc needs a title like:\n\n```suggestion\n * Check that a value is not present\n *\n * Does strict comparison, so Assert::notInArray(3, [1, 2, 3]) will not pass\n * the assertion, but Assert::notInArray(3, ['3']) will.\n```\n", "path": "sr...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 59771cae..25ad488b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -231,8 +231,12 @@ public static function getTests(): array array('range', array(3, 1, 2), false), array('oneOf', array(1, array(1, 2, 3)), true), ...
true
webmozarts/assert
323
comment_to_fix
Adds notInArray and notOneOf.
This would be the description, so the bloc needs a title like: ```suggestion * Check that a value is not present * * Does strict comparison, so Assert::notInArray(3, [1, 2, 3]) will not pass * the assertion, but Assert::notInArray(3, ['3']) will. ```
718571b0a3ead59c85a922bcc9925f509a801518
da343212994d17eee2318b7b3479e063fd42c009
diff --git a/src/Assert.php b/src/Assert.php index a3432e8a..98241292 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -852,6 +852,41 @@ public static function inArray(mixed $value, mixed $values, string $message = '' } } + /** + * A more human-readable alias of Assert::notInArray(). + * +...
[ "src/Assert.php" ]
[ { "comment": "This would be the description, so the bloc needs a title like:\n\n```suggestion\n * Check that a value is not present\n *\n * Does strict comparison, so Assert::notInArray(3, [1, 2, 3]) will not pass\n * the assertion, but Assert::notInArray(3, ['3']) will.\n```\n", "path": "sr...
true
webmozarts/assert
323
comment_to_fix
Adds notInArray and notOneOf.
This can have a type `mixed $value` and no `@param`. Same for the return type.
718571b0a3ead59c85a922bcc9925f509a801518
da343212994d17eee2318b7b3479e063fd42c009
diff --git a/tests/static-analysis/assert-notInArray.php b/tests/static-analysis/assert-notInArray.php new file mode 100644 index 00000000..b59f4635 --- /dev/null +++ b/tests/static-analysis/assert-notInArray.php @@ -0,0 +1,35 @@ +<?php + +namespace Webmozart\Assert\Tests\StaticAnalysis; + +use Webmozart\Assert\Assert;...
[ "tests/static-analysis/assert-notInArray.php" ]
[ { "comment": "This can have a type `mixed $value` and no `@param`. Same for the return type. ", "path": "tests/static-analysis/assert-notInArray.php", "hunk": "@@ -0,0 +1,47 @@\n+<?php\n+\n+namespace Webmozart\\Assert\\Tests\\StaticAnalysis;\n+\n+use Webmozart\\Assert\\Assert;\n+\n+/**\n+ * @psalm-pure\...
true
webmozarts/assert
322
issue_to_patch
exclude lock files and tools folder from export to prevent scanning
I am creating this MR because I stumbled upon an issue that was apparently introduced in version 1.12.0 where the security scan is flagging vulnerability issues in the tools path. To circumvent this, we are locking the dependency to the previous version `~1.11.0`. We believe PR https://github.com/webmozarts/asser...
80ffdf05afe6da218ec9363a78e26c51ab7e6618
9fe3f78ce5c40a784edf2280279d196a19cc40c0
diff --git a/.gitattributes b/.gitattributes index dfc5b076..c22d5658 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,3 +8,4 @@ /ci export-ignore /phpunit.xml.dist export-ignore /tests export-ignore +/tools export-ignore
[ ".gitattributes" ]
[]
true
webmozarts/assert
326
issue_to_patch
Unicode flag in email validation Hi, I noticed that the assertion made by `Assertion::email()` does not allow Unicode characters. Since [2012](https://www.rfc-editor.org/rfc/rfc6531), Unicode characters above `U+007F` encoded as UTF-8 are allowed in the local part. PHP 7.1 added the flag `FILTER_FLAG_EMAIL_UNICO...
Add support to validate unicode email.
Closes #290.
f3b53eb507180708d54c55eefb5acc6575e89251
8eea4644093af32bca4e158ad8d5110de785124d
diff --git a/src/Assert.php b/src/Assert.php index 56fdf5fb..00fdcf23 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -801,7 +801,7 @@ public static function email(mixed $value, string $message = ''): string { static::string($value); - if (false === \filter_var($value, FILTER_VALIDATE_EMAIL))...
[ "src/Assert.php", "tests/AssertTest.php" ]
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index baa9dcc9..0fb49f63 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -597,6 +597,7 @@ public static function getTests(): array array('email', array(123), false), array('email', array('foo.com'), false), a...
true
webmozarts/assert
320
issue_to_patch
Start v2.0 preparation
9be6926d8b485f55b9229203f962b51ed377ba68
80b7882b3ed3cab17053f1b8c1452459421e412a
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8dc891d6..16d1522d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.3' + php-versi...
[ ".github/workflows/ci.yaml", "CHANGELOG.md", "README.md", "bin/src/MixinGenerator.php", "composer.json", "phpunit.xml.dist", "src/Assert.php", "src/InvalidArgumentException.php", "src/Mixin.php", "tests/AssertTest.php", "tests/DummyEnum.php", "tests/ProjectCodeTest.php", "tests/static-analys...
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 1b849646..25ad488b 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /* * This file is part of the webmozart/assert package. * @@ -18,6 +20,7 @@ use Error; use Exception; use LogicExcep...
true
webmozarts/assert
304
issue_to_patch
Refactor and clean up CI config
- Refs #278 - Refs #275 - Refs #293
4c45030d73b14967680d1cfea856c7dd03b8c3aa
76ac293660fc31a49e852ed814f8b50fc4c876fe
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b7c3a752..ad86ccee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,140 +1,113 @@ # https://docs.github.com/en/actions -name: "CI" +name: CI on: - pull_request: ~ - push: - branches: - - "m...
[ ".github/workflows/ci.yaml", ".gitignore", ".php-cs-fixer.php", "bin/src/MixinGenerator.php", "ci/composer.json", "composer.json", "psalm.xml", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/ProjectCodeTest.php", "tests/static-analysis/assert-isCountable.php", "tests/stati...
[]
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 567fddfb..f094d791 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -13,11 +13,13 @@ use ArrayIterator; use ArrayObject; +use DateTime; use Error; use Exception; use LogicException; use PHPUnit\Framework\TestCase; use RuntimeExceptio...
true
webmozarts/assert
328
issue_to_patch
Fix static analysis warnings in mixin generator
a5bcb48f049293152719ea461da51c907e620804
11b4944c916b2c7326aaa91838ea1c31615ff27a
diff --git a/bin/src/MixinGenerator.php b/bin/src/MixinGenerator.php index 34a53058..4d9591f4 100644 --- a/bin/src/MixinGenerator.php +++ b/bin/src/MixinGenerator.php @@ -10,15 +10,12 @@ use ReflectionException; use ReflectionIntersectionType; use ReflectionMethod; +use ReflectionNamedType; use ReflectionType; use...
[ "bin/src/MixinGenerator.php" ]
[]
true
webmozarts/assert
324
issue_to_patch
Return validated value I've faced the fact that it is required to create temporary variables to validate values: ```php $firstName = getParam('firstName'); $lastName = getParam('lastName'); Assert::notNull($firstName); Assert::notNull($lastName); createCustomer( $firstName, $lastName ); ``` We c...
Add return $value for all Assert assertions.
Added return statement for all `Assert` assertions. Closes https://github.com/webmozarts/assert/issues/280.
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/README.md b/README.md index b019b97f..f49240fd 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Method | Description `boolean($value, $message = '')` | Check that a value is a boolean `scalar($value, $message = '')` ...
[ "README.md", "bin/src/MixinGenerator.php", "src/Assert.php", "src/Mixin.php", "tests/AssertTest.php", "tests/static-analysis/assert-isNotA.php", "tests/static-analysis/assert-objectish.php" ]
[ { "comment": "What about `42`?", "path": "src/Assert.php", "hunk": "@@ -86,31 +94,37 @@ public static function integer(mixed $value, string $message = ''): void\n *\n * @throws InvalidArgumentException\n */\n- public static function integerish(mixed $value, string $message = ''): void\...
diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 25ad488b..ac85a09d 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -106,6 +106,12 @@ public static function getTests(): array array('object', array(true), false), array('object', array(1), false), array...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
What about `42`?
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "What about `42`?", "path": "src/Assert.php", "hunk": "@@ -86,31 +94,37 @@ public static function integer(mixed $value, string $message = ''): void\n *\n * @throws InvalidArgumentException\n */\n- public static function integerish(mixed $value, string $message = ''): void\...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Missing return statement?
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Missing return statement?", "path": "src/Assert.php", "hunk": "", "resolving_sha": "707f181a76812c9dff65ca298fe33defc999ae12", "resolving_diff": "diff --git a/src/Assert.php b/src/Assert.php\nindex 98241292..9b15c62d 100644\n--- a/src/Assert.php\n+++ b/src/Assert.php\n@@ -17,7 +17,...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Based on the code, wouldn't it be `: array|Countable` ?
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Based on the code, wouldn't it be `: array|Countable` ?", "path": "src/Assert.php", "hunk": "@@ -301,14 +337,16 @@ public static function isArrayAccessible(mixed $value, string $message = ''): vo\n *\n * @throws InvalidArgumentException\n */\n- public static function isCo...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
This should probably be changed to `@template`, which has wider support (phpstan, etc).
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "This should probably be changed to `@template`, which has wider support (phpstan, etc).", "path": "src/Assert.php", "hunk": "", "resolving_sha": "707f181a76812c9dff65ca298fe33defc999ae12", "resolving_diff": "diff --git a/src/Assert.php b/src/Assert.php\nindex 98241292..9b15c62d 100...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Wouldn't it be `: object` ?
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Wouldn't it be `: object` ?", "path": "src/Assert.php", "hunk": "@@ -362,9 +405,11 @@ public static function isInstanceOf(mixed $value, mixed $class, string $message\n *\n * @psalm-param class-string<ExpectedType> $class\n *\n+ * @psalm-return !ExpectedType\n+ *\n ...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Why `string`?
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Why `string`?", "path": "src/Assert.php", "hunk": "@@ -385,13 +432,13 @@ public static function notInstanceOf(mixed $value, mixed $class, string $message\n *\n * @throws InvalidArgumentException\n */\n- public static function isInstanceOfAny(mixed $value, mixed $classes, ...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
While `: mixed` is the correct return, the expectation is that `$value` is `string|object`. Perhaps we need an `objectish($value)` method? As in: ```php // Check that value is an object or class-string static::objectish($value); ```
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "While `: mixed` is the correct return, the expectation is that `$value` is `string|object`. Perhaps we need an `objectish($value)` method? As in:\n\n```php\n// Check that value is an object or class-string\nstatic::objectish($value);\n```", "path": "src/Assert.php", "hunk": "@@ -438,9 +489...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Similarly, `objectish()` would apply here.
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Similarly, `objectish()` would apply here.", "path": "src/Assert.php", "hunk": "@@ -462,15 +517,15 @@ public static function isNotA(mixed $value, mixed $class, string $message = ''):\n *\n * @throws InvalidArgumentException\n */\n- public static function isAnyOf(mixed $va...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
This one need `@psalm-assert string $value` and returns `string`
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "This one need `@psalm-assert string $value` and returns `string`", "path": "src/Assert.php", "hunk": "@@ -589,79 +662,89 @@ public static function false(mixed $value, string $message = ''): void\n *\n * @throws InvalidArgumentException\n */\n- public static function notFa...
true
webmozarts/assert
324
comment_to_fix
Add return $value for all Assert assertions.
Also `string`, and for `ipv6, email` too.
3c24b82b1991b85b180c98e39e4ad781b2347a44
707f181a76812c9dff65ca298fe33defc999ae12
diff --git a/src/Assert.php b/src/Assert.php index 98241292..9b15c62d 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -17,7 +17,6 @@ use Countable; use DateTime; use DateTimeImmutable; -use Exception; use Throwable; use Traversable; @@ -39,7 +38,7 @@ class Assert * * @throws InvalidArgumentExcept...
[ "src/Assert.php" ]
[ { "comment": "Also `string`, and for `ipv6, email` too.", "path": "src/Assert.php", "hunk": "@@ -589,79 +662,89 @@ public static function false(mixed $value, string $message = ''): void\n *\n * @throws InvalidArgumentException\n */\n- public static function notFalse(mixed $value, strin...
true