diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 363eec663..9387366ff 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -6,7 +6,7 @@ on: jobs: publish: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ./.github/workflows/setup diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index d497d9b1c..6bc7c7bc8 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -6,7 +6,7 @@ on: - "release/**" jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ./.github/workflows/setup @@ -45,7 +45,7 @@ jobs: # Implementation is too outdated to test in GitHub Actions # - elm,schema-elm - # Language is too niche / obscure to test easily on ubuntu-22.04 + # Language is too niche / obscure to test easily on ubuntu-latest # - pike,schema-pike # Not yet started @@ -56,7 +56,7 @@ jobs: # Never tested? # - crystal - runs-on: [ubuntu-22.04] + runs-on: [ubuntu-latest] include: # Rust is very slow, so we use a larger runner @@ -190,7 +190,7 @@ jobs: test-complete: if: ${{ cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure') }} needs: test - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - run: | echo "Some workflows have failed!" diff --git a/packages/quicktype-core/src/language/Php/PhpRenderer.ts b/packages/quicktype-core/src/language/Php/PhpRenderer.ts index 8dfb3c5e6..922aad340 100644 --- a/packages/quicktype-core/src/language/Php/PhpRenderer.ts +++ b/packages/quicktype-core/src/language/Php/PhpRenderer.ts @@ -385,19 +385,16 @@ export class PhpRenderer extends ConvenienceRenderer { (_classType) => this.emitLine(...lhs, ...args, "->to(); ", "/*class*/"), (mapType) => { - this.emitBlock(["function to($my): stdClass"], () => { - this.emitLine("$out = new stdClass();"); - this.emitBlock(["foreach ($my as $k => $v)"], () => { - this.phpToObjConvert( - className, - mapType.values, - ["$my->$k = "], - ["$v"], - ); - }); - this.emitLine("return $out;"); + this.emitLine("$out = new stdClass();"); + this.emitBlock(["foreach (", ...args, " as $k => $v)"], () => { + this.phpToObjConvert( + className, + mapType.values, + ["$out->$k = "], + ["$v"], + ); }); - this.emitLine("return to(", ...args, ");"); + this.emitLine("return $out;"); }, (enumType) => this.emitLine( @@ -494,19 +491,16 @@ export class PhpRenderer extends ConvenienceRenderer { "/*class*/", ), (mapType) => { - this.emitBlock(["function from($my): stdClass"], () => { - this.emitLine("$out = new stdClass();"); - this.emitBlock(["foreach ($my as $k => $v)"], () => { - this.phpFromObjConvert( - className, - mapType.values, - ["$out->$k = "], - ["$v"], - ); - }); - this.emitLine("return $out;"); + this.emitLine("$out = new stdClass();"); + this.emitBlock(["foreach (", ...args, " as $k => $v)"], () => { + this.phpFromObjConvert( + className, + mapType.values, + ["$out->$k = "], + ["$v"], + ); }); - this.emitLine("return from(", ...args, ");"); + this.emitLine("return $out;"); }, (enumType) => this.emitLine(