Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reviews:
request_changes_workflow: true
3 changes: 3 additions & 0 deletions demos/blog-publishing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
"ray/di": "^2.18"
},
"require-dev": {
"be-framework/psalm-plugin": "1.x-dev",
"phpunit/phpunit": "^12"
},
"scripts": {
"psalm": "psalm --show-info=false",
"stree": "vendor/bin/stree $(ls -t var/log/*.json | head -1)",
"stree:full": "vendor/bin/stree --full $(ls -t var/log/*.json | head -1)"
},
"scripts-descriptions": {
"psalm": "Run static analysis with Psalm + Be Framework plugin.",
"stree": "Render the latest var/log/*.json as a compact tree.",
"stree:full": "Render the latest var/log/*.json as a semantic full tree with full props and close.profile details."
}
Expand Down
43 changes: 43 additions & 0 deletions demos/blog-publishing/psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
phpVersion="8.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<plugins>
<pluginClass class="Be\PsalmPlugin\Plugin" />
</plugins>

<issueHandlers>
<!--
Be Framework loads classes via #[Be] attributes and constructs them via
reflection in Becoming. Psalm's reachability analysis cannot see these
dynamic call paths, so the stock unused-* rules fire false positives on
valid framework patterns.
-->
<UnusedClass>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</UnusedClass>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedMethod>
<PossiblyUnusedProperty>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedProperty>
</issueHandlers>
</psalm>
16 changes: 16 additions & 0 deletions demos/blog-publishing/src/Exception/InvalidAuthorNameException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Be\Pattern\BlogPublishing\Exception;

use Be\Framework\Attribute\Message;
use DomainException;

#[Message([
'en' => 'Author name cannot be empty.',
'ja' => '著者名は空にできません。'
])]
final class InvalidAuthorNameException extends DomainException
{
}
16 changes: 16 additions & 0 deletions demos/blog-publishing/src/Exception/InvalidExcerptException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Be\Pattern\BlogPublishing\Exception;

use Be\Framework\Attribute\Message;
use DomainException;

#[Message([
'en' => 'Excerpt is too long. Must be 250 characters or fewer.',
'ja' => '抜粋が長すぎます。250文字以下で入力してください。'
])]
final class InvalidExcerptException extends DomainException
{
}
16 changes: 16 additions & 0 deletions demos/blog-publishing/src/Exception/InvalidHtmlBodyException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Be\Pattern\BlogPublishing\Exception;

use Be\Framework\Attribute\Message;
use DomainException;

#[Message([
'en' => 'HTML body cannot be empty.',
'ja' => 'HTML本文は空にできません。'
])]
final class InvalidHtmlBodyException extends DomainException
{
}
16 changes: 16 additions & 0 deletions demos/blog-publishing/src/Exception/InvalidSlugException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Be\Pattern\BlogPublishing\Exception;

use Be\Framework\Attribute\Message;
use DomainException;

#[Message([
'en' => 'Invalid slug format. Use lowercase letters, digits, and hyphens only.',
'ja' => 'スラッグの形式が不正です。小文字・数字・ハイフンのみ使用できます。'
])]
final class InvalidSlugException extends DomainException
{
}
4 changes: 2 additions & 2 deletions demos/blog-publishing/src/Semantic/AuthorName.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Be\Pattern\BlogPublishing\Semantic;

use Be\Framework\Attribute\Validate;
use InvalidArgumentException;
use Be\Pattern\BlogPublishing\Exception\InvalidAuthorNameException;

/**
* AuthorName - Semantic validation
Expand All @@ -20,7 +20,7 @@ final class AuthorName
public function validate(string $authorName): void
{
if (empty(trim($authorName))) {
throw new InvalidArgumentException('Author name cannot be empty');
throw new InvalidAuthorNameException();
}
}
}
4 changes: 2 additions & 2 deletions demos/blog-publishing/src/Semantic/Excerpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Be\Pattern\BlogPublishing\Semantic;

use Be\Framework\Attribute\Validate;
use InvalidArgumentException;
use Be\Pattern\BlogPublishing\Exception\InvalidExcerptException;

/**
* Excerpt - Semantic validation
Expand All @@ -18,7 +18,7 @@ final class Excerpt
public function validate(string $excerpt): void
{
if (mb_strlen($excerpt) > 250) {
throw new InvalidArgumentException('Excerpt too long');
throw new InvalidExcerptException();
}
}
}
4 changes: 2 additions & 2 deletions demos/blog-publishing/src/Semantic/HtmlBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Be\Pattern\BlogPublishing\Semantic;

use Be\Framework\Attribute\Validate;
use InvalidArgumentException;
use Be\Pattern\BlogPublishing\Exception\InvalidHtmlBodyException;

/**
* HtmlBody - Semantic validation
Expand All @@ -18,7 +18,7 @@ final class HtmlBody
public function validate(string $htmlBody): void
{
if (empty(trim(strip_tags($htmlBody)))) {
throw new InvalidArgumentException('HTML body cannot be empty');
throw new InvalidHtmlBodyException();
}
}
}
4 changes: 2 additions & 2 deletions demos/blog-publishing/src/Semantic/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Be\Pattern\BlogPublishing\Semantic;

use Be\Framework\Attribute\Validate;
use InvalidArgumentException;
use Be\Pattern\BlogPublishing\Exception\InvalidSlugException;

/**
* Slug - Semantic validation
Expand All @@ -18,7 +18,7 @@ final class Slug
public function validate(string $slug): void
{
if (!preg_match('/^[a-z0-9-]+$/', $slug)) {
throw new InvalidArgumentException('Invalid slug format');
throw new InvalidSlugException();
}
}
}
3 changes: 3 additions & 0 deletions demos/contact-form/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
"ray/di": "^2.18"
},
"require-dev": {
"be-framework/psalm-plugin": "1.x-dev",
"phpunit/phpunit": "^12"
},
"scripts": {
"psalm": "psalm --show-info=false",
"stree": "vendor/bin/stree $(ls -t var/log/*.json | head -1)",
"stree:full": "vendor/bin/stree --full $(ls -t var/log/*.json | head -1)"
},
"scripts-descriptions": {
"psalm": "Run static analysis with Psalm + Be Framework plugin.",
"stree": "Render the latest var/log/*.json as a compact tree.",
"stree:full": "Render the latest var/log/*.json as a semantic full tree with full props and close.profile details."
}
Expand Down
43 changes: 43 additions & 0 deletions demos/contact-form/psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
phpVersion="8.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<plugins>
<pluginClass class="Be\PsalmPlugin\Plugin" />
</plugins>

<issueHandlers>
<!--
Be Framework loads classes via #[Be] attributes and constructs them via
reflection in Becoming. Psalm's reachability analysis cannot see these
dynamic call paths, so the stock unused-* rules fire false positives on
valid framework patterns.
-->
<UnusedClass>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</UnusedClass>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedMethod>
<PossiblyUnusedProperty>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedProperty>
</issueHandlers>
</psalm>
3 changes: 3 additions & 0 deletions demos/hello-world/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@
"ray/di": "^2.18"
},
"require-dev": {
"be-framework/psalm-plugin": "1.x-dev",
"phpunit/phpunit": "^12"
},
"scripts": {
"dev": "php bin/be.php 'hello?name=World'",
"profile": "XDEBUG_MODE=trace php -d xdebug.use_compression=0 -d extension=xhprof.so bin/be.php 'hello?name=World'",
"psalm": "psalm --show-info=false",
"stree": "vendor/bin/stree $(ls -t var/log/*.json | head -1)",
"stree:full": "vendor/bin/stree --full $(ls -t var/log/*.json | head -1)"
},
"scripts-descriptions": {
"dev": "Run the Hello World demo in dev mode; writes a semantic log to var/log/*.json without Xdebug/XHProf profiling.",
"profile": "Run the Hello World demo with semantic profiling; writes a semantic log to var/log/*.json with uncompressed Xdebug trace and xhprof enabled.",
"psalm": "Run static analysis with Psalm + Be Framework plugin.",
"stree": "Render the latest var/log/*.json as a compact tree.",
"stree:full": "Render the latest var/log/*.json as a semantic full tree with full props and close.profile details."
}
Expand Down
43 changes: 43 additions & 0 deletions demos/hello-world/psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
phpVersion="8.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<plugins>
<pluginClass class="Be\PsalmPlugin\Plugin" />
</plugins>

<issueHandlers>
<!--
Be Framework loads classes via #[Be] attributes and constructs them via
reflection in Becoming. Psalm's reachability analysis cannot see these
dynamic call paths, so the stock unused-* rules fire false positives on
valid framework patterns.
-->
<UnusedClass>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</UnusedClass>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedMethod>
<PossiblyUnusedProperty>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedProperty>
</issueHandlers>
</psalm>
3 changes: 3 additions & 0 deletions demos/insurance-claim/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
"ray/di": "^2.18"
},
"require-dev": {
"be-framework/psalm-plugin": "1.x-dev",
"phpunit/phpunit": "^12"
},
"scripts": {
"psalm": "psalm --show-info=false",
"stree": "vendor/bin/stree $(ls -t var/log/*.json | head -1)",
"stree:full": "vendor/bin/stree --full $(ls -t var/log/*.json | head -1)"
},
"scripts-descriptions": {
"psalm": "Run static analysis with Psalm + Be Framework plugin.",
"stree": "Render the latest var/log/*.json as a compact tree.",
"stree:full": "Render the latest var/log/*.json as a semantic full tree with full props and close.profile details."
}
Expand Down
43 changes: 43 additions & 0 deletions demos/insurance-claim/psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
phpVersion="8.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<plugins>
<pluginClass class="Be\PsalmPlugin\Plugin" />
</plugins>

<issueHandlers>
<!--
Be Framework loads classes via #[Be] attributes and constructs them via
reflection in Becoming. Psalm's reachability analysis cannot see these
dynamic call paths, so the stock unused-* rules fire false positives on
valid framework patterns.
-->
<UnusedClass>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</UnusedClass>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedMethod>
<PossiblyUnusedProperty>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</PossiblyUnusedProperty>
</issueHandlers>
</psalm>
Loading
Loading