From 4968ba0e30426580ba99dfb103dd360a2ee8971b Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 19 Sep 2024 00:04:09 +0200 Subject: [PATCH] build: add dagger Signed-off-by: Mark Sagi-Kazar chore: move old dagger files Signed-off-by: Mark Sagi-Kazar add dagger Signed-off-by: Mark Sagi-Kazar ci: update flake Signed-off-by: Mark Sagi-Kazar ci: dagger develop Signed-off-by: Mark Sagi-Kazar chore: delete old dagger Signed-off-by: Mark Sagi-Kazar ci: add dagger to ci Signed-off-by: Mark Sagi-Kazar ci: add composer install Signed-off-by: Mark Sagi-Kazar ci: install zip extension Signed-off-by: Mark Sagi-Kazar ci: disable clientcompat cgo Signed-off-by: Mark Sagi-Kazar ci: exclude vendor and generated files Signed-off-by: Mark Sagi-Kazar ci: disable namespace test on php 7.4 Signed-off-by: Mark Sagi-Kazar ci: update phpstan Signed-off-by: Mark Sagi-Kazar ci: use php and phpstan modules Signed-off-by: Mark Sagi-Kazar ci: use dagx pipeline package Signed-off-by: Mark Sagi-Kazar ci: relocate e2e tests Signed-off-by: Mark Sagi-Kazar ci: add phpunit tests Signed-off-by: Mark Sagi-Kazar ci: fix test command Signed-off-by: Mark Sagi-Kazar ci: use updated php module Signed-off-by: Mark Sagi-Kazar ci: add php-cs-fixer Signed-off-by: Mark Sagi-Kazar updates Signed-off-by: Mark Sagi-Kazar updates Signed-off-by: Mark Sagi-Kazar updates Signed-off-by: Mark Sagi-Kazar --- .dagger/.gitattributes | 4 + .dagger/.gitignore | 4 + .dagger/generate.go | 21 ++ .dagger/go.mod | 64 ++++ .dagger/go.sum | 117 ++++++++ .dagger/lint.go | 55 ++++ .dagger/main.go | 160 ++++++++++ .dagger/tests.go | 49 +++ .dagger/tests_e2e.go | 91 ++++++ .dagger/versions.go | 5 + .dagger/versions_pinned.go | 18 ++ .github/workflows/ci.yaml | 56 ++-- .github/workflows/static.yaml | 73 +---- .php-cs-fixer.dist.php | 4 + dagger.json | 44 +++ flake.lock | 540 ++++++---------------------------- flake.nix | 50 ++-- phpstan-baseline.neon | 326 +++++++++++++++++++- phpstan.neon.dist | 2 +- tests/clientcompat/compat.php | 6 +- 20 files changed, 1116 insertions(+), 573 deletions(-) create mode 100644 .dagger/.gitattributes create mode 100644 .dagger/.gitignore create mode 100644 .dagger/generate.go create mode 100644 .dagger/go.mod create mode 100644 .dagger/go.sum create mode 100644 .dagger/lint.go create mode 100644 .dagger/main.go create mode 100644 .dagger/tests.go create mode 100644 .dagger/tests_e2e.go create mode 100644 .dagger/versions.go create mode 100644 .dagger/versions_pinned.go create mode 100644 dagger.json diff --git a/.dagger/.gitattributes b/.dagger/.gitattributes new file mode 100644 index 0000000..3a45493 --- /dev/null +++ b/.dagger/.gitattributes @@ -0,0 +1,4 @@ +/dagger.gen.go linguist-generated +/internal/dagger/** linguist-generated +/internal/querybuilder/** linguist-generated +/internal/telemetry/** linguist-generated diff --git a/.dagger/.gitignore b/.dagger/.gitignore new file mode 100644 index 0000000..7ebabcc --- /dev/null +++ b/.dagger/.gitignore @@ -0,0 +1,4 @@ +/dagger.gen.go +/internal/dagger +/internal/querybuilder +/internal/telemetry diff --git a/.dagger/generate.go b/.dagger/generate.go new file mode 100644 index 0000000..125bc62 --- /dev/null +++ b/.dagger/generate.go @@ -0,0 +1,21 @@ +package main + +import ( + "github.com/twirphp/twirp/.dagger/internal/dagger" +) + +// Generate code using the current version of the code generator plugin. +func (m *Twirp) Generate() *Generate { + return &Generate{ + Main: m, + } +} + +type Generate struct { + // +private + Main *Twirp +} + +func (m *Generate) Example() *dagger.Directory { + return m.Main.generate(m.Main.Source.Directory("example")) +} diff --git a/.dagger/go.mod b/.dagger/go.mod new file mode 100644 index 0000000..161742a --- /dev/null +++ b/.dagger/go.mod @@ -0,0 +1,64 @@ +module github.com/twirphp/twirp/.dagger + +go 1.23.1 + +require ( + github.com/99designs/gqlgen v0.17.57 + github.com/Khan/genqlient v0.7.0 + github.com/containerd/platforms v0.2.1 + github.com/sagikazarmark/dagx v0.1.0 + github.com/vektah/gqlparser/v2 v2.5.19 + go.opentelemetry.io/otel v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 + go.opentelemetry.io/otel/log v0.3.0 + go.opentelemetry.io/otel/sdk v1.27.0 + go.opentelemetry.io/otel/sdk/log v0.3.0 + go.opentelemetry.io/otel/trace v1.27.0 + go.opentelemetry.io/proto/otlp v1.3.1 + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa + golang.org/x/sync v0.10.0 + google.golang.org/grpc v1.68.0 +) + +require ( + github.com/containerd/log v0.1.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc5 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.9.0 // indirect +) + +require ( + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/sosodev/duration v1.3.1 // indirect + github.com/stretchr/testify v1.10.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.27.0 + go.opentelemetry.io/otel/sdk/metric v1.27.0 + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/protobuf v1.35.2 // indirect +) + +replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 + +replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 + +replace go.opentelemetry.io/otel/log => go.opentelemetry.io/otel/log v0.3.0 + +replace go.opentelemetry.io/otel/sdk/log => go.opentelemetry.io/otel/sdk/log v0.3.0 diff --git a/.dagger/go.sum b/.dagger/go.sum new file mode 100644 index 0000000..8a490cc --- /dev/null +++ b/.dagger/go.sum @@ -0,0 +1,117 @@ +github.com/99designs/gqlgen v0.17.57 h1:Ak4p60BRq6QibxY0lEc0JnQhDurfhxA67sp02lMjmPc= +github.com/99designs/gqlgen v0.17.57/go.mod h1:Jx61hzOSTcR4VJy/HFIgXiQ5rJ0Ypw8DxWLjbYDAUw0= +github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= +github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sagikazarmark/dagx v0.1.0 h1:5UXEMZagAfQ1HDKYMKaea97xGWSPMZX0UJih9+Dy0cs= +github.com/sagikazarmark/dagx v0.1.0/go.mod h1:JXN8/8GnRtiYGRbFI3UzyiUnqHzy8D+6eppQWZIRLSo= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= +github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/vektah/gqlparser/v2 v2.5.19 h1:bhCPCX1D4WWzCDvkPl4+TP1N8/kLrWnp43egplt7iSg= +github.com/vektah/gqlparser/v2 v2.5.19/go.mod h1:y7kvl5bBlDeuWIvLtA9849ncyvx6/lj06RsMrEjVy3U= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88 h1:oM0GTNKGlc5qHctWeIGTVyda4iFFalOzMZ3Ehj5rwB4= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88/go.mod h1:JGG8ebaMO5nXOPnvKEl+DiA4MGwFjCbjsxT1WHIEBPY= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0 h1:ccBrA8nCY5mM0y5uO7FT0ze4S0TuFcWdDB2FxGMTjkI= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.3.0/go.mod h1:/9pb6634zi2Lk8LYg9Q0X8Ar6jka4dkFOylBLbVQPCE= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 h1:bFgvUr3/O4PHj3VQcFEuYKvRZJX1SJDQ+11JXuSB3/w= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0/go.mod h1:xJntEd2KL6Qdg5lwp97HMLQDVeAhrYxmzFseAMDPQ8I= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 h1:CIHWikMsN3wO+wq1Tp5VGdVRTcON+DmOJSfDjXypKOc= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0/go.mod h1:TNupZ6cxqyFEpLXAZW7On+mLFL0/g0TE3unIYL91xWc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 h1:QY7/0NeRPKlzusf40ZE4t1VlMKbqSNT7cJRYzWuja0s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0/go.mod h1:HVkSiDhTM9BoUJU8qE6j2eSWLLXvi1USXjyd2BXT8PY= +go.opentelemetry.io/otel/log v0.3.0 h1:kJRFkpUFYtny37NQzL386WbznUByZx186DpEMKhEGZs= +go.opentelemetry.io/otel/log v0.3.0/go.mod h1:ziCwqZr9soYDwGNbIL+6kAvQC+ANvjgG367HVcyR/ys= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/sdk/log v0.3.0 h1:GEjJ8iftz2l+XO1GF2856r7yYVh74URiF9JMcAacr5U= +go.opentelemetry.io/otel/sdk/log v0.3.0/go.mod h1:BwCxtmux6ACLuys1wlbc0+vGBd+xytjmjajwqqIul2g= +go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= +go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/.dagger/lint.go b/.dagger/lint.go new file mode 100644 index 0000000..323cc55 --- /dev/null +++ b/.dagger/lint.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + + "github.com/sagikazarmark/dagx/pipeline" + "github.com/twirphp/twirp/.dagger/internal/dagger" +) + +// Run linters. +func (m *Twirp) Lint() *Lint { + return &Lint{ + Main: m, + } +} + +type Lint struct { + // +private + Main *Twirp +} + +func (m *Lint) All(ctx context.Context) error { + p := pipeline.New(ctx) + + pipeline.AddSyncStep(p, m.Go()) + pipeline.AddSyncStep(p, m.Phpstan()) + pipeline.AddSyncStep(p, m.PhpCsFixer()) + + return pipeline.Run(p) +} + +func (m *Lint) Go() *dagger.Container { + return dag.GolangciLint(dagger.GolangciLintOpts{ + Version: golangciLintVersion, + GoVersion: goVersion, // do not use goBase here for now to avoid parallel jobs overwriting cache volumes + }). + WithLinterCache(cacheVolume("golangci-lint")). + Run(m.Main.Source, dagger.GolangciLintRunOpts{ + Verbose: true, + }) +} + +func (m *Lint) Phpstan() *dagger.Container { + return dag.Phpstan(dagger.PhpstanOpts{ + Version: phpstanVersion, + PhpVersion: defaultPhpVersion, + }).Analyse(m.Main.source()) +} + +func (m *Lint) PhpCsFixer() *dagger.Container { + return dag.PhpCsFixer(dagger.PhpCsFixerOpts{ + Version: phpCsFixerVersion, + PhpVersion: defaultPhpVersion, + }).Check(m.Main.source()) +} diff --git a/.dagger/main.go b/.dagger/main.go new file mode 100644 index 0000000..b7cf800 --- /dev/null +++ b/.dagger/main.go @@ -0,0 +1,160 @@ +package main + +import ( + "context" + "fmt" + "strings" + + "github.com/containerd/platforms" + + "github.com/twirphp/twirp/.dagger/internal/dagger" +) + +type Twirp struct { + // Project source directory + // This will become useful once pulling from remote becomes available + // + // +private + Source *dagger.Directory + + // +private + Platform dagger.Platform +} + +func New( + ctx context.Context, + // Project source directory. + // + // +defaultPath=/ + // +ignore=[".devenv", ".direnv", ".github", "build", "example/generated", "lib/vendor", "tests/**/generated", ".pre-commit-config.yaml"] + source *dagger.Directory, +) (*Twirp, error) { + platform, err := dag.DefaultPlatform(ctx) + if err != nil { + return nil, err + } + + return &Twirp{ + Source: source, + Platform: platform, + }, nil +} + +// Build clientcompat binary. +func (m *Twirp) Clientcompat( + // Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). + // + // +optional + platform dagger.Platform, +) *dagger.File { + return dag.Go(dagger.GoOpts{ + Version: goVersion, + }). + WithCgoDisabled(). + Exec([]string{"go", "install", fmt.Sprintf("github.com/twitchtv/twirp/clientcompat@%s", twirpVersion)}). + File("/go/bin/clientcompat") +} + +// Build the code generator plugin. +func (m *Twirp) Build( + // Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). + // + // +optional + platform dagger.Platform, +) *dagger.File { + return m.build(platform, "dev") +} + +func (m *Twirp) build(platform dagger.Platform, version string) *dagger.File { + if version == "" { + version = "unknown" + } + + if platform == "" { + platform = m.Platform + } + + return goBase(). + WithCgoDisabled(). + WithSource(m.Source). + Build(dagger.GoWithSourceBuildOpts{ + Pkg: "./protoc-gen-twirp_php", + Trimpath: true, + Ldflags: []string{ + "-s", "-w", + "-X", "main.version=" + version, + }, + Platform: platform, + }) +} + +func (m *Twirp) protoc() *dagger.Container { + platform := platforms.MustParse(string(m.Platform)) + + // only support linux for now + arch := "x86_64" + if platform.Architecture == "arm64" { + arch = "aarch_64" + } + + const downloadUrlTemplate = "https://github.com/protocolbuffers/protobuf/releases/download/v%s/protoc-%s-linux-%s.zip" + + downloadUrl := fmt.Sprintf(downloadUrlTemplate, protobufVersion, protobufVersion, arch) + + // dag.HTTP doesn't preserve the filename? + src := dag.Arc().Unarchive(dag.HTTP(downloadUrl).WithName("protoc.zip")) + + return dag.Container(). + From(alpineBaseImage). + WithFile("/usr/local/bin/protoc", src.File("protoc/bin/protoc")). + WithDirectory("/usr/local/include", src.Directory("protoc/include")) +} + +func (m *Twirp) codegen() *dagger.Container { + return m.protoc(). + WithFile("/usr/local/bin/protoc-gen-twirp_php", m.Build("")). + WithWorkdir("/work") +} + +func (m *Twirp) generate(source *dagger.Directory) *dagger.Directory { + return m.codegen(). + WithDirectory("/work", source.WithDirectory("generated", dag.Directory())). + WithExec([]string{"sh", "-c", strings.Join([]string{"protoc", "--twirp_php_out=generated/", "--php_out=generated/", "*.proto"}, " ")}). + Directory("generated") +} + +func (m *Twirp) source() *dagger.Directory { + return phpBaseDefault(). + WithSource(m.Source). + WithComposerInstall(). + Source() +} + +func goBase() *dagger.Go { + return dag.Go(dagger.GoOpts{Version: goVersion}). + WithModuleCache(cacheVolume("go-mod")). + WithBuildCache(cacheVolume("go-build")) +} + +func phpBaseDefault() *dagger.Php { + return phpBase("") +} + +func phpBase(phpVersion string) *dagger.Php { + if phpVersion == "" { + phpVersion = defaultPhpVersion + } + + return dag.Php(dagger.PhpOpts{ + Version: phpVersion, + }). + WithExtension("bcmath"). + WithComposer(dagger.PhpWithComposerOpts{ + Version: composerVersion, + }). + WithComposerCache(cacheVolume("composer")) +} + +func cacheVolume(name string) *dagger.CacheVolume { + return dag.CacheVolume(fmt.Sprintf("twirphp-%s", name)) +} diff --git a/.dagger/tests.go b/.dagger/tests.go new file mode 100644 index 0000000..930ced6 --- /dev/null +++ b/.dagger/tests.go @@ -0,0 +1,49 @@ +package main + +import ( + "context" + + "github.com/sagikazarmark/dagx/pipeline" + "github.com/twirphp/twirp/.dagger/internal/dagger" +) + +// Run e2e tests. +func (m *Twirp) Tests( + // +optional + phpVersion string, +) *Tests { + if phpVersion == "" { + phpVersion = defaultPhpVersion + } + + return &Tests{ + Main: m, + PhpVersion: phpVersion, + } +} + +type Tests struct { + // +private + Main *Twirp + + // +private + PhpVersion string +} + +func (m *Tests) All(ctx context.Context) error { + p := pipeline.New(ctx) + + pipeline.AddStep(p, m.Etoe().All) + pipeline.AddSyncStep(p, m.Phpunit()) + + return pipeline.Run(p) +} + +func (m *Tests) Phpunit() *dagger.Container { + return phpBase(m.PhpVersion).Container(). + WithDirectory("/work", m.Main.Source). + WithWorkdir("/work"). + WithExec([]string{"composer", "install"}). + WithEnvVariable("XDEBUG_MODE", "coverage"). + WithExec([]string{"lib/vendor/bin/phpunit"}) // -v --coverage-clover ${BUILD_DIR}/coverage-php.xml +} diff --git a/.dagger/tests_e2e.go b/.dagger/tests_e2e.go new file mode 100644 index 0000000..56e41fc --- /dev/null +++ b/.dagger/tests_e2e.go @@ -0,0 +1,91 @@ +package main + +import ( + "context" + + "github.com/sagikazarmark/dagx/pipeline" + + "github.com/twirphp/twirp/.dagger/internal/dagger" +) + +// Run e2e tests. +func (m *Tests) Etoe() *Etoe { + return &Etoe{ + Main: m.Main, + PhpVersion: m.PhpVersion, + } +} + +type Etoe struct { + // +private + Main *Twirp + + // +private + PhpVersion string +} + +func (m *Etoe) All(ctx context.Context) error { + p := pipeline.New(ctx) + + pipeline.AddSyncSteps(p, + m.Clientcompat(m.PhpVersion), + m.Complete(m.PhpVersion), + m.NoServices(m.PhpVersion), + ) + + if m.PhpVersion != "7.4" { + pipeline.AddSyncStep(p, m.Namespace(m.PhpVersion)) + } + + return pipeline.Run(p) +} + +func (m *Etoe) source(name string) *dagger.Directory { + return m.Main.Source.Directory("tests/" + name) +} + +func (m *Etoe) container(name string, phpVersion string) *dagger.Container { + if phpVersion == "" { + phpVersion = defaultPhpVersion + } + + return phpBase(phpVersion). + WithSource(m.Main.Source). + WithComposerInstall(). + Container(). + WithWorkdir("/work/src/tests/"+name). + WithMountedDirectory("generated", m.Main.generate(m.source(name))) +} + +func (m *Etoe) Clientcompat( + // +optional + phpVersion string, +) *dagger.Container { + return m.container("clientcompat", phpVersion). + WithFile("/usr/local/bin/clientcompat", m.Main.Clientcompat("")). + WithExec([]string{"clientcompat", "-client", "./compat.sh"}) +} + +func (m *Etoe) Complete( + // +optional + phpVersion string, +) *dagger.Container { + return m.container("complete", phpVersion). + WithExec([]string{"../../lib/vendor/bin/phpunit", "-v"}) +} + +func (m *Etoe) Namespace( + // +optional + phpVersion string, +) *dagger.Container { + return m.container("namespace", phpVersion). + WithExec([]string{"php", "test.php"}) +} + +func (m *Etoe) NoServices( + // +optional + phpVersion string, +) *dagger.Container { + return m.container("no_services", phpVersion). + WithExec([]string{"bash", "-c", `test ! -f generated/Twirp/Tests/No_services/Proto/TwirpError.php || (echo "TwirpError.php should not be generated when there are no services defined in any of the proto files"; exit 1)`}) +} diff --git a/.dagger/versions.go b/.dagger/versions.go new file mode 100644 index 0000000..a88246b --- /dev/null +++ b/.dagger/versions.go @@ -0,0 +1,5 @@ +package main + +const ( + golangciLintVersion = "v1.63.2" +) diff --git a/.dagger/versions_pinned.go b/.dagger/versions_pinned.go new file mode 100644 index 0000000..5ca8810 --- /dev/null +++ b/.dagger/versions_pinned.go @@ -0,0 +1,18 @@ +package main + +const ( + goVersion = "1.23.4" + + defaultPhpVersion = "8.3" + + composerVersion = "2.8.4" + + phpstanVersion = "2" + phpCsFixerVersion = "3" + + twirpVersion = "v8.1.3" + + protobufVersion = "28.3" + + alpineBaseImage = "alpine:3.21.0@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45" +) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 54e71c1..5af2fd8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,6 +8,9 @@ on: permissions: contents: read +env: + DAGGER_VERSION: 0.15.1 + jobs: test: name: Test @@ -21,44 +24,29 @@ jobs: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Nix - uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 + - name: Run pipeline + uses: dagger/dagger-for-github@e5153f5610d82ac9f3f848f3a25ad9d696641068 # v7.0.1 with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - - name: Set up magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 - - # - name: Set up PHP - # uses: shivammathur/setup-php@v2 - # with: - # php-version: ${{ matrix.php }} - # tools: composer:v2 + verb: call + args: tests --php-version ${{ matrix.php }} all + cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} + version: ${{ env.DAGGER_VERSION }} - - name: Shell name - id: shell - run: echo "value=ci_$(echo "${{ matrix.php }}" | sed 's/\./_/')" >> "$GITHUB_OUTPUT" - - - name: Prepare Nix shell - run: nix develop --impure .#${{ steps.shell.outputs.value }} - - # - name: Set up Problem Matchers for PHPUnit - # run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: Download Go dependencies - run: nix develop --impure .#${{ steps.shell.outputs.value }} -c go mod download - - - name: Download PHP dependencies - run: nix develop --impure .#${{ steps.shell.outputs.value }} -c composer update --no-interaction --no-progress + lint: + name: Lint + runs-on: ubuntu-latest - - name: Lint - run: nix develop --impure .#${{ steps.shell.outputs.value }} -c make lint - env: - LINT_ARGS: --out-format=github-actions + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Test - run: nix develop --impure .#${{ steps.shell.outputs.value }} -c make test + - name: Run pipeline + uses: dagger/dagger-for-github@e5153f5610d82ac9f3f848f3a25ad9d696641068 # v7.0.1 + with: + verb: call + args: lint all + cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} + version: ${{ env.DAGGER_VERSION }} dev: name: Developer environment diff --git a/.github/workflows/static.yaml b/.github/workflows/static.yaml index fc1d223..9e88bbc 100644 --- a/.github/workflows/static.yaml +++ b/.github/workflows/static.yaml @@ -8,6 +8,9 @@ on: permissions: contents: read +env: + DAGGER_VERSION: 0.15.1 + jobs: phpstan: name: PHPStan @@ -17,23 +20,13 @@ jobs: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Nix - uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 + - name: Run pipeline + uses: dagger/dagger-for-github@e5153f5610d82ac9f3f848f3a25ad9d696641068 # v7.0.1 with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - - name: Set up magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 - - - name: Prepare Nix shell - run: nix develop --impure .#ci_lowest - - - name: Download dependencies - run: nix develop --impure .#ci_lowest -c composer update --no-interaction --no-progress - - - name: Run PHPStan - run: nix develop --impure .#ci_lowest -c phpstan analyze --no-progress + verb: call + args: lint phpstan + cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} + version: ${{ env.DAGGER_VERSION }} php-cs-fixer: name: PHP-CS-Fixer @@ -43,46 +36,10 @@ jobs: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Nix - uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 + - name: Run pipeline + uses: dagger/dagger-for-github@e5153f5610d82ac9f3f848f3a25ad9d696641068 # v7.0.1 with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - - name: Set up magic Nix cache - uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 - - - name: Prepare Nix shell - run: nix develop --impure .#ci_lowest - - - name: Download dependencies - run: nix develop --impure .#ci_lowest -c composer update --no-interaction --no-progress - - - name: Run PHP CS Fixer - run: nix develop --impure .#ci_lowest -c php-cs-fixer fix --diff --dry-run - - # psalm: - # name: Psalm - # runs-on: ubuntu-latest - # - # steps: - # - name: Checkout repository - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # - # - name: Set up Nix - # uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # v27 - # with: - # extra_nix_config: | - # access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - # - # - name: Set up magic Nix cache - # uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b # v8 - # - # - name: Prepare Nix shell - # run: nix develop --impure .#ci_lowest - # - # - name: Download dependencies - # run: nix develop --impure .#ci_lowest -c composer update --no-interaction --no-progress - # - # - name: Run Psalm - # run: nix develop --impure .#ci_lowest -c psalm --no-progress --root $PWD --output-format=github + verb: call + args: lint php-cs-fixer + cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} + version: ${{ env.DAGGER_VERSION }} diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 97dda7b..9deb522 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,6 +10,10 @@ '@Symfony:risky' => true, 'yoda_style' => false, 'modernize_strpos' => false, + + // until PHP 8.0 + 'trailing_comma_in_multiline' => false, + 'native_function_invocation' => false, ]) ->setFinder( PhpCsFixer\Finder::create() diff --git a/dagger.json b/dagger.json new file mode 100644 index 0000000..1d13abd --- /dev/null +++ b/dagger.json @@ -0,0 +1,44 @@ +{ + "name": "twirp", + "engineVersion": "v0.15.1", + "sdk": "go", + "exclude": [ + ".devenv", + ".direnv", + "go.work", + "go.work.sum" + ], + "dependencies": [ + { + "name": "golangci-lint", + "source": "github.com/sagikazarmark/daggerverse/golangci-lint", + "pin": "c1be27189ce47d28f84014b715f78e47db9fbadc" + }, + { + "name": "arc", + "source": "github.com/sagikazarmark/daggerverse/arc@arc/v0.5.0", + "pin": "126b5fbbdad70dbf2a8689600baec2eb78c05ef4" + }, + { + "name": "go", + "source": "github.com/sagikazarmark/daggerverse/go@07f08ab95be76586c798bc55424c684ad6d41497", + "pin": "07f08ab95be76586c798bc55424c684ad6d41497" + }, + { + "name": "php", + "source": "github.com/sagikazarmark/daggerverse/php@php/v0.2.0", + "pin": "77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0" + }, + { + "name": "php-cs-fixer", + "source": "github.com/sagikazarmark/daggerverse/php-cs-fixer@php-cs-fixer/v0.1.0", + "pin": "84e479601ced57c999880867f0beb56e2afd683d" + }, + { + "name": "phpstan", + "source": "github.com/sagikazarmark/daggerverse/phpstan@phpstan/v0.3.0", + "pin": "84e479601ced57c999880867f0beb56e2afd683d" + } + ], + "source": ".dagger" +} diff --git a/flake.lock b/flake.lock index 35b0cae..b07b599 100644 --- a/flake.lock +++ b/flake.lock @@ -2,178 +2,75 @@ "nodes": { "cachix": { "inputs": { - "devenv": "devenv_2", + "devenv": [ + "devenv" + ], "flake-compat": [ - "devenv", - "flake-compat" + "devenv" ], "git-hooks": [ - "devenv", - "pre-commit-hooks" + "devenv" ], - "nixpkgs": [ - "devenv", - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1724232775, - "narHash": "sha256-6u2DycIEgrgNYlLxyGqdFVmBNiKIitnQKJ1pbRP5oko=", + "lastModified": 1728672398, + "narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=", "owner": "cachix", "repo": "cachix", - "rev": "03b6cb3f953097bff378fb8b9ea094bd091a4ec7", + "rev": "aac51f698309fd0f381149214b7eee213c66ef0a", "type": "github" }, "original": { "owner": "cachix", + "ref": "latest", "repo": "cachix", "type": "github" } }, - "cachix_2": { + "dagger": { "inputs": { - "devenv": "devenv_3", - "flake-compat": [ - "devenv", - "cachix", - "devenv", - "flake-compat" - ], "nixpkgs": [ - "devenv", - "cachix", - "devenv", "nixpkgs" - ], - "pre-commit-hooks": [ - "devenv", - "cachix", - "devenv", - "pre-commit-hooks" ] }, "locked": { - "lastModified": 1712055811, - "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", - "owner": "cachix", - "repo": "cachix", - "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "lastModified": 1734036866, + "narHash": "sha256-KqdRX+IGfD4PsPNu/0Uqda3JHBqqcY0LSt3dayY8voM=", + "owner": "dagger", + "repo": "nix", + "rev": "8f7e40ca59ad9f85d6dfe3de623fed9adf0d5bec", "type": "github" }, "original": { - "owner": "cachix", - "repo": "cachix", + "owner": "dagger", + "repo": "nix", "type": "github" } }, "devenv": { "inputs": { "cachix": "cachix", - "flake-compat": "flake-compat_2", - "nix": "nix_3", - "nixpkgs": "nixpkgs_3", - "pre-commit-hooks": "pre-commit-hooks_2" - }, - "locked": { - "lastModified": 1726826452, - "narHash": "sha256-bzlp1BmyG+lyc3BvjHLVarck0XVj251R/ZAidtSsEzg=", - "owner": "cachix", - "repo": "devenv", - "rev": "2bdf6461e88c7e93b94d72d8b11d5a61f167cbf5", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "devenv_2": { - "inputs": { - "cachix": "cachix_2", - "flake-compat": [ - "devenv", - "cachix", - "flake-compat" - ], - "nix": "nix_2", - "nixpkgs": [ - "devenv", - "cachix", - "nixpkgs" - ], - "pre-commit-hooks": [ - "devenv", - "cachix", - "git-hooks" - ] - }, - "locked": { - "lastModified": 1723156315, - "narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=", - "owner": "cachix", - "repo": "devenv", - "rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "devenv_3": { - "inputs": { - "flake-compat": [ - "devenv", - "cachix", - "devenv", - "cachix", - "flake-compat" - ], + "flake-compat": "flake-compat", + "git-hooks": "git-hooks", "nix": "nix", - "nixpkgs": "nixpkgs", - "poetry2nix": "poetry2nix", - "pre-commit-hooks": [ - "devenv", - "cachix", - "devenv", - "cachix", - "pre-commit-hooks" - ] + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1708704632, - "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", + "lastModified": 1736184348, + "narHash": "sha256-LvuuwJBlZjLgjl6uzhfXP0rBveoNx7q0nz21xYb1AII=", "owner": "cachix", "repo": "devenv", - "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", + "rev": "07219f00c633f756d1f0cc5bb6c4c311b5c4cb0d", "type": "github" }, "original": { "owner": "cachix", - "ref": "python-rewrite", "repo": "devenv", "type": "github" } }, "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { "flake": false, "locked": { "lastModified": 1696426674, @@ -189,14 +86,14 @@ "type": "github" } }, - "flake-compat_3": { + "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -232,11 +129,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1726153070, - "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", "type": "github" }, "original": { @@ -245,36 +142,31 @@ "type": "github" } }, - "flake-utils": { + "git-hooks": { "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", - "type": "github" + "flake-compat": [ + "devenv" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": [ + "devenv" + ] }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, @@ -282,7 +174,7 @@ "inputs": { "nixpkgs": [ "devenv", - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, @@ -317,109 +209,29 @@ } }, "nix": { - "inputs": { - "flake-compat": "flake-compat", - "nixpkgs": [ - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "nixpkgs" - ], - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1712911606, - "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", - "owner": "domenkozar", - "repo": "nix", - "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "devenv-2.21", - "repo": "nix", - "type": "github" - } - }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, - "nix_2": { "inputs": { "flake-compat": [ - "devenv", - "cachix", - "devenv", - "flake-compat" - ], - "nixpkgs": [ - "devenv", - "cachix", - "devenv", - "nixpkgs" - ], - "nixpkgs-regression": "nixpkgs-regression_2" - }, - "locked": { - "lastModified": 1712911606, - "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", - "owner": "domenkozar", - "repo": "nix", - "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "devenv-2.21", - "repo": "nix", - "type": "github" - } - }, - "nix_3": { - "inputs": { - "flake-compat": [ - "devenv", - "flake-compat" + "devenv" ], "flake-parts": "flake-parts", "libgit2": "libgit2", "nixpkgs": "nixpkgs_2", - "nixpkgs-23-11": "nixpkgs-23-11", - "nixpkgs-regression": "nixpkgs-regression_3", - "pre-commit-hooks": "pre-commit-hooks" + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ], + "pre-commit-hooks": [ + "devenv" + ] }, "locked": { - "lastModified": 1725980365, - "narHash": "sha256-uDwWyizzlQ0HFzrhP6rVp2+2NNA+/TM5zT32dR8GUlg=", + "lastModified": 1727438425, + "narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=", "owner": "domenkozar", "repo": "nix", - "rev": "1e61e9f40673f84c3b02573145492d8af581bec5", + "rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546", "type": "github" }, "original": { @@ -431,110 +243,30 @@ }, "nixpkgs": { "locked": { - "lastModified": 1692808169, - "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-23-11": { - "locked": { - "lastModified": 1717159533, - "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - } - }, "nixpkgs-lib": { "locked": { - "lastModified": 1725233747, - "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "lastModified": 1735774519, + "narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-regression_2": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-regression_3": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" + "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" } }, "nixpkgs_2": { @@ -571,11 +303,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1726583932, - "narHash": "sha256-zACxiQx8knB3F8+Ze+1BpiYrI+CbhxyWpcSID9kVhkQ=", + "lastModified": 1736042175, + "narHash": "sha256-jdd5UWtLVrNEW8K6u5sy5upNAFmF3S4Y+OIeToqJ1X8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "658e7223191d2598641d50ee4e898126768fe847", + "rev": "bf689c40d035239a489de5997a4da5352434632e", "type": "github" }, "original": { @@ -587,18 +319,18 @@ }, "phps": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_2", "nixpkgs": [ "nixpkgs" ], "utils": "utils" }, "locked": { - "lastModified": 1726090929, - "narHash": "sha256-Y1IxyLTaerrP0nvPz6GEUbAqvbjZzjuzBV8eRdWURNk=", + "lastModified": 1734905622, + "narHash": "sha256-3BwuhHKjfpTg/VnH0+uao3DqUmI1mowbLt3f+ysBwQM=", "owner": "fossar", "repo": "nix-phps", - "rev": "5daba6a72aa7136079e36c7d8bdc91a002334480", + "rev": "323d9eb87385473078ebdeef8873530c4f7dbbd7", "type": "github" }, "original": { @@ -607,98 +339,9 @@ "type": "github" } }, - "poetry2nix": { - "inputs": { - "flake-utils": "flake-utils", - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "devenv", - "cachix", - "devenv", - "cachix", - "devenv", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1692876271, - "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "devenv", - "nix" - ], - "flake-utils": "flake-utils_2", - "gitignore": [ - "devenv", - "nix" - ], - "nixpkgs": [ - "devenv", - "nix", - "nixpkgs" - ], - "nixpkgs-stable": [ - "devenv", - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712897695, - "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pre-commit-hooks_2": { - "inputs": { - "flake-compat": [ - "devenv", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "devenv", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1725513492, - "narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "7570de7b9b504cfe92025dd1be797bf546f66528", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { + "dagger": "dagger", "devenv": "devenv", "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_4", @@ -720,31 +363,16 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "utils": { "inputs": { - "systems": "systems_2" + "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a657de8..cd401e7 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,8 @@ url = "github:fossar/nix-phps"; inputs.nixpkgs.follows = "nixpkgs"; }; + dagger.url = "github:dagger/nix"; + dagger.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs@{ flake-parts, ... }: @@ -20,6 +22,16 @@ systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; perSystem = { config, self', inputs', pkgs, system, ... }: rec { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + + overlays = [ + (final: prev: { + dagger = inputs'.dagger.packages.dagger; + }) + ]; + }; + devenv.shells = { default = { languages = { @@ -47,15 +59,17 @@ gotestsum golangci-lint - php.packages.phpstan + # php.packages.phpstan php.packages.php-cs-fixer - php.packages.psalm + # php.packages.psalm goreleaser yamllint + + dagger ] ++ [ - self'.packages.clientcompat + # self'.packages.clientcompat ]; enterShell = '' @@ -130,21 +144,21 @@ }; packages = { - clientcompat = pkgs.buildGoPackage rec { - pname = "clientcompat"; - version = "8.1.3"; - - goPackagePath = "github.com/twitchtv/twirp"; - - src = pkgs.fetchFromGitHub { - owner = "twitchtv"; - repo = "twirp"; - rev = "v${version}"; - sha256 = "sha256-p3gHVHGBHakOOQnJAuMK7vZumNXN15mOABuEHUG0wNs="; - }; - - subPackages = [ "clientcompat" ]; - }; + # clientcompat = pkgs.buildGoPackage rec { + # pname = "clientcompat"; + # version = "8.1.3"; + # + # goPackagePath = "github.com/twitchtv/twirp"; + # + # src = pkgs.fetchFromGitHub { + # owner = "twitchtv"; + # repo = "twirp"; + # rev = "v${version}"; + # sha256 = "sha256-p3gHVHGBHakOOQnJAuMK7vZumNXN15mOABuEHUG0wNs="; + # }; + # + # subPackages = [ "clientcompat" ]; + # }; protoc-gen-twirp_php = pkgs.buildGoModule rec { pname = "protoc-gen-twirp_php"; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ad6b2be..7455694 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,11 +1,331 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$content of method Psr\\\\Http\\\\Message\\\\StreamFactoryInterface\\:\\:createStream\\(\\) expects string, string\\|false given\\.$#" + message: '#^Method Twirp\\BaseServerHooks\:\:error\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: lib/src/Server.php + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:error\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php - - message: "#^Parameter \\#1 \\$content of method Psr\\\\Http\\\\Message\\\\StreamFactoryInterface\\:\\:createStream\\(\\) expects string, string\\|false given\\.$#" + message: '#^Method Twirp\\BaseServerHooks\:\:requestReceived\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:requestReceived\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:requestRouted\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:requestRouted\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:responsePrepared\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:responsePrepared\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\BaseServerHooks\:\:responseSent\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/BaseServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:error\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:error\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:requestReceived\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:requestReceived\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:requestRouted\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:requestRouted\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:responsePrepared\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:responsePrepared\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Method Twirp\\ChainServerHooks\:\:responseSent\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ChainServerHooks.php + + - + message: '#^Cannot access offset string on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:httpRequestHeaders\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:httpRequestHeaders\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:httpRequestHeaders\(\) should return array but returns mixed\.$#' + identifier: return.type + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:methodName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:methodName\(\) should return string\|null but returns mixed\.$#' + identifier: return.type + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:packageName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:packageName\(\) should return string\|null but returns mixed\.$#' + identifier: return.type + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:serviceName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:serviceName\(\) should return string\|null but returns mixed\.$#' + identifier: return.type + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:statusCode\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:statusCode\(\) should return int\|null but returns mixed\.$#' + identifier: return.type + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withHttpRequestHeaders\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withHttpRequestHeaders\(\) has parameter \$headers with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withHttpRequestHeaders\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withHttpResponseHeader\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withHttpResponseHeader\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withMethodName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withMethodName\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withPackageName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withPackageName\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withServiceName\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withServiceName\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withStatusCode\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Context\:\:withStatusCode\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Context.php + + - + message: '#^Method Twirp\\Error\:\:getMetaMap\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/Error.php + + - + message: '#^Parameter \#1 \$content of method Psr\\Http\\Message\\StreamFactoryInterface\:\:createStream\(\) expects string, string\|false given\.$#' + identifier: argument.type count: 1 path: lib/src/Router.php + + - + message: '#^Parameter \#1 \$content of method Psr\\Http\\Message\\StreamFactoryInterface\:\:createStream\(\) expects string, string\|false given\.$#' + identifier: argument.type + count: 1 + path: lib/src/Server.php + + - + message: '#^Method Twirp\\ServerHooks\:\:error\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:error\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:requestReceived\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:requestReceived\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:requestRouted\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:requestRouted\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:responsePrepared\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:responsePrepared\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php + + - + message: '#^Method Twirp\\ServerHooks\:\:responseSent\(\) has parameter \$ctx with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: lib/src/ServerHooks.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 78845a7..ae5c972 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -3,7 +3,7 @@ includes: parameters: level: max - checkMissingIterableValueType: false + # checkMissingIterableValueType: false paths: - lib/src bootstrapFiles: diff --git a/tests/clientcompat/compat.php b/tests/clientcompat/compat.php index 998fc57..ee32622 100755 --- a/tests/clientcompat/compat.php +++ b/tests/clientcompat/compat.php @@ -5,7 +5,7 @@ use Google\Protobuf\Internal\GPBDecodeException; use Twirp\Clientcompat\ClientCompatMessage; -use Twirp\Clientcompat\ClientCompatMessage_CompatServiceMethod; +use Twirp\Clientcompat\ClientCompatMessage\CompatServiceMethod; use Twirp\Clientcompat\CompatServiceClient; $message = new ClientCompatMessage(); @@ -20,7 +20,7 @@ $client = new CompatServiceClient($message->getServiceAddress()); switch ($message->getMethod()) { - case ClientCompatMessage_CompatServiceMethod::NOOP: + case CompatServiceMethod::NOOP: try { doNoop($client, $message->getRequest()); } catch (\Throwable $e) { @@ -28,7 +28,7 @@ } break; - case ClientCompatMessage_CompatServiceMethod::METHOD: + case CompatServiceMethod::METHOD: try { doMethod($client, $message->getRequest()); } catch (\Throwable $e) {