Skip to content

Allow optional tmpDir and logDir in Meta constructor#41

Merged
koriym merged 4 commits into
1.xfrom
feature/meta-optional-tmp-log-dir
Jul 10, 2026
Merged

Allow optional tmpDir and logDir in Meta constructor#41
koriym merged 4 commits into
1.xfrom
feature/meta-optional-tmp-log-dir

Conversation

@koriym

@koriym koriym commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Add optional $tmpDir / $logDir constructor arguments to Meta (BC: existing 3-arg calls unchanged).
  • Default remains {appDir}/var/tmp/{context} and {appDir}/var/log/{context}.
  • Centralize mkdir / writability checks in ensureDir().
  • Environment reading is intentionally not done in Meta; applications resolve paths and pass them in.

Usage

// defaults
new Meta('MyVendor\Project', 'prod-app', $appDir);

// overrides (resolved paths only)
new Meta('MyVendor\Project', 'prod-app', $appDir, '/var/tmp/my-app', '/var/log/my-app');

Motivation

Writable directories are deploy-dependent. Package compile can share the same Meta via the application injector (Compiler::fromInjector). Meta should accept explicit paths without taking on env/bootstrap policy.

Test plan

  • composer tests (cs / sa / phpunit)
  • Default tmp/log paths still created under var/
  • Custom tmpDir/logDir are used and created
  • CI green on PHP 8.1+

Applications can pass resolved writable paths while keeping the default
{appDir}/var/{tmp|log}/{context} layout when omitted. Directory creation
is centralized in ensureDir(); environment reading stays outside Meta.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d96479d9-1d9e-49ac-9deb-1e6be9f26d86

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/meta-optional-tmp-log-dir

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (82e687a) to head (7ef524c).

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x       #41   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
+ Complexity        19        17    -2     
===========================================
  Files              3         3           
  Lines             45        48    +3     
===========================================
+ Hits              45        48    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

koriym added 3 commits July 10, 2026 15:17
PHP filesystem APIs accept '/' on Windows; DIRECTORY_SEPARATOR is unnecessary noise here.
@koriym
koriym marked this pull request as ready for review July 10, 2026 06:30
@koriym
koriym merged commit 1a8e317 into 1.x Jul 10, 2026
37 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.

1 participant