Skip to content

Conversation

@mortenhauberg
Copy link
Contributor

I was trying to test Prism, but I couldn't follow the readme.

  1. Tests were broken due to Rector and its bundled vendor/ folder, so I had to bump dependencies.
  2. Value objects changed location in Update media namespace prism#494 but references in this repository were not changed.
  3. Response messages were removed in refactor: Remove response messages prism#516 but not references in this repository.

Hopefully, this will fix it.
Let me know if I missed something!

The test were broken due to Rector and its bundled `vendor/` folder.
It contained an older version of `nikic/php-parser`, and it caused Pest Architecture test to crash.
Value objects changed location in prism-php/prism#494.
Imports in this repository were not updated.
Response messages were removed in prism-php/prism#516.
This repository still contained references.
@ChrisB-TL
Copy link
Collaborator

Thank you! Have I reversed the dependency changes for now to keep aligned with the main prism package.

Is the CI test failure the same one you were experiencing? Weirdly this works locally for me. Don't think we have the same problem on the main prism package so wonder what is causing it...

@mortenhauberg
Copy link
Contributor Author

I think this is because of not having composer.lock committed.

This is the output when I run composer run test:

 % composer run test
> @php vendor/bin/pest --parallel

  .................................................................⨯⨯⨯⨯⨯
  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\ArchTest > `Arch presets` → Security preset                                                                                                                                 Error   
  Undefined constant PhpParser\Node\Expr\Cast\Int_::KIND_INT

  at vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:745
    741▕         if (strpos($cast, 'integer') !== false) {
    742▕             return Expr\Cast\Int_::KIND_INTEGER;
    743▕         }
    744▕ 
  ➜ 745▕         return Expr\Cast\Int_::KIND_INT;
    746▕     }
    747▕ 
    748▕     protected function getBoolCastKind(string $cast): int {
    749▕         $cast = strtolower($cast);


  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\ArchTest > `Arch presets` → PHP preset                                                                                                                                      Error   
  Undefined constant PhpParser\Node\Expr\Cast\Int_::KIND_INT

  at vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:745
    741▕         if (strpos($cast, 'integer') !== false) {
    742▕             return Expr\Cast\Int_::KIND_INTEGER;
    743▕         }
    744▕ 
  ➜ 745▕         return Expr\Cast\Int_::KIND_INT;
    746▕     }
    747▕ 
    748▕     protected function getBoolCastKind(string $cast): int {
    749▕         $cast = strtolower($cast);


  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\ArchTest > `Arch presets` → Laravel preset                                                                                                                                  Error   
  Undefined constant PhpParser\Node\Expr\Cast\Int_::KIND_INT

  at vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:745
    741▕         if (strpos($cast, 'integer') !== false) {
    742▕             return Expr\Cast\Int_::KIND_INTEGER;
    743▕         }
    744▕ 
  ➜ 745▕         return Expr\Cast\Int_::KIND_INT;
    746▕     }
    747▕ 
    748▕     protected function getBoolCastKind(string $cast): int {
    749▕         $cast = strtolower($cast);


  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\ArchTest > `Custom relaxed preset` → No final classes                                                                                                                       Error   
  Undefined constant PhpParser\Node\Expr\Cast\Int_::KIND_INT

  at vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:745
    741▕         if (strpos($cast, 'integer') !== false) {
    742▕             return Expr\Cast\Int_::KIND_INTEGER;
    743▕         }
    744▕ 
  ➜ 745▕         return Expr\Cast\Int_::KIND_INT;
    746▕     }
    747▕ 
    748▕     protected function getBoolCastKind(string $cast): int {
    749▕         $cast = strtolower($cast);


  ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\ArchTest > `Custom relaxed preset` → No private methods                                                                                                                     Error   
  Undefined constant PhpParser\Node\Expr\Cast\Int_::KIND_INT

  at vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:745
    741▕         if (strpos($cast, 'integer') !== false) {
    742▕             return Expr\Cast\Int_::KIND_INTEGER;
    743▕         }
    744▕ 
  ➜ 745▕         return Expr\Cast\Int_::KIND_INT;
    746▕     }
    747▕ 
    748▕     protected function getBoolCastKind(string $cast): int {
    749▕         $cast = strtolower($cast);



  Tests:    5 failed, 65 passed (519 assertions)
  Duration: 0.52s
  Parallel: 14 processes

Script @php vendor/bin/pest --parallel handling the test event returned with error code 2

I traced this issue to the bundled vendor/ of Rector.

Are there any reasons for .gitignore'ing composer.lock?

I bumped dependencies because most were fairly outdated, and Rector needed to be bumped for tests to pass

@mortenhauberg
Copy link
Contributor Author

I can make tests pass locally by

  • Bump phpstan/phpstan to version 2.1.22
  • Bump phpstan/extension-installer to version 1.4.3
  • Bump phpstan/phpstan-deprecation-rules to version 2.0.3
  • Bump rector/rector to version 2.1.4
  • Remove Prism\Bedrock\Rectors\ReorderMethodsRector::getRuleDefinition
    • When that's gone, there's no need for symplify/rule-doc-generator-contracts anymore

I think it might help if you added your composer.lock to this PR so we have the same versions 😄

@mortenhauberg
Copy link
Contributor Author

Hi @ChrisB-TL,
Can I do anything to help here?

@ChrisB-TL
Copy link
Collaborator

Prism has updated too now, so have re-added the dependency changes. @sixlive, this is now good to go. Please can merge, but hold off tagging, and will sort #33 in the same release?

@ejunker
Copy link
Contributor

ejunker commented Sep 12, 2025

In my composer.json I have had to lock it to a specific version "prism-php/prism": "0.84.0" otherwise I get the error about Unknown named parameter $responseMessages. Unless I'm mistaken, this seems like a serious issue since it breaks structured responses. Are we just waiting for this PR to be merged? @ChrisB-TL

@ChrisB-TL ChrisB-TL self-requested a review October 3, 2025 10:35
@sixlive sixlive merged commit 61a3e92 into prism-php:main Oct 3, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants