Repository navigation
Added array_last_key() function, returns key of last array item - #131
Closed
hikari-no-yume wants to merge 2 commits into
Closed
hikari-no-yume wants to merge 2 commits into
hikari-no-yume wants to merge 2 commits into
Conversation
hikari-no-yume
commented
Jul 13, 2012
Contributor
- Added array_last_key to standard extension
- Added array_last_key test to standard extension tests
Contributor
There was a problem hiding this comment.
This arginfo first parameter should be 0 because it's not a referenced parameter.
Contributor
Author
There was a problem hiding this comment.
ninja'd (fixed, rewrote history)
- Added array_last_key to standard extension - Added array_last_key test to standard extension tests
- Added array_first_key to standard extension - Added array_first_key test to standard extension tests
Contributor
There was a problem hiding this comment.
There should be a '$' in parameter name :)
Contributor
Author
|
Seems to be little interest, closing. |
heyJordanParker
added a commit
to heyJordanParker/php-sharp
that referenced
this pull request
Oct 13, 2026
Problem: Master gained php#131 (`count()` on List and Map through `INLINED_COLLECTION_METHODS`) and php#132 (`type_test_of`, the one decision of which types `is` and `as` have a PHP test for). Three files conflicted. php#132's `type_test_of` treats every `Hint::Identifier` as a class, so on this branch `value as T` would pass the checker and lower to `instanceof T`, against a class named `T`: false for every value, a silent wrong answer. The branch also refused type tests of type arguments with its own `untested_type` rule beside php#132's, and the analyzer had a third, `erased_type`. R3a's `SHARP_IS_TYPE` and `SHARP_TYPE_OF` lowering, its `tested_types` record and the two node kinds stayed in the tree although the refusal means no accepted program reaches them, and the engine never compiled either kind. Solution: - `crates/syntax/src/utils/pattern.rs`: master's `type_test_of` and `Shape::type_test`. It now takes `is_type_parameter`, so a type parameter has no PHP test. `has_type_test` and `php_shape` pass it in, from the names their callers already resolve. - `crates/semantics/src/internal/checker/sharp.rs`: master's `as` and pattern arms, reading `is_tested`, which asks `has_type_test`. `is T`, `as T`, a `match` arm of `T`, and a class with type arguments are "This type is not supported yet in PHP#.", as `as List<int>` is on master. `untested_type` and `report_erased_test` are deleted. A catch clause of a type parameter keeps its refusal through `untested_catch_name`, which asks the same decision. - `crates/analyzer/src/expression/mod.rs`: `is_untestable` asks `has_type_test` too, and `typeof` of a type parameter is refused again. `erased_type` and its syntax test are deleted. - `crates/sharp-bridge/src/lower.rs`: master's plain property read in a tested null-safe link, with this branch's `method_value` signature. R3a's lowering is deleted: `SHARP_IS_TYPE`, `SHARP_TYPE_OF`, `Types::tested_type`, the analyzer's `tested_types` record, its narrowing and `instanceof` type, `typeof(T)` as `Class<T>`, and the four analyzer tests that narrowed to type arguments. R3c restores them from df78eac. The two kinds leave `kind.rs`, and `SHARP_UNIT_ABI` is regenerated from php-sharp's `Zend/zend_ast.h` without them. crates/ ├── syntax/src/utils/pattern.rs <- type_test_of takes is_type_parameter ├── syntax/src/cst/cst/type_hint.rs, mod.rs <- erased_type deleted ├── syntax/tests/sharp.rs <- erased_type's test deleted ├── semantics/src/internal/checker/sharp.rs <- conflict: master's arms through is_tested ├── semantics/tests/sharp.rs <- one refusal test for type arguments ├── analyzer/src/context/assertion.rs <- passes is_type_parameter ├── analyzer/src/expression/mod.rs <- is_untestable reads has_type_test ├── analyzer/src/expression/type_of.rs <- typeof of a class only ├── analyzer/src/expression/binary/mod.rs <- R3a's instanceof type deleted ├── analyzer/src/assertion.rs, artifacts.rs <- R3a's tested_types deleted ├── analyzer/src/statement/function_like/mod.rs ├── analyzer/tests/sharp.rs <- R3a narrowing tests deleted, refused rows added ├── codex/src/ttype/builder.rs <- get_class_strings_of crate-private again └── sharp-bridge/ ├── src/lower.rs <- conflict: master's link read; R3a lowering deleted ├── src/lower/types.rs <- tested_type deleted ├── src/kind.rs <- two kinds out, ABI regenerated └── tests/lower.rs <- is, as, match and typeof of T refused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.